Repository: wildfirechat/im-server Branch: wildfirechat Commit: 3eef24bdb9bf Files: 775 Total size: 4.9 MB Directory structure: gitextract_689bbic2/ ├── .editorconfig ├── .gitattributes ├── .github/ │ └── ISSUE_TEMPLATE.md ├── .gitignore ├── .travis.yml ├── LICENSE ├── LICENSE_996 ├── LICENSE_mqtt-jmeter ├── README.md ├── broker/ │ ├── config/ │ │ ├── hazelcast.xml │ │ └── wildfirechat.conf │ ├── migrate/ │ │ ├── h2/ │ │ │ ├── V10__create_default_admin.sql │ │ │ ├── V11__alter_device_token.sql │ │ │ ├── V12__add_group_control_columns.sql │ │ │ ├── V13__create_settings_table.sql │ │ │ ├── V14__add_id_for_sensitive_word.sql │ │ │ ├── V15__alter_voip_token_length.sql │ │ │ ├── V16__add_friend_blocked.sql │ │ │ ├── V17__add_user_session_token_index.sql │ │ │ ├── V18__add_friend_request_index.sql │ │ │ ├── V19__add_user_session_uid_index.sql │ │ │ ├── V1__baseline.sql │ │ │ ├── V20__user_session_add_deleted.sql │ │ │ ├── V21__user_add_deleted.sql │ │ │ ├── V22__refactor_channel_status.sql │ │ │ ├── V23__alter_message_add_to_column.sql │ │ │ ├── V24__add_friend_extra.sql │ │ │ ├── V25__create_chatroom_blacklist_manager.sql │ │ │ ├── V26__add_user_messages_line.sql │ │ │ ├── V27__create_device_table.sql │ │ │ ├── V28__add_session_user_type.sql │ │ │ ├── V29__create_receipt_table.sql │ │ │ ├── V2__create_table.sql │ │ │ ├── V30__add_group_member_create_dt.sql │ │ │ ├── V31__add_group_member_count_history_message.sql │ │ │ ├── V32__alter_setting_column_name.sql │ │ │ ├── V33__alter_group_searchable_column.sql │ │ │ ├── V34__create_files_table.sql │ │ │ ├── V35__create_file_transfer_user.sql │ │ │ ├── V36__alter_channel_status_column.sql │ │ │ ├── V37__add_user_messages_mid_index.sql │ │ │ ├── V38__add_user_messages_conv_info.sql │ │ │ ├── V39__add_group_member_friend_request_extra.sql │ │ │ ├── V3__create_sharding_table.sql │ │ │ ├── V40__add_user_messages_cont_type.sql │ │ │ ├── V41__alter_user_setting_key_column.sql │ │ │ ├── V42__create_secret_chat_table.sql │ │ │ ├── V43__add_message_table_conversation_index.sql │ │ │ ├── V44__add_channel_listener_table_member_index.sql │ │ │ ├── V45__add_channel_menu_column.sql │ │ │ ├── V46__add_group_member_mid_index.sql │ │ │ ├── V47__create_super_group.sql │ │ │ ├── V48__group_add_deleted_column.sql │ │ │ ├── V49__add_domain_table.sql │ │ │ ├── V4__create_default_chatroom.sql │ │ │ ├── V50__update_group_member_index.sql │ │ │ ├── V51__add_not_allow_name_setting.sql │ │ │ ├── V52__modify_message_target.sql │ │ │ ├── V53__session_add_ip_column.sql │ │ │ ├── V54__add_group_member_index.sql │ │ │ ├── V55__create_conference_table.sql │ │ │ ├── V56__create_join_group_request_table.sql │ │ │ ├── V57__create_friend_index.sql │ │ │ ├── V5__create_default_robot.sql │ │ │ ├── V6__add_friend_alias.sql │ │ │ ├── V7__add_createtime_user_group_table.sql │ │ │ ├── V8__add_content_type_in_messages.sql │ │ │ └── V9__add_sensitive_messages.sql │ │ ├── mysql/ │ │ │ ├── V10__create_default_admin.sql │ │ │ ├── V11__alter_device_token.sql │ │ │ ├── V12__add_group_control_columns.sql │ │ │ ├── V13__create_session_table.sql │ │ │ ├── V14__alter_createtime_user_group_table.sql │ │ │ ├── V15__alter_session_table_time.sql │ │ │ ├── V16__update_message_dt_gmt8.sql │ │ │ ├── V17__add_default_sensitive_word.sql │ │ │ ├── V18__create_settings_table.sql │ │ │ ├── V19__add_id_for_sensitive_word.sql │ │ │ ├── V1__baseline.sql │ │ │ ├── V20__alter_voip_token_length.sql │ │ │ ├── V21__add_friend_blocked.sql │ │ │ ├── V22__add_user_session_token_index.sql │ │ │ ├── V23__add_friend_request_index.sql │ │ │ ├── V24__add_user_session_uid_index.sql │ │ │ ├── V25__user_session_add_deleted.sql │ │ │ ├── V26__user_add_deleted.sql │ │ │ ├── V27__refactor_channel_status.sql │ │ │ ├── V28__alter_message_add_to_column.sql │ │ │ ├── V29__add_friend_extra.sql │ │ │ ├── V2__create_table.sql │ │ │ ├── V30__create_chatroom_blacklist_manager.sql │ │ │ ├── V31__add_user_messages_line.sql │ │ │ ├── V32__create_device_table.sql │ │ │ ├── V33__add_session_user_type.sql │ │ │ ├── V34__create_receipt_table.sql │ │ │ ├── V35__add_group_member_create_dt.sql │ │ │ ├── V36__add_group_member_count_history_message.sql │ │ │ ├── V37__alter_setting_column_name.sql │ │ │ ├── V38__alter_group_searchable_column.sql │ │ │ ├── V39__create_files_table.sql │ │ │ ├── V3__create_sharding_table.sql │ │ │ ├── V40__create_file_transfer_user.sql │ │ │ ├── V41__alter_channel_status_column.sql │ │ │ ├── V42__add_user_messages_mid_index.sql │ │ │ ├── V43__add_user_messages_conv_info.sql │ │ │ ├── V44__add_group_member_friend_request_extra.sql │ │ │ ├── V45__add_user_messages_cont_type.sql │ │ │ ├── V46__utf8mb4_unicode_ci_to_utf8mb4_bin.sql │ │ │ ├── V47__fix_read_report_error.sql │ │ │ ├── V48__alter_user_setting_key_column.sql │ │ │ ├── V49__create_secret_chat_table.sql │ │ │ ├── V4__create_default_chatroom.sql │ │ │ ├── V50__add_message_table_conversation_index.sql │ │ │ ├── V51__add_channel_listener_table_member_index.sql │ │ │ ├── V52__add_channel_menu_column.sql │ │ │ ├── V53__add_group_member_mid_index.sql │ │ │ ├── V54__create_super_group.sql │ │ │ ├── V55__group_add_deleted_column.sql │ │ │ ├── V56__add_domain_table.sql │ │ │ ├── V57__update_group_member_index.sql │ │ │ ├── V58__reupdate_group_member_index.sql │ │ │ ├── V59__add_no_allow_name_setting.sql │ │ │ ├── V5__create_default_robot.sql │ │ │ ├── V60__modify_messages_target.sql │ │ │ ├── V61__session_add_ip_column.sql │ │ │ ├── V64__add_group_member_index.sql │ │ │ ├── V65__create_conference_table.sql │ │ │ ├── V66__create_join_group_request_table.sql │ │ │ ├── V67__create_friend_index.sql │ │ │ ├── V6__add_friend_alias.sql │ │ │ ├── V7__add_createtime_user_group_table.sql │ │ │ ├── V8__add_content_type_in_messages.sql │ │ │ └── V9__add_sensitive_messages.sql │ │ └── 重要!!!必看!!!.txt │ ├── nginx/ │ │ └── imserver.conf │ ├── pom.xml │ └── src/ │ └── main/ │ ├── java/ │ │ ├── cn/ │ │ │ └── wildfirechat/ │ │ │ ├── push/ │ │ │ │ ├── PushMessage.java │ │ │ │ └── PushServer.java │ │ │ └── server/ │ │ │ ├── Server.java │ │ │ └── ThreadPoolExecutorWrapper.java │ │ ├── com/ │ │ │ └── xiaoleilu/ │ │ │ └── loServer/ │ │ │ ├── LoFileServer.java │ │ │ ├── LoServer.java │ │ │ ├── RestResult.java │ │ │ ├── ServerSetting.java │ │ │ ├── action/ │ │ │ │ ├── Action.java │ │ │ │ ├── CheckTokenAction.java │ │ │ │ ├── ClassUtil.java │ │ │ │ ├── DefaultIndexAction.java │ │ │ │ ├── FileAction.java │ │ │ │ ├── IMAction.java │ │ │ │ ├── NotFoundAction.java │ │ │ │ ├── RouteAction.java │ │ │ │ ├── UnknownErrorAction.java │ │ │ │ ├── UploadFileAction.java │ │ │ │ ├── VersionAction.java │ │ │ │ ├── admin/ │ │ │ │ │ ├── AddFriendRequestAction.java │ │ │ │ │ ├── AddGroupMemberAction.java │ │ │ │ │ ├── AdminAction.java │ │ │ │ │ ├── AliasGetAction.java │ │ │ │ │ ├── AliasPutAction.java │ │ │ │ │ ├── ApplicationGetUserInfoAction.java │ │ │ │ │ ├── BlacklistAction.java │ │ │ │ │ ├── BlacklistGetAction.java │ │ │ │ │ ├── BlockUserAction.java │ │ │ │ │ ├── BroadcastMessageAction.java │ │ │ │ │ ├── ChannelSubscriberAction.java │ │ │ │ │ ├── CheckUserOnlineAction.java │ │ │ │ │ ├── CheckUserSubscribeChannelAction.java │ │ │ │ │ ├── CreateChannelAction.java │ │ │ │ │ ├── CreateChatroomAction.java │ │ │ │ │ ├── CreateGroupAction.java │ │ │ │ │ ├── CreateRobotAction.java │ │ │ │ │ ├── CreateUserAction.java │ │ │ │ │ ├── DestoryChatroomAction.java │ │ │ │ │ ├── DestroyChannelAction.java │ │ │ │ │ ├── DestroyUserAction.java │ │ │ │ │ ├── DismissGroupAction.java │ │ │ │ │ ├── FriendExtraPutAction.java │ │ │ │ │ ├── FriendRelationAction.java │ │ │ │ │ ├── FriendRelationGetAction.java │ │ │ │ │ ├── GetAllUserAction.java │ │ │ │ │ ├── GetBatchUserAction.java │ │ │ │ │ ├── GetChannelAction.java │ │ │ │ │ ├── GetChatroomInfoAction.java │ │ │ │ │ ├── GetChatroomMembersAction.java │ │ │ │ │ ├── GetCommonGroupsAction.java │ │ │ │ │ ├── GetGroupInfoAction.java │ │ │ │ │ ├── GetGroupMemberAction.java │ │ │ │ │ ├── GetGroupMembersAction.java │ │ │ │ │ ├── GetIMTokenAction.java │ │ │ │ │ ├── GetMessageAction.java │ │ │ │ │ ├── GetOnlineUserAction.java │ │ │ │ │ ├── GetRobotAction.java │ │ │ │ │ ├── GetSystemSettingAction.java │ │ │ │ │ ├── GetUploadUrlAction.java │ │ │ │ │ ├── GetUserAction.java │ │ │ │ │ ├── GetUserBlockListAction.java │ │ │ │ │ ├── GetUserBlockStatusAction.java │ │ │ │ │ ├── GetUserChatroomAction.java │ │ │ │ │ ├── GetUserGroupsAction.java │ │ │ │ │ ├── GetUserGroupsByTypeAction.java │ │ │ │ │ ├── GetUserOnlineCountAction.java │ │ │ │ │ ├── GetUserRobotsAction.java │ │ │ │ │ ├── GetUserSessionsAction.java │ │ │ │ │ ├── GetUsersByEmailAction.java │ │ │ │ │ ├── HealthAction.java │ │ │ │ │ ├── KickoffGroupMemberAction.java │ │ │ │ │ ├── KickoffUserClientAction.java │ │ │ │ │ ├── ModifyGroupInfoAction.java │ │ │ │ │ ├── ModifyGroupMemberAliasAction.java │ │ │ │ │ ├── ModifyGroupMemberExtraAction.java │ │ │ │ │ ├── MulticastMessageAction.java │ │ │ │ │ ├── PutSystemSettingAction.java │ │ │ │ │ ├── QuitGroupMemberAction.java │ │ │ │ │ ├── RecallMessageAction.java │ │ │ │ │ ├── RecallMultiCastMessageAction.java │ │ │ │ │ ├── RelationGetAction.java │ │ │ │ │ ├── SendMessageAction.java │ │ │ │ │ ├── SensitiveWordAddAction.java │ │ │ │ │ ├── SensitiveWordDeleteAction.java │ │ │ │ │ ├── SensitiveWordQueryAction.java │ │ │ │ │ ├── SetGroupManagerAction.java │ │ │ │ │ ├── TransferGroupAction.java │ │ │ │ │ └── UpdateUserAction.java │ │ │ │ ├── channel/ │ │ │ │ │ ├── ApplicationGetUserInfoAction.java │ │ │ │ │ ├── ChannelAction.java │ │ │ │ │ ├── GetChannelAction.java │ │ │ │ │ ├── GetChannelSubscribersAction.java │ │ │ │ │ ├── GetIsChannelSubscriberAction.java │ │ │ │ │ ├── GetUserAction.java │ │ │ │ │ ├── ModifyChannelProfileAction.java │ │ │ │ │ ├── SendMessageAction.java │ │ │ │ │ └── SubscriberChannelAction.java │ │ │ │ └── robot/ │ │ │ │ ├── AddGroupMemberAction.java │ │ │ │ ├── ApplicationGetUserInfoAction.java │ │ │ │ ├── CreateGroupAction.java │ │ │ │ ├── DeleteCallbackAction.java │ │ │ │ ├── DismissGroupAction.java │ │ │ │ ├── GetCallbackAction.java │ │ │ │ ├── GetGroupInfoAction.java │ │ │ │ ├── GetGroupMemberAction.java │ │ │ │ ├── GetGroupMembersAction.java │ │ │ │ ├── GetProfileAction.java │ │ │ │ ├── GetUploadUrlAction.java │ │ │ │ ├── GetUserAction.java │ │ │ │ ├── KickoffGroupMemberAction.java │ │ │ │ ├── ModifyGroupInfoAction.java │ │ │ │ ├── ModifyGroupMemberAliasAction.java │ │ │ │ ├── ModifyGroupMemberExtraAction.java │ │ │ │ ├── QuitGroupMemberAction.java │ │ │ │ ├── ReplyMessageAction.java │ │ │ │ ├── RobotAction.java │ │ │ │ ├── SendMessageAction.java │ │ │ │ ├── SetCallbackAction.java │ │ │ │ ├── TransferGroupAction.java │ │ │ │ └── UpdateProfileAction.java │ │ │ ├── annotation/ │ │ │ │ ├── HttpMethod.java │ │ │ │ ├── RequireAuthentication.java │ │ │ │ └── Route.java │ │ │ ├── exception/ │ │ │ │ └── ServerSettingException.java │ │ │ ├── filter/ │ │ │ │ └── Filter.java │ │ │ ├── handler/ │ │ │ │ ├── ActionHandler.java │ │ │ │ ├── AdminActionHandler.java │ │ │ │ ├── HttpChunkContentCompressor.java │ │ │ │ ├── HttpFileServerController.java │ │ │ │ ├── HttpFileServerHandler.java │ │ │ │ ├── HttpResponseHelper.java │ │ │ │ ├── IMActionHandler.java │ │ │ │ ├── Request.java │ │ │ │ └── Response.java │ │ │ ├── listener/ │ │ │ │ └── FileProgressiveFutureListener.java │ │ │ └── model/ │ │ │ └── FriendData.java │ │ ├── io/ │ │ │ ├── moquette/ │ │ │ │ ├── BrokerConstants.java │ │ │ │ ├── connections/ │ │ │ │ │ ├── IConnectionsManager.java │ │ │ │ │ ├── MqttConnectionMetrics.java │ │ │ │ │ └── MqttSession.java │ │ │ │ ├── imhandler/ │ │ │ │ │ ├── AddFriendHandler.java │ │ │ │ │ ├── AddGroupMember.java │ │ │ │ │ ├── BlackListRequestHandler.java │ │ │ │ │ ├── BroadcastMessageHandler.java │ │ │ │ │ ├── ChannelListenMember.java │ │ │ │ │ ├── ChannelListenedListHandler.java │ │ │ │ │ ├── ChannelSearchHandler.java │ │ │ │ │ ├── ConfigApplicationHandler.java │ │ │ │ │ ├── CreateChannelHandler.java │ │ │ │ │ ├── CreateGroupHandler.java │ │ │ │ │ ├── DeleteFriendHandler.java │ │ │ │ │ ├── DestroyChannelHandler.java │ │ │ │ │ ├── DestroyUserHandler.java │ │ │ │ │ ├── DisconnectHandler.java │ │ │ │ │ ├── DismissGroupHandler.java │ │ │ │ │ ├── FriendPullHandler.java │ │ │ │ │ ├── FriendRequestPullHandler.java │ │ │ │ │ ├── GetApplicationTokenHandler.java │ │ │ │ │ ├── GetChannelInfoHandler.java │ │ │ │ │ ├── GetChatroomInfoHandler.java │ │ │ │ │ ├── GetChatroomMemberHandler.java │ │ │ │ │ ├── GetCommonGroupsHandler.java │ │ │ │ │ ├── GetGroupInfoHandler.java │ │ │ │ │ ├── GetGroupMemberHandler.java │ │ │ │ │ ├── GetMediaUploadTokenHandler.java │ │ │ │ │ ├── GetMyGroupsHandler.java │ │ │ │ │ ├── GetQiniuUploadTokenHandler.java │ │ │ │ │ ├── GetTokenHandler.java │ │ │ │ │ ├── GetUserInfoHandler.java │ │ │ │ │ ├── GetUserSettingHandler.java │ │ │ │ │ ├── GroupHandler.java │ │ │ │ │ ├── HandleFriendRequestHandler.java │ │ │ │ │ ├── Handler.java │ │ │ │ │ ├── IMHandler.java │ │ │ │ │ ├── JoinChatroomHandler.java │ │ │ │ │ ├── KickoffGroupMember.java │ │ │ │ │ ├── KickoffPCClientHandler.java │ │ │ │ │ ├── LoadRemoteMessagesHandler.java │ │ │ │ │ ├── ModifyChannelInfoHandler.java │ │ │ │ │ ├── ModifyGroupAliasHandler.java │ │ │ │ │ ├── ModifyGroupInfoHandler.java │ │ │ │ │ ├── ModifyGroupMemberAliasHandler.java │ │ │ │ │ ├── ModifyGroupMemberExtraHandler.java │ │ │ │ │ ├── ModifyMyInfoHandler.java │ │ │ │ │ ├── MultiCastMessageHandler.java │ │ │ │ │ ├── PullMessageHandler.java │ │ │ │ │ ├── PutUserSettingHandler.java │ │ │ │ │ ├── QuitChatroomHandler.java │ │ │ │ │ ├── QuitGroupHandler.java │ │ │ │ │ ├── RecallMessageHandler.java │ │ │ │ │ ├── RecallMultiCastMessageHandler.java │ │ │ │ │ ├── ReplyMessageHandler.java │ │ │ │ │ ├── RouteHandler.java │ │ │ │ │ ├── SendMessageHandler.java │ │ │ │ │ ├── SetFriendAliasRequestHandler.java │ │ │ │ │ ├── SetFriendExtraHandler.java │ │ │ │ │ ├── SetGroupManagerHandler.java │ │ │ │ │ ├── SyncFriendRequestUnreadHandler.java │ │ │ │ │ ├── TransferChannelHandler.java │ │ │ │ │ ├── TransferGroupHandler.java │ │ │ │ │ ├── UploadDeviceTokenHandler.java │ │ │ │ │ └── UserSearchHandler.java │ │ │ │ ├── interception/ │ │ │ │ │ ├── InterceptHandler.java │ │ │ │ │ ├── Interceptor.java │ │ │ │ │ └── messages/ │ │ │ │ │ ├── InterceptAbstractMessage.java │ │ │ │ │ ├── InterceptAcknowledgedMessage.java │ │ │ │ │ ├── InterceptConnectMessage.java │ │ │ │ │ ├── InterceptConnectionLostMessage.java │ │ │ │ │ ├── InterceptDisconnectMessage.java │ │ │ │ │ ├── InterceptMessage.java │ │ │ │ │ └── InterceptPublishMessage.java │ │ │ │ ├── logging/ │ │ │ │ │ └── LoggingUtils.java │ │ │ │ ├── persistence/ │ │ │ │ │ ├── ChannelLoader.java │ │ │ │ │ ├── ChatroomLoader.java │ │ │ │ │ ├── DatabaseStore.java │ │ │ │ │ ├── GroupLoader.java │ │ │ │ │ ├── MemoryMessagesStore.java │ │ │ │ │ ├── MemorySessionStore.java │ │ │ │ │ ├── MemoryStorageService.java │ │ │ │ │ ├── MessageLoader.java │ │ │ │ │ ├── RobotLoader.java │ │ │ │ │ ├── ServerAPIHelper.java │ │ │ │ │ ├── UserClientEntry.java │ │ │ │ │ ├── UserLoader.java │ │ │ │ │ ├── UserStatusLoader.java │ │ │ │ │ └── remote/ │ │ │ │ │ └── RequestInfo.java │ │ │ │ ├── server/ │ │ │ │ │ ├── ConnectionDescriptor.java │ │ │ │ │ ├── ConnectionDescriptorStore.java │ │ │ │ │ ├── Constants.java │ │ │ │ │ ├── DefaultMoquetteSslContextCreator.java │ │ │ │ │ ├── Server.java │ │ │ │ │ ├── ServerAcceptor.java │ │ │ │ │ ├── config/ │ │ │ │ │ │ ├── ClasspathResourceLoader.java │ │ │ │ │ │ ├── ConfigurationParser.java │ │ │ │ │ │ ├── FileResourceLoader.java │ │ │ │ │ │ ├── IConfig.java │ │ │ │ │ │ ├── IResourceLoader.java │ │ │ │ │ │ ├── MediaServerConfig.java │ │ │ │ │ │ ├── MemoryConfig.java │ │ │ │ │ │ └── ResourceLoaderConfig.java │ │ │ │ │ └── netty/ │ │ │ │ │ ├── AutoFlushHandler.java │ │ │ │ │ ├── MoquetteIdleTimeoutHandler.java │ │ │ │ │ ├── NettyAcceptor.java │ │ │ │ │ ├── NettyMQTTHandler.java │ │ │ │ │ ├── NettyUtils.java │ │ │ │ │ └── metrics/ │ │ │ │ │ ├── BytesMetrics.java │ │ │ │ │ ├── BytesMetricsCollector.java │ │ │ │ │ ├── BytesMetricsHandler.java │ │ │ │ │ ├── MQTTMessageLogger.java │ │ │ │ │ ├── MessageMetrics.java │ │ │ │ │ ├── MessageMetricsCollector.java │ │ │ │ │ └── MessageMetricsHandler.java │ │ │ │ └── spi/ │ │ │ │ ├── ClientSession.java │ │ │ │ ├── IMatchingCondition.java │ │ │ │ ├── IMessagesStore.java │ │ │ │ ├── IMessaging.java │ │ │ │ ├── ISessionsStore.java │ │ │ │ ├── IStore.java │ │ │ │ ├── MessageGUID.java │ │ │ │ ├── impl/ │ │ │ │ │ ├── BrokerInterceptor.java │ │ │ │ │ ├── DebugUtils.java │ │ │ │ │ ├── DesUtil.java │ │ │ │ │ ├── InternalRepublisher.java │ │ │ │ │ ├── MessagesPublisher.java │ │ │ │ │ ├── PersistentQueueMessageSender.java │ │ │ │ │ ├── ProtocolProcessor.java │ │ │ │ │ ├── ProtocolProcessorBootstrapper.java │ │ │ │ │ ├── Qos1PublishHandler.java │ │ │ │ │ ├── QosPublishHandler.java │ │ │ │ │ ├── Utils.java │ │ │ │ │ ├── security/ │ │ │ │ │ │ ├── ACLFileParser.java │ │ │ │ │ │ ├── AES.java │ │ │ │ │ │ ├── AcceptAllAuthenticator.java │ │ │ │ │ │ ├── Authorization.java │ │ │ │ │ │ ├── AuthorizationsCollector.java │ │ │ │ │ │ ├── DBAuthenticator.java │ │ │ │ │ │ ├── DenyAllAuthorizator.java │ │ │ │ │ │ ├── FileAuthenticator.java │ │ │ │ │ │ ├── ITokenGenerator.java │ │ │ │ │ │ ├── PermitAllAuthorizator.java │ │ │ │ │ │ ├── ResourceAuthenticator.java │ │ │ │ │ │ └── TokenAuthenticator.java │ │ │ │ │ └── subscriptions/ │ │ │ │ │ ├── Token.java │ │ │ │ │ └── Topic.java │ │ │ │ └── security/ │ │ │ │ ├── DES.java │ │ │ │ ├── IAuthenticator.java │ │ │ │ ├── IAuthorizator.java │ │ │ │ ├── ISslContextCreator.java │ │ │ │ └── Tokenor.java │ │ │ └── netty/ │ │ │ └── handler/ │ │ │ └── codec/ │ │ │ └── mqtt/ │ │ │ ├── MqttCodecUtil.java │ │ │ ├── MqttConnAckMessage.java │ │ │ ├── MqttConnAckVariableHeader.java │ │ │ ├── MqttConnectAckPayload.java │ │ │ ├── MqttConnectMessage.java │ │ │ ├── MqttConnectPayload.java │ │ │ ├── MqttConnectReturnCode.java │ │ │ ├── MqttConnectVariableHeader.java │ │ │ ├── MqttConstant.java │ │ │ ├── MqttDecoder.java │ │ │ ├── MqttEncoder.java │ │ │ ├── MqttFixedHeader.java │ │ │ ├── MqttIdentifierRejectedException.java │ │ │ ├── MqttMessage.java │ │ │ ├── MqttMessageBuilders.java │ │ │ ├── MqttMessageFactory.java │ │ │ ├── MqttMessageIdAndPropertiesVariableHeader.java │ │ │ ├── MqttMessageIdVariableHeader.java │ │ │ ├── MqttMessageType.java │ │ │ ├── MqttProperties.java │ │ │ ├── MqttPubAckMessage.java │ │ │ ├── MqttPubReplyMessageVariableHeader.java │ │ │ ├── MqttPublishMessage.java │ │ │ ├── MqttPublishVariableHeader.java │ │ │ ├── MqttQoS.java │ │ │ ├── MqttReasonCodeAndPropertiesVariableHeader.java │ │ │ ├── MqttSubAckMessage.java │ │ │ ├── MqttSubAckPayload.java │ │ │ ├── MqttSubscribeMessage.java │ │ │ ├── MqttSubscribePayload.java │ │ │ ├── MqttSubscriptionOption.java │ │ │ ├── MqttTopicSubscription.java │ │ │ ├── MqttUnacceptableProtocolVersionException.java │ │ │ ├── MqttUnsubAckMessage.java │ │ │ ├── MqttUnsubAckPayload.java │ │ │ ├── MqttUnsubscribeMessage.java │ │ │ ├── MqttUnsubscribePayload.java │ │ │ ├── MqttVersion.java │ │ │ └── package-info.java │ │ └── win/ │ │ └── liyufan/ │ │ └── im/ │ │ ├── DBUtil.java │ │ ├── FrequencyLimistCounter.java │ │ ├── GitRepositoryState.java │ │ ├── GsonUtil.java │ │ ├── HttpUtils.java │ │ ├── IDUtils.java │ │ ├── IMTopic.java │ │ ├── MessageBundle.java │ │ ├── MessageShardingUtil.java │ │ ├── RateLimiter.java │ │ ├── SensitiveFilter.java │ │ ├── SpinLock.java │ │ ├── UUIDGenerator.java │ │ ├── UserSettingScope.java │ │ ├── Utility.java │ │ └── extended/ │ │ └── mqttmessage/ │ │ └── ModifiedMqttPubAckMessage.java │ └── resources/ │ ├── c3p0-config.xml │ └── log4j2.xml ├── build.sh ├── checkstyle-suppressions.xml ├── checkstyle.xml ├── common/ │ ├── pom.xml │ └── src/ │ └── main/ │ └── java/ │ └── cn/ │ └── wildfirechat/ │ ├── common/ │ │ ├── APIPath.java │ │ ├── ErrorCode.java │ │ └── IMExceptionEvent.java │ ├── pojos/ │ │ ├── ArticleContent.java │ │ ├── BroadMessageData.java │ │ ├── BroadMessageResult.java │ │ ├── ChannelUpdateEvent.java │ │ ├── ChatroomMemberUpdateEvent.java │ │ ├── ChatroomUpdateEvent.java │ │ ├── ConferenceCreateEvent.java │ │ ├── ConferenceDestroyEvent.java │ │ ├── ConferenceJoinEvent.java │ │ ├── ConferenceLeaveEvent.java │ │ ├── ConferencePublishEvent.java │ │ ├── ConferenceUnpublishEvent.java │ │ ├── Conversation.java │ │ ├── DeleteMessageData.java │ │ ├── FilesPojo.java │ │ ├── ForwardDeviceMessageData.java │ │ ├── GetConversationFilesPojo.java │ │ ├── GetOnlineUserCountResult.java │ │ ├── GetOnlineUserRequest.java │ │ ├── GetOnlineUserResult.java │ │ ├── GetUserFilesPojo.java │ │ ├── GetUserSessionResult.java │ │ ├── GroupMemberUpdateEvent.java │ │ ├── GroupNotificationBinaryContent.java │ │ ├── GroupUpdateEvent.java │ │ ├── HealthCheckResult.java │ │ ├── InputAddFriendRequest.java │ │ ├── InputAddGroupMember.java │ │ ├── InputApplicationGetUserInfo.java │ │ ├── InputBlacklistRequest.java │ │ ├── InputChannelId.java │ │ ├── InputChannelSubscribe.java │ │ ├── InputChatroomId.java │ │ ├── InputChatroomMute.java │ │ ├── InputClearUserMessages.java │ │ ├── InputConferenceRequest.java │ │ ├── InputCountOffset.java │ │ ├── InputCreateChannel.java │ │ ├── InputCreateChatroom.java │ │ ├── InputCreateDevice.java │ │ ├── InputCreateGroup.java │ │ ├── InputCreateRobot.java │ │ ├── InputDestoryChatroom.java │ │ ├── InputDestroyUser.java │ │ ├── InputDeviceId.java │ │ ├── InputDismissGroup.java │ │ ├── InputGetAlias.java │ │ ├── InputGetChannelInfo.java │ │ ├── InputGetChatroomInfo.java │ │ ├── InputGetConvReadTime.java │ │ ├── InputGetFriendList.java │ │ ├── InputGetGroup.java │ │ ├── InputGetGroupMember.java │ │ ├── InputGetPresignedUploadUrl.java │ │ ├── InputGetToken.java │ │ ├── InputGetUserGroupByType.java │ │ ├── InputGetUserInfo.java │ │ ├── InputGetUserList.java │ │ ├── InputGetUserSK.java │ │ ├── InputGroupBase.java │ │ ├── InputHandleFriendRequest.java │ │ ├── InputIntValue.java │ │ ├── InputKickoffGroupMember.java │ │ ├── InputMessageUid.java │ │ ├── InputModifyChannelInfo.java │ │ ├── InputModifyGroupInfo.java │ │ ├── InputMuteGroupMember.java │ │ ├── InputOutputDomainInfo.java │ │ ├── InputOutputDomainInfoList.java │ │ ├── InputOutputSensitiveWords.java │ │ ├── InputOutputUserBlockStatus.java │ │ ├── InputOutputUserInfo.java │ │ ├── InputQuitGroup.java │ │ ├── InputRobotId.java │ │ ├── InputSetChatroomBlacklist.java │ │ ├── InputSetChatroomManager.java │ │ ├── InputSetGroupManager.java │ │ ├── InputSetGroupMemberAlias.java │ │ ├── InputSetGroupMemberExtra.java │ │ ├── InputStringList.java │ │ ├── InputStringValue.java │ │ ├── InputSubscribeChannel.java │ │ ├── InputTransferGroup.java │ │ ├── InputUpdateAlias.java │ │ ├── InputUpdateFriendExtra.java │ │ ├── InputUpdateFriendStatusRequest.java │ │ ├── InputUpdateUserInfo.java │ │ ├── InputUserConversation.java │ │ ├── InputUserId.java │ │ ├── InputUserLogin.java │ │ ├── IntStringPairPojo.java │ │ ├── LongPojo.java │ │ ├── MessagePayload.java │ │ ├── MultiMessageResult.java │ │ ├── MulticastMessageData.java │ │ ├── MyInfoType.java │ │ ├── OutputApplicationConfigData.java │ │ ├── OutputApplicationUserInfo.java │ │ ├── OutputBooleanValue.java │ │ ├── OutputChatroomBlackInfos.java │ │ ├── OutputCheckUserOnline.java │ │ ├── OutputClient.java │ │ ├── OutputCreateChannel.java │ │ ├── OutputCreateChatroom.java │ │ ├── OutputCreateDevice.java │ │ ├── OutputCreateGroupResult.java │ │ ├── OutputCreateRobot.java │ │ ├── OutputCreateUser.java │ │ ├── OutputDevice.java │ │ ├── OutputDeviceHost.java │ │ ├── OutputDeviceList.java │ │ ├── OutputGetAlias.java │ │ ├── OutputGetChannelInfo.java │ │ ├── OutputGetChatroomInfo.java │ │ ├── OutputGetFriendList.java │ │ ├── OutputGetIMTokenData.java │ │ ├── OutputGetUserList.java │ │ ├── OutputGroupIds.java │ │ ├── OutputGroupMemberList.java │ │ ├── OutputLoginData.java │ │ ├── OutputMessageData.java │ │ ├── OutputNotifyChannelSubscribeStatus.java │ │ ├── OutputPresignedUploadUrl.java │ │ ├── OutputReadData.java │ │ ├── OutputRecallMessageData.java │ │ ├── OutputRobot.java │ │ ├── OutputRouteData.java │ │ ├── OutputStringList.java │ │ ├── OutputTimestamp.java │ │ ├── OutputUserBlockStatusList.java │ │ ├── OutputUserChatroom.java │ │ ├── OutputUserInfoList.java │ │ ├── OutputUserStatus.java │ │ ├── PojoChannelMenu.java │ │ ├── PojoConferenceCreate.java │ │ ├── PojoConferenceInfo.java │ │ ├── PojoConferenceInfoList.java │ │ ├── PojoConferenceParticipant.java │ │ ├── PojoConferenceParticipantList.java │ │ ├── PojoConferenceRecording.java │ │ ├── PojoConferenceRoomId.java │ │ ├── PojoConferenceRtpForwardReq.java │ │ ├── PojoConferenceRtpForwarders.java │ │ ├── PojoConferenceStopRtpForwardReq.java │ │ ├── PojoGroup.java │ │ ├── PojoGroupInfo.java │ │ ├── PojoGroupInfoList.java │ │ ├── PojoGroupMember.java │ │ ├── RecallMessageData.java │ │ ├── RecallMultiCastMessageData.java │ │ ├── RelationPojo.java │ │ ├── RelationUpdateEvent.java │ │ ├── ReplyMessageData.java │ │ ├── RepublishChannelMessageData.java │ │ ├── RobotCallbackPojo.java │ │ ├── SendChannelMessageData.java │ │ ├── SendMessageData.java │ │ ├── SendMessageResult.java │ │ ├── StringPairPojo.java │ │ ├── SystemSettingPojo.java │ │ ├── UpdateMessageContentData.java │ │ ├── UserOnlineStatus.java │ │ ├── UserSettingPojo.java │ │ ├── mesh/ │ │ │ ├── MeshRestResult.java │ │ │ ├── PojoAddFriendReq.java │ │ │ ├── PojoAddGroupMember.java │ │ │ ├── PojoAddJoinGroupRequest.java │ │ │ ├── PojoDeleteFriend.java │ │ │ ├── PojoDismissGroup.java │ │ │ ├── PojoDomainPingRequest.java │ │ │ ├── PojoDomainPingResponse.java │ │ │ ├── PojoGroupUpdated.java │ │ │ ├── PojoHandleFriendRequestReq.java │ │ │ ├── PojoKickoffGroupMember.java │ │ │ ├── PojoModifyGroupInfo.java │ │ │ ├── PojoPublishMessageReq.java │ │ │ ├── PojoQuitGroup.java │ │ │ ├── PojoRecallMessageReq.java │ │ │ ├── PojoSearchUserReq.java │ │ │ ├── PojoSearchUserRes.java │ │ │ ├── PojoSendMessageReq.java │ │ │ ├── PojoString.java │ │ │ ├── PojoStringList.java │ │ │ ├── PojoTransferGroup.java │ │ │ ├── PojoUserConferenceEvent.java │ │ │ ├── PojoUserConferenceRequest.java │ │ │ └── PojoUserConferenceResponse.java │ │ └── moments/ │ │ ├── CommentMsgPojo.java │ │ ├── CommentPojo.java │ │ ├── FeedPojo.java │ │ ├── FeedsPojo.java │ │ ├── IdPojo.java │ │ ├── MediaEntry.java │ │ ├── MomentProfilePojo.java │ │ ├── PostFeedResult.java │ │ ├── PullCommentsRequestPojo.java │ │ ├── PullFeedRequestPojo.java │ │ ├── PullOneFeedRequestPojo.java │ │ ├── PullProfileRequestPojo.java │ │ ├── PushProfileListRequestPojo.java │ │ └── PushProfileValueRequestPojo.java │ └── proto/ │ ├── ProtoConstants.java │ └── WFCMessage.java ├── distribution/ │ ├── pom.xml │ └── src/ │ └── main/ │ ├── assembly/ │ │ └── assembly.xml │ ├── checker/ │ │ └── README.md │ ├── deb/ │ │ └── control/ │ │ ├── control │ │ ├── postinst │ │ └── postrm │ ├── files/ │ │ └── README.txt │ ├── resources/ │ │ ├── c3p0-config.xml │ │ ├── hazelcast.xml │ │ ├── log4j2.xml │ │ └── wildfirechat.conf │ ├── rpm/ │ │ ├── install.sh │ │ └── uninstall.sh │ └── scripts/ │ ├── stop.sh │ ├── wildfirechat.bat │ └── wildfirechat.sh ├── docker/ │ ├── Dockerfile │ └── README.md ├── flyway_repaire_migrate_38.sql ├── license-eplv10-aslv20.html ├── license_moquette.txt ├── pom.xml ├── release_note.md ├── sdk/ │ ├── README.md │ ├── pom.xml │ ├── sdk_readme.txt │ └── src/ │ └── main/ │ └── java/ │ ├── cn/ │ │ └── wildfirechat/ │ │ └── sdk/ │ │ ├── AdminConfig.java │ │ ├── ChannelAdmin.java │ │ ├── ChannelServiceApi.java │ │ ├── ChatroomAdmin.java │ │ ├── ConferenceAdmin.java │ │ ├── GeneralAdmin.java │ │ ├── GenerateTestData.java │ │ ├── GroupAdmin.java │ │ ├── Main.java │ │ ├── MeshAdmin.java │ │ ├── MessageAdmin.java │ │ ├── MomentsAdmin.java │ │ ├── RelationAdmin.java │ │ ├── RobotService.java │ │ ├── SensitiveAdmin.java │ │ ├── UserAdmin.java │ │ ├── messagecontent/ │ │ │ ├── ArticlesMessageContent.java │ │ │ ├── CallStartMessageContent.java │ │ │ ├── CardMessageContent.java │ │ │ ├── DeleteMessageContent.java │ │ │ ├── FileMessageContent.java │ │ │ ├── ImageMessageContent.java │ │ │ ├── LinkMessageContent.java │ │ │ ├── LocationMessageContent.java │ │ │ ├── MediaMessageContent.java │ │ │ ├── MessageContent.java │ │ │ ├── MessageContentFactory.java │ │ │ ├── MultiCallOngoingMessageContent.java │ │ │ ├── NotDeliveredMessageContent.java │ │ │ ├── PTTSoundMessageContent.java │ │ │ ├── RecallMessageContent.java │ │ │ ├── RichNotificationMessageContent.java │ │ │ ├── SoundMessageContent.java │ │ │ ├── StickerMessageContent.java │ │ │ ├── StreamTextGeneratedMessageContent.java │ │ │ ├── StreamTextGeneratingMessageContent.java │ │ │ ├── TextMessageContent.java │ │ │ ├── TipNotificationMessageContent.java │ │ │ ├── TypingMessageContent.java │ │ │ ├── UnknownMessageContent.java │ │ │ └── VideoMessageContent.java │ │ ├── model/ │ │ │ ├── IMResult.java │ │ │ ├── Message.java │ │ │ └── QuoteInfo.java │ │ └── utilities/ │ │ ├── AdminHttpUtils.java │ │ ├── ChannelHttpUtils.java │ │ ├── ClassUtil.java │ │ ├── HttpUtils.java │ │ ├── JsonUtils.java │ │ └── RobotHttpUtils.java │ └── ikidou/ │ └── reflect/ │ ├── TypeBuilder.java │ ├── TypeToken.java │ ├── exception/ │ │ └── TypeException.java │ └── typeimpl/ │ ├── ParameterizedTypeImpl.java │ └── WildcardTypeImpl.java └── systemd/ ├── README.md └── im-server.service ================================================ FILE CONTENTS ================================================ ================================================ FILE: .editorconfig ================================================ # EditorConfig is awesome: http://EditorConfig.org # top-most EditorConfig file root = true # Unix-style newlines with a newline ending every file [*] end_of_line = lf insert_final_newline = true charset = utf-8 indent_style = space indent_size = 4 max_line_length=120 [*.gradle] indent_size = 2 ================================================ FILE: .gitattributes ================================================ *.cpp linguist-language=java *.cc linguist-language=java ================================================ FILE: .github/ISSUE_TEMPLATE.md ================================================ ## 提issue小提示 为了尽快定位问题,需要提供足够的信息,请按照我们的要求格式来提问。***如果您不按照格式提问,我们将无法回复您的问题*** #### 操作说明 详细说明操作那个界面,每一步骤都要说得详细,如果是SDK或者api使用问题,需要详细说明调用的那个函数,参数都是什么。 #### 表现现象 描述一下什么现象,比如说函数返回error,errorcode是多少,或者界面上是什么状态,比如发送消息显示发送失败的红点。不要笼统的说功能有问题,不起作用。 #### 预期结果 你认为正确的表现应该是什么样的。 #### 补充条件 是否是必现的,还是偶现的?是否只有在特殊的网络/设备/平台上出现,还是所有的都出现。还有您用的版本是什么时候的,是不是最新版 #### demo对比结果 请用demo对比测试,demo上是什么状态。 #### 检索已有问题 除了可以检索已有issue外,还可以去野火论坛查找已有问题,论坛地址为 https://bbs.wildfirechat.cn #### star 我们 给我们点个star,可以及时接收到我们回复信息,另外也是对我们支持人员辛苦工作的认可,激励我们更好更快地为大家服务。 ================================================ FILE: .gitignore ================================================ /build */build/ /target/ /parser/target/ /benchmarking/target/ .idea/ *.iml broker/target/ client/target/ parser_commons/target/ netty_parser/target/ netty_parser/target/ parser_commons/target/ distribution/target/ broker/moquette.log broker/runner /bundle/target/ /bundle/runner/ /osgi_test/target/ /perf/target/ /mapdb_storage/target/ *~ *.log* .DS_Store .settings/ .project .classpath /*/bin/ *.swp *.class # Mobile Tools for Java (J2ME) .mtj.tmp/ # Package Files # *.war *.ear # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml hs_err_pid* broker/*moquette_store.* embedding_moquette/target/ broker/nb-configuration.xml broker/nbactions-Server.xml maven-metadata.xml /.gradle/ /bin/ broker/config/git.properties distribution/src/main/resources/git.properties license/target server/target broker/h2db broker/media common/target server/target sdk/target moments/target monitor wildfire_jmeter git.properties wildfirechat.license broker/logs ================================================ FILE: .travis.yml ================================================ language: java jdk: - oraclejdk8 before_cache: - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ cache: directories: - $HOME/.gradle/caches/ - $HOME/.gradle/wrapper/ script: - ./gradlew install test ================================================ FILE: LICENSE ================================================ Creative Commons Attribution-NoDerivs 3.0 Unported CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE. License THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. 1. Definitions a. "Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License. b. "Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined above) for the purposes of this License. c. "Distribute" means to make available to the public the original and copies of the Work through sale or other transfer of ownership. d. "Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License. e. "Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast. f. "Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work. g. "You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation. h. "Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images. i. "Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium. 2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws. 3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: a. to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections; and, b. to Distribute and Publicly Perform the Work including as incorporated in Collections. c. For the avoidance of doubt: i. Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; ii. Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and, iii. Voluntary License Schemes. The Licensor waives the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License. The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats, but otherwise you have no rights to make Adaptations. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved. 4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: a. You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(b), as requested. b. If You Distribute, or Publicly Perform the Work or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work. The credit required by this Section 4(b) may be implemented in any reasonable manner; provided, however, that in the case of a Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties. c. Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. 5. Representations, Warranties and Disclaimer UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU. 6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. Termination a. This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. b. Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above. 8. Miscellaneous a. Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License. b. If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. c. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent. d. This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You. e. The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law. Creative Commons Notice Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor. Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of this License. Creative Commons may be contacted at http://creativecommons.org/. ================================================ FILE: LICENSE_996 ================================================ Copyright (c) <2019> Anti 996 License Version 1.0 (Draft) Permission is hereby granted to any individual or legal entity obtaining a copy of this licensed work (including the source code, documentation and/or related items, hereinafter collectively referred to as the "licensed work"), free of charge, to deal with the licensed work for any purpose, including without limitation, the rights to use, reproduce, modify, prepare derivative works of, distribute, publish and sublicense the licensed work, subject to the following conditions: 1. The individual or the legal entity must conspicuously display, without modification, this License and the notice on each redistributed or derivative copy of the Licensed Work. 2. The individual or the legal entity must strictly comply with all applicable laws, regulations, rules and standards of the jurisdiction relating to labor and employment where the individual is physically located or where the individual was born or naturalized; or where the legal entity is registered or is operating (whichever is stricter). In case that the jurisdiction has no such laws, regulations, rules and standards or its laws, regulations, rules and standards are unenforceable, the individual or the legal entity are required to comply with Core International Labor Standards. 3. The individual or the legal entity shall not induce or force its employee(s), whether full-time or part-time, or its independent contractor(s), in any methods, to agree in oral or written form, to directly or indirectly restrict, weaken or relinquish his or her rights or remedies under such laws, regulations, rules and standards relating to labor and employment as mentioned above, no matter whether such written or oral agreement are enforceable under the laws of the said jurisdiction, nor shall such individual or the legal entity limit, in any methods, the rights of its employee(s) or independent contractor(s) from reporting or complaining to the copyright holder or relevant authorities monitoring the compliance of the license about its violation(s) of the said license. THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN ANY WAY CONNECTION WITH THE LICENSED WORK OR THE USE OR OTHER DEALINGS IN THE LICENSED WORK. ================================================ FILE: LICENSE_mqtt-jmeter ================================================ Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "{}" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright {yyyy} {name of copyright owner} Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: README.md ================================================ # 野火IM解决方案 野火IM是专业级的即时通讯和实时音视频整体解决方案,由北京野火无限网络科技有限公司维护和支持。 ## 功能特性 * 极致地硬件利用率,IM服务最低128M内存即可运行,上不封顶。 * 协议先进,采用MQTT+Protobuf组合,流量和性能极致优化。 * 性能强大,专业版IM服务支持百万在线和集群部署,业内顶尖性能水平,详情参考野火性能报告。 * 部署运维简单,依赖服务少,稍加配置一键启动。 * 安全加密。网络连接AES加密。客户端数据库SqlCipher加密。安全无小事。 * 全平台客户端,支持Android、iOS、鸿蒙、Web、小程序、UniApp、Flutter、Windows、Mac OS、Linux等所有常见平台。 * 四端同时在线(移动端,pc端,web端和小程序端),数据和状态多端完美同步。 * 支持国产化。支持国产化操作系统、国产化芯片和国产数据库。支持国密加密。 * 客户端使用微信[mars](https://github.com/tencent/mars)连接库,野火IM可能是最适应中国网络国情的即时通讯服务。 * 支持加速点加速,即可用于全球应用,也可用于政企内外双网复杂的网络环境。 * 支持阅读回执和在线状态功能,适用于办公环境。 * 音视频多种解决方案,丰俭由人,可自由选择。 * 高级音视频功能强大,支持9人以上的群组视频通话,支持1080P视频,支持会议模式,支持百人以上会议,支持服务器端录制。 * 全私有部署,可不依赖任何第三方服务,完全内网部署。 * 功能齐全,涵盖所有常见即时通讯功能。另外具有强大的可扩展能力。代码开源率高,二次开发简单。 * 结构设计合理,客户端分功能库、UI库和应用三层。应用成熟完善,开箱即用,也可把SDK嵌入其它应用。 * 拥有应用开放平台,可以开发和创建自建应用,扩展您的工作台。 * API丰富,方便与其它服务系统的对接。 * 拥有机器人和公众号功能,免费的频道(公众号)管理后台。 * 超级群组功能,可以支持万人大群。 * 支持多个IM服务组网互通,打破孤岛,适用于集团公司下多个分公司互联互通。 * 社区版IM服务和移动端免费商用,可以免费构建出完备的移动互联网应用。 * 收费项目非常便宜,野火独有的试用模式,可以先部署到客户环境试用6个月,试用满意后再购买,避免上当受骗。 * 技术支持专业高效,***核心研发***及时处理issue和工单,能最快解决用户的技术难题。技术支持不收费,让客户顺利使用是我们最大的愿望。 ## 野火开源项目 主要包括以下项目: | [GitHub仓库](https://github.com/wildfirechat) | [码云仓库](https://gitee.com/wfchat) | 说明 |--------------------------------------------------------------------------------|-------------------------------------------------------------------------| -------------------------------------------------------------------------- | [im-server](https://github.com/wildfirechat/im-server) | [im-server](https://gitee.com/wfchat/im-server) | 野火社区版IM服务,野火IM的核心服务,处理所有IM相关业务。 | | [app-server](https://github.com/wildfirechat/app-server) | [app-server](https://gitee.com/wfchat/app-server) | Demo应用服务,模拟客户的应用服登陆处理逻辑及部分二次开发示例。 | | [robot_server](https://github.com/wildfirechat/robot_server) | [robot_server](https://gitee.com/wfchat/robot_server) | 机器人服务,演示野火机器人对接其它系统的方法。 | | [push_server](https://github.com/wildfirechat/push_server) | [push_server](https://gitee.com/wfchat/push_server) | 推送服务器,可以对接所有的系统厂商推送服务或者第三方推送服务。 | | [wf-minio](https://github.com/wildfirechat/WF-minio) | [wf-minio](https://gitee.com/wfchat/WF-minio) | 私有对象存储服务,用来支持野火IM专业版的文件存储。 | | [wf-janus](https://github.com/wildfirechat/wf-janus ) | [wf-janus](https://gitee.com/wfchat/wf-janus ) | 高级音视频媒体服务。 | | [open-platform](https://github.com/wildfirechat/open-platform) | [open-platform](https://gitee.com/wfchat/open-platform) | 野火开放平台服务。 | | [daily-report](https://github.com/wildfirechat/daily-report) | [daily-report](https://github.com/wildfirechat/daily-report) | 野火开放平台日报 demo服务。 | | [channel-platform](https://github.com/wildfirechat/channel-platform) | [channel-platform](https://gitee.com/wfchat/channel-platform) | 野火频道(公众号)平台服务。 | | [organization-platform](https://github.com/wildfirechat/organization-platform) | [organization-platform](https://gitee.com/wfchat/organization-platform) | 野火组织通讯录服务。 | | [archive-server](https://github.com/wildfirechat/archive-server) | [archive-server](https://gitee.com/wfchat/archive-server) | 野火组织通讯录服务。 | | [android-chat](https://github.com/wildfirechat/android-chat) | [android-chat](https://gitee.com/wfchat/android-chat) | 野火IM Android SDK源码和App源码。 | | [ios-chat](https://github.com/wildfirechat/ios-chat) | [ios-chat](https://gitee.com/wfchat/ios-chat) | 野火IM iOS SDK源码和App源码。| | [pc-chat(electron)](https://github.com/wildfirechat/vue-pc-chat) | [pc-chat(electron)](https://gitee.com/wfchat/vue-pc-chat) | 基于[Electron](https://electronjs.org/)开发的PC 端 | | | [pc-chat(Qt)](https://github.com/wildfirechat/qt-pc-chat) | [pc-chat(Qt)](https://gitee.com/wfchat/qt-pc-chat) | 基于Qt开发的PC 端 | | | [web-chat](https://github.com/wildfirechat/vue-chat) | [web-chat](https://gitee.com/wfchat/vue-chat) | 野火IM Web 端, [体验地址](https://web.wildfirechat.cn)。 | | [wx-chat](https://github.com/wildfirechat/wx-chat) | [wx-chat](https://gitee.com/wfchat/wx-chat) | 小程序平台的Demo(支持微信、百度、阿里、字节、QQ 等小程序平台)。 | | [uni-chat](https://github.com/wildfirechat/uni-chat) | [uni-chat](https://gitee.com/wfchat/uni-chat) | UniApp平台移动端应用(使用原生插件)。 | | [uni-wfc-client](https://github.com/wildfirechat/uni-wfc-client) | [uni-wfc-client](https://gitee.com/wfchat/uni-wfc-client) | UniApp平台原生插件。已[商店](https://ext.dcloud.net.cn/plugin?id=7895)上架 | | [flutter-chat](https://github.com/wildfirechat/flutter-chat) | [flutter-chat](https://gitee.com/wfchat/flutter-chat) | Flutter平台原生插件,支持IM和音视频通话。 | | [docs](https://github.com/wildfirechat/docs) | [docs](https://gitee.com/wfchat/docs) | 野火IM相关文档,包含设计、概念、开发、使用说明,[在线查看](https://docs.wildfirechat.cn/)。 | ## 野火开发文档 [在线文档](https://docs.wildfirechat.cn/) ## 野火IM论坛 [野火IM论坛](https://bbs.wildfirechat.cn) ## 野火性能测试报告及测试方法 [Github](https://github.com/wildfirechat/Performance_Test), [码云](https://gitee.com/wfchat/Performance_Test)。 ## 野火Demo 请使用微信扫码下载安装体验野火IM移动客户端 ![野火IM](http://static.wildfirechat.cn/download_qrcode.png) Web客户端点击[这里](https://web.wildfirechat.cn) PC客户端点[这里](https://github.com/wildfirechat/vue-pc-chat/releases)下载安装。 小程序客户端请用微信扫码 ![野火IM](http://static.wildfirechat.net/wx.jpg) ## 快速开始 可以按照[快速开始](https://docs.wildfirechat.cn/quick_start/)来部署应用服务和IM服务,然后打包移动端,就可以完成聊天和通话功能。 之后再部署开放平台服务、频道(公众号)服务、机器人服务、推送服务、Turn服务(音视频服务)来实现完整的应用功能,详情可以详细阅读文档。 ## 联系我们 商务合作请微信联系: * 微信1:wildfirechat * 微信2:wfchat ## 问题交流 1. 如果大家发现bug,请在GitHub或码云提issue;如果有需求也请给我们提issue。 2. 其他问题,请到[野火IM论坛](http://bbs.wildfirechat.cn/)进行交流学习 3. 关注我们的公众号。我们有新版本发布或者有重大更新会通过公众号通知大家,另外我们也会不定期的发布一些关于野火IM的技术介绍。 我们有核心研发工程师轮流值班处理issue和论坛,会及时处理的,疑难Bug的修改和新需求的开发我们也会尽快解决。 ## 编译 ``` mvn clean package ``` 生成的目标文件在```./distribution/target/distribution-xxxx-bundle-tar.tar.gz``` ## 配置 解压```distribution-xxxx-bundle-tar.tar.gz```,修改解压出来的```config```目录下的```wildfirechat.conf```,可以阅读配置文件注释和文档,对其它配置项进行调整。 ## 运行 在解压```distribution-xxxx-bundle-tar.tar.gz```后的目录下运行如下命令: ``` ./bin/wildfirechat.sh ``` ## 验证 1. 在浏览器中输入地址 ```http://${ip}/api/version```可以看到返回一个json文件。 2. 部署[应用服务](https://github.com/wildfirechat/app-server),配置和编译[Android客户端](https://github.com/wildfirechat/android-chat)和[iOS客户端](https://github.com/wildfirechat/ios-chat)进行验证。详情可参考[快速开始](https://docs.wildfirechat.cn/quick_start/)。 ## 打包RPM格式 打包会生成Java包和deb安装包,如果需要rpm安装包,请在```distribution/pom.xml```中取消注释生成rpm包的plugin。另外还需要本地安装有rpm,在linux或者mac系统中很容易安装,在windows系统需要安装cygwin并安装rpm,具体信息请百度查询。 修改之后运行编译命令```mvn clean package```,rpm包生成在```distribution/target```目录下。 ## Epoll 在linux系统中打开Epoll开关可以提高性能,默认软件包内打包的是x86_64的epoll native sdk。如果是arm64的机器,可以把[broker pom](./broker/pom.xml)文件中修改如下: ```xml io.netty netty-transport-native-epoll ${netty.version} linux-aarch_64 ``` 然后重新打包。专业版IM服务软件包中有arm64架构的sdk,可以直接替换。epoll只支持x86_64和arm64两个架构,其他架构不要把epoll开关打开。 ## 升级说明 1. 从0.42 版本增加了群成员数限制,默认为2000。如果您从之前的版本升级到这个版本或以后,需要注意到群成员数的限制。升级之后超出限制的群不受影响,但不能继续加人,如果您想修改默认值,可以在升级版本之后,修改t_setting表,把默认的大小改为您期望的人数。另外修改t_group表,把已经存在的群组max_member_count改成您期望的,然后重启。 2. 0.50版本添加了是否允许客户端发送群操作通知的配置。如果您在客户端自定义群通知,需要在服务器端配置允许,没有使用自定义群操作通知的不受影响。*** 3. 0.46和0.47版本升级到0.48及以后版本时,可能会提示flyway migrate 38错误,请执行 [修复脚本](https://github.com/wildfirechat/server/blob/wildfirechat/flyway_repaire_migrate_38.sql) 进行修复。0.46和0.47版本之外的版本不会出现此问题。 4. 从0.54之前版本升级到0.54及以后版本时,会提示flyway migrate错误。因为0.54版本删除了sql脚本中默认敏感词的内容,flyway checksum失败。请执行```update flyway_schema_history set checksum = 0 where script = 'V17__add_default_sensitive_word.sql';```来修复。 5. 从0.59之前的版本升级到之后的版本执行数据库升级时间比较长,请耐心等待提示运行成功,避免中途中断。 6. 0.62/0.63 版本有严重的问题,请使用0.64及以后版本,或者0.61版。 7. 从0.68 版本起添加了pc在线是否默认手机接收推送的开关,默认为开,与以前版本作用相反,请注意兼容(可以关掉与之前保持一致或者升级客户端) 8. 从0.78 版本起把MySQL数据库中关键字都改为大小写敏感,另外生成id的方法也做了改变,只生成小写的id,避免出现id重复的问题,建议所有客户都升级 9. 从0.79 版本起把log4j升级到log4j2,因为log4j已经不再维护而且还有已知的漏洞,建议所有客户都升级,升级时注意更新log4j2的配置文件 10. 0.97版本更改了启动脚本```wildfirechat.sh```,如果是升级服务,请注意更新启动脚本。 ## 维护说明 野火设计理念当中,IM服务和客户端协议栈构成个管道工具,数据在人和人或者人和服务或者服务和服务之间传递,可以通过Server API和自定义消息来对接和开发业务。业务系统把IM系统当作一个工具来使用,是不需要把任何业务逻辑写在IM服务中的。 如果修改了IM服务可能会引起跟客户端协议栈的不兼容,以后也没有可能从社区版IM服务迁移到专业版IM服务,还有一旦修改就跟我们代码不一样了,如果出了问题我们就无法分析和解决。所以 ***我们强烈不推荐在IM服务修改代码,如果修改过就不再提供任何技术支持和服务了***。除了IM服务以外的所有代码可以任意修改。 现有接口足够对接和二开任何业务了,如果发现无法实现你们的业务需求,可以在[论坛](https://bbs.wildfirechat.cn)来咨询,我们会分析如何实现,如果需要添加新接口,我们会及时免费添加。请切记:***不要修改IM服务的代码!*** ***不要修改IM服务的代码!*** ***不要修改IM服务的代码!*** 详细维护说明请参考 [野火维护说明](https://docs.wildfirechat.cn/base_knowledge/maintain.html)。 ## 服务对象 因为野火的使用范围比较广,难免被一些不法分子利用,国内反诈反赌力度很大,所以国内多地警方都跟我们都有过联系。***为了预防我们的产品被用于非法目的,试用及购买只能支持境内法人单位,不接受个人或者境外团体。如果我们发现产品被用于非法目的,我们会立即停止技术支持服务并且报警和配合警方调查。请用于非法目的用户绕行!*** ## 群的性能问题 群的大小和性能不是线性相关的,而是O(N²)的关系,这是群的特性决定的。所以社区版IM服务很难支持很大的群人数,我们建议最大群不要超过500人,像微信的群大小一样。修改方法是修改数据库中```t_settings```表中的群最大人数。 如果是专业版IM服务,普通群性能会有些加强,但也不会提高太多,所以我们就开发了超级群,可以支持上万群成员。关于超级群,请参考[野火超级群组](https://mp.weixin.qq.com/s/ov5ZiaEIUZuvgFBXOrcjbg)。现有客户有接近10W的群组成员能够流畅稳定地运行。 ## 网络问题 如果是自建机房或者私有网络,可能会有跨运营商瓶颈,详情请参考[《从野火 IM 的网络踩坑经历,聊聊跨运营商访问的那些坑》](https://mp.weixin.qq.com/s/Pa8b93oMk58fjMgwtwmePQ)。 ## 常见问题 请参考文档[常见问题](https://docs.wildfirechat.cn/faq/server.html) ## 应用截图 登录界面 会话列表 好友列表 工作台 发现 我的页面 消息聊天 动态表情 语音消息 位置消息 拍摄图片或者小视频 会话设置 朋友圈 新好友 多人视频通话 会议主页 会议详情 会议界面 PC客户端界面 移动客户端、PC客户端和Web客户端三端同框 小程序客户端 公众号管理后台 开放平台管理后台 IM服务管理后台 > 更多详细信息请下载demo进行体验。 ## 特别感谢 1. [moquette](https://github.com/moquette-io/moquette) 本项目是基于此项目二次开发而来,处理MQTT相关业务。 2. [loServer](https://github.com/looly/loServer) 本项目使用loServer处理HTTP相关业务。 *** 对他们表示诚挚的感谢🙏 *** ## License 1. Under the Creative Commons Attribution-NoDerivs 3.0 Unported license. See the [LICENSE](https://github.com/wildfirechat/server/blob/wildfirechat/LICENSE) file for details. ================================================ FILE: broker/config/hazelcast.xml ================================================ slf4j 604800 LRU 1000000 10 io.moquette.persistence.MessageLoader 0 604800 LRU 1000000 10 io.moquette.persistence.GroupLoader 0 604800 LRU 1000000 10 io.moquette.persistence.UserLoader 0 604800 LRU 1000000 10 io.moquette.persistence.UserStatusLoader 0 86400 LRU 1000000 10 604800 LRU io.moquette.persistence.ChatroomLoader 0 604800 LRU 1000000 10 io.moquette.persistence.RobotLoader 0 604800 LRU 1000000 10 io.moquette.persistence.DeviceLoader 0 604800 LRU 1000000 10 io.moquette.persistence.ChannelLoader 0 ================================================ FILE: broker/config/wildfirechat.conf ================================================ # # # 本配置文件为debug使用,修改这里不会在Release包中生效。Release中包含的配置文件在 ${Porject_Path}/distribution/src/main/resources目录下 # # #********************************************************************* # Server configuration #********************************************************************* #服务器的接入IP。给客户端提供是${server.ip}和${http_port}。 #客户端会从${http_port}端口获取到长链接端口。这个地址一定要改成客户端可以访问到的IP地址 #(如果您部署云服务器上或者具有独立公网出口的服务器上,请改为对应的公网IP;如果您部署在在内网环境下,在内网使用,这个地方改成内网地址) server.ip 192.168.1.81 ##原生客户端长链接端口 port 1883 ##客户端短链接端口,客户端固定使用80端口,不要修改此端口。 http_port 80 #管理端口 http.admin.port 18080 ##节点ID,当集群部署时,一定不能有重复。 node_id 1 ##绑定IP,不要打开,除非有特殊需求才可以打开 #host 0.0.0.0 ##本地绑定端口 local_port 80 ## 是否使用内置DB。0使用mysql;1使用h2db。 ## MySQL需要把事物隔离级别改成"Read committed",使用命令来修改"set global transaction_isolation='read-committed';",其他数据库默认已经是这个级别不用修改 embed.db 1 ## 是否自动清理历史消息记录,当为true时,IM服务会定时扫描t_messages_x和t_user_messages_x表,清除掉3年前的历史消息。 ## 如果不开启自动清理,需要手动清理t_messages_x和t_user_messages_x表内的历史数据,保存数据不能超过3年。 ## 如果需要消息保存更长时间,可以把临近销毁的消息转储到别的数据库,客户端在拉取不到服务器消息时,再去转储的数据库拉取。 ## 使用mongodb时次开关无效(因为mongodb设置了消息过期时间,会自动清理,仅专业版支持mongodb)。 db.auto_clean_history_messages true ## h2db数据库的路径,默认为程序目录下的,可以指定其他目录。如果使用MySQL,可以忽略此配置 h2db.path ./h2db/wfchat ##服务器管理接口密钥。如果修改此端口需要同步修改使用管理API的地方,比如应用服务。 http.admin.secret_key 123456 ##服务器API接口参数是否检查时间。当设置为false时,所有的请求会检查时间的有效性;当设置为true时,可以在http.admin.secret_key保持不变的情况下,使用固定的服务API签名 ##nonce = "76616", timestamp = "1558350862502", sign = "b98f9b0717f59febccf1440067a7f50d9b31bdde" ##这个地方上线前要改为false http.admin.no_check_time true ##用来生产im token的私钥,只在服务器使用,客户端不用。正式使用时为了安全一定要修改这个值,切记切记 token.key testim ##token的过期时间,单位为毫秒,默认为无限期。如果需要设置无限期,客户端上一定需要加上token过期的处理。token过期的处理请参考文档的常见问题 ##token.expire_time 2592000000 ##客户端(目前只有android)的应用签名(一个应用最取第一个签名),如果有多个签名(多个客户端),用英文逗号分开。获取签名方法请参考文档:https://docs.wildfirechat.cn/blogs/签名验证.html #connect.client_signature_list eNkezQ1g9OsnhfLSFUY1vzKDzhs=,xykezQ1g9OsnhfLSFUY1vzKDzhs= ##是否拒绝空签名的android客户端, 默认为true。当有旧的客户端需要兼容时改成false,当所有都是新客户端时,改成true。 #connect.reject_empty_signature true ##是否使用AES256加密。默认客户端和服务器都是AES128加密,如果需要开启AES256,需要客户端和IM服务同时开通。 #encrypt.use_aes256 true ##当创建一个对象时(用户,群组,频道,机器人等),如果没有传入ID,野火会为这个对象生成一个ID。如果id.use_uuid为true,会使用uuid作为对象ID,否则会使用野火短ID,默认为false。 ## 短ID有个很大的风险是容易被人穷举进行攻击。建议用UUID。 id.use_uuid true ##首次登录,是否接收之前的历史消息。 ##0 不接收历史消息,只接收${message.compensate_time_limit}毫秒以内的消息,由于服务器没有保存已经收取记录,所以如果有超过${message.compensate_time_limit}毫秒之前未收取的消息也不会收取下拉; ##1接收,会接收 message.max_queue 配置的条数的历史消息 message.roaming 0 ## 消息补偿时限,当${message.roaming}为0时,会同步时限以内且小于${message.max_queue}的消息,默认时限为5分钟。当${message.roaming}为1时,会接收 message.max_queue 配置的条数的历史消息。 message.compensate_time_limit 300000 ##是否开启拉取远程历史消息。如果为1,客户端在会话内如果本地消息读取完了,可以下拉继续加载在服务器上的该会话的消息;如果为0则不能。 message.remote_history_message 0 ##服务器为每个用户缓存的消息数量。这个值改得太大,拉取消息时间变长,另外会占用大量内存。 message.max_queue 1024 ##是否开启拉取聊天室远程历史消息。如果为1,可以下拉继续加载在服务器上的该聊天室的消息;如果为0则不能。默认为1 message.chatroom_remote_history_message 1 ##是否禁止陌生人聊天 message.disable_stranger_chat false ##当禁止陌生人聊天时,允许聊天的用户id,比如管理员或者文件传输助手等。用户id以英文逗号分割。 message.allow_stranger_chat_list admin,FireRobot,wfc_file_transfer ##当禁止陌生人聊天时,允许聊天的线路。 #message.allow_stranger_line 100,101 ##黑名单策略,0 发送失败,返回被拉黑的错误码;1 发送成功但消息被服务器直接丢弃 message.blacklist.strategy 0 ##拉黑对方后,对方不能发送消息给你。这个开关确定拉黑对方后你还能不能给对方发送消息。 message.blacklist.allow_send_to_black false ##是否禁止服务器端消息搜索,该功能暂未实现。目前的影响是如果打开,则存储消息时不单独保存_searchable_content字段 message.disable_remote_search false ##是否数据库中加密消息内容。注意这个开关在服务运行起来后不能改变了,避免读取数据库时无法恢复历史消息。 ##如果要避免数据库中明文存储消息内容,请打开这个开关和message.disable_remote_search开关 message.encrypt_message_content false ##允许客户端撤回用户自己发送的消息时限,单位是秒。0是不允许撤回;-1是无限制撤回。 ##Server API不受此限制,可以撤回任意时限内的消息 ##群组管理员或群主撤回群成员消息不受此限制,可以撤回任意时限内的消息。但管理员或群主撤回自己的消息还是需要准守此时间限制。 ##修改此参数需要同步修改客户端UI,客户端UI代码有判断撤回是否显示的逻辑。 message.recall_time_limit 120 ##禁止群主/群管理员撤回群内消息,关闭时群主/群管理员可以撤回任意时间段内群内成员的消息。 message.disable_group_manager_recall false ##禁止客户端发送消息类型,消息类型以逗号分开,下面3个值为示例,可以删除。 ##一般用于重要类型消息,比如交易、充值等,禁止客户端发送,仅限于服务器发送,提高安全性。 #message.forbidden_client_send_types 3999,4000,4001 ## 当禁止发送消息时,允许例外发送的消息。这种一般用户需要被动回应的消息。比如群中被禁言的用户,他无法主动发起音视频,但可以接听未被禁言用户的音视频 ## 因为音视频使用了消息作为信令,所以就需要允许发送音视频信令。如果开发了其它场景也需要被动回应消息,可以加在这里。 ## 黑名单时允许发送的消息类型 message.blacklist_exception_types 401,402,403,404,405,407,408,410,411 ## 群禁言或者聊天室或者频道禁言时允许发送的消息类型 message.group_mute_exception_types 401,402,403,404,405,407,408,410,411 ## 用户被全局禁言时允许发送的消息类型 message.global_mute_exception_types 401,402,403,404,405,407,408,410,411 ## 离线用户推送过期天数,0是永不过期,建议配置为7天。 message.push_expired_days 7 ## 当会话静音/全局静音/PC在线静音时,普通消息都不会有推送,如果有某些消息类型需要此时保持推送,可以配置到这里。此配置对消息免打扰时段无效。 ## 此配置只影响远程推送,需要客户端处理客户端在线且在后台收到此消息的处理,需要针对这些消息类型加上本地通知。 ## 强制推送消息的MessagePayload中pushContent和pushData至少要存在一个才可以推送。 ## 消息类型以英文逗号分割。 #message.force_push_types 401,402 ## 群发消息(包括server api群发和全局频道群发)时,目标用户是否来自于t_user表。如果使用野火托管用户信息,请设置为true,否则设置为false。 message.broadcast.target_from_user_table true ## 消息转发功能开启时,开关是否不转发server api接口消息。 ## 当为true时,不转发server api发送的消息;当为false时,转发server api发送的消息。 message.no_forward_admin_message false ## 消息转发功能开启时,转发信息是否带上用户clientId和平台类型。 message.forward_with_client_info false ## 消息转发功能开启时,转发信息是否带上发送者的用户信息 message.forward_with_sender_info false ## 消息转发功能开启时,转发信息是否带上目标的信息,单聊时是对方用户信息,群聊时是群组信息,频道时是频道信息 message.forward_with_target_info false ## 允许发送单聊消息给被封禁用户 message.allow_send_to_forbidden_user false ## 机器人回调信息是否带上用户clientId和平台类型。 robot.callback_with_client_info false ## 机器人回调信息是否带上发送者的用户信息 robot.callback_with_sender_info false ## 机器人回调信息是否带上目标的信息,单聊时是对方用户信息,群聊时是群组信息,频道时是频道信息 robot.callback_with_target_info false ## 是否允许@会话外的机器人。如果为true,单聊或者群聊时,可以@不在会话中的机器人。当机器人收到消息后,可以回复消息。 ## 如果为false,不能@不在会话中的机器人。机器人不在会话中时,也不能回复消息。 robot.mention_external_robot true ## 机器人获取信息允许的字段,可以获取userId/displayName/portrait,其他需要这里配置允许。 ## 第一位(1)是name, 第二位(2)是mobile,第三(4)位是email,第四位(8)是address,第五位(16)是company,第六位(32)是extra, ## 第七位(64)是updateDt,第八位(128)是gender,第九位(256)是social,第十位(512)是type。 ## 比如允许获取name和email就是5(1+4),允许获取name和mobile和company和type就是531(1+2+16+512),允许全部是1023(1+2+...+512) #robot.get_user_info_mask 1023 ## 频道回调信息是否带上用户clientId和平台类型。 channel.callback_with_client_info false ## 频道回调信息是否带上发送者的用户信息。 channel.callback_with_sender_info false ## 频道回调信息是否带上频道信息 channel.callback_with_target_info false ## 频道回调新方式,在新方式下,如果有callback地址就会总是回调客户端发送的消息(包括owner和订阅者)。automatic属性控制订阅者发送的消息是否发给owner, 0发,1不发。 ## 旧的方式是,automatic为0时,订阅者的消息发给owner,不转发消息到callback地址。为1时,把订阅者的消息转发给callback地址,不发给owner。 channel.new_callback_feature true ##禁止搜索用户 friend.disable_search false ##禁止按照昵称搜索用户。 friend.disable_nick_name_search false ##禁止按照用户id搜索用户,默认为false。 friend.disable_user_id_search false ##禁止发送好友邀请,通过server api添加好友不受此限制(force参数需要为true) friend.disable_friend_request false ##好友请求重复发送的间隔,单位是毫秒,默认是7天,0为无限长期限。 friend.repeat_request_duration 604800000 ##好友请求被拒绝后再次发送的间隔,单位是毫秒,默认是30天,0为不限制。不能小于friend.repeat_request_duration。 friend.reject_request_duration 2592000000 ##好友请求过期时间,单位是毫秒,默认是7天,0为无限长期限。 friend.request_expiration_duration 604800000 ##好友请求限制频率,一个用户24小时之内允许请求好友的次数,默认不限频。 friend.request_rate_limit 30 ##如果搜索电话号码,24小时内搜索错误号码几次就不再允许电话号码搜素。防止有人遍历搜索电话号码 friend.search_mobile_empty_rate_limit 5 ##如果搜索用户,24小时内搜索次数。防止有人遍历用户名或者用户ID乱加好友。另外可以禁止ID搜索friend.disable_user_id_search friend.search_rate_limit 100 ##请求添加机器人为好友时,机器人是否自动接受,默认为true friend.robot_auto_accept true ## 聊天室观众空闲退出时间,单位为毫秒,默认为15分钟,0为永远不退出 chatroom.participant_idle_time 900000 ## 用户向聊天室发送消息,自动加入聊天室 chatroom.rejoin_when_active true ## 当一个聊天室不存在时,如果有用户加入就自动创建 chatroom.create_when_not_exist true ## 一个用户同一时刻只能加入一个聊天室。 ## 当一个客户端加入一个聊天室时,如果这个客户端已经加入另外一个聊天室了,会自动退出之前的聊天室。 ## 当一个客户端加入一个聊天室时,如果这个用户的其他端已经加入一个聊天室了,kickoff_other_platform为true时会自动退出之前的聊天室,为false时会返回225的错误码。 ## 当自动退出聊天室时,客户端不会收到任何通知,只是不会再收到消息。 chatroom.kickoff_other_platform true ## 是否允许群主不受限制地撤回自己发送的消息。false可以${message.recall_time_limit}撤回自己的消息;true可以撤回任意时间自己的消息。默认为true。 group.allow_owner_recall_self_msg true ## 是否允许群管理员不受限制地撤回自己发送的消息。false可以${message.recall_time_limit}撤回自己的消息;true可以撤回任意时间自己的消息。默认为false。 group.allow_manager_recall_self_msg false ## 是否允许客户端发送操作群的自定义群通知消息 group.allow_client_custom_operation_notification true ## 是否允许机器人发送操作群的自定义群通知消息 group.allow_robot_custom_operation_notification true ## 当群成员退出或者被移除时,是否同时给管理员和相关人员发送显式通知消息。 ## 0 不发送,1 退群时发送,2 踢人时发送,3 退群和踢人时都发送。 group.visible_quit_or_kickoff_notification 0 ## 禁止客户端群操作。第1位是禁止创建群组,第2位是禁止销毁群组,3位禁止加入群,4位禁止退出群,5位禁止邀请群成员,6位禁止移出群成员,7位禁止转移群,8位禁止设置群管理员,9位禁止白名单处理,10位禁止群禁言,11位禁止修改群组信息,12位禁止群成员禁言。 ## Server API不受此限制。 #group.forbidden_client_operation 0xFFF ## 是否禁止陌生人拉人入群,默认为false group.disable_stranger_invite false ## 创建群组或者加人时。可能会有成员加入失败(黑名单,或者不允许陌生人拉入群)。当出现有成员失败时,如果此开关为关,操作会失败。 ## 如果此开关打开,操作会返回成功,另外在群里发送一条通知消息 XXX 拒绝加入群组。默认为开。 group.add_member_allow_part_success true ## 群组信息是否标记删除 group.enable_mark_deletion true ## 隐藏用户信息属性类型,2是性别,3是电话号码,4是邮箱,5是地址,6是公司信息,7是社交账号,8是Extra信息。当需要隐藏多个时以英文逗号分开; ## 本配置是为了提高安全性,避免把对应信息同步到客户端,这样就能防止程序被破解从而拿到用户关键信息。仅对客户端有效,server api不受影响。 ## 注意,修改本配置不会对已经同步的信息产生影响。 #user.hide_properties 3,4,5 ## 销毁用户时,用户信息会被清空,deleted字段设置为1,这个开关控制是否保留用户昵称,默认为true。 user.keep_display_name_when_destroy true ## 销毁用户时deleted字段设置为1,这个开关控制是否保留其他信息,默认是false。 user.keep_full_info_when_destroy false ## 销毁用户时,如果user.keep_full_info_when_destroy为true,会保留所有信息,这个开关控制是否保留这个用户信息的电话号码,默认为false。 ## 当保留所有信息且保留电话号码时,用户如果再注册会用到原来的UID,能够看到原来用户的消息,需要考虑一下是否让已删除用户再次注册登录看到之前的消息。 user.keep_mobile_when_destroy false ## 销毁用户时是否保留归属于这个用户的所有消息记录,默认为false。 user.keep_messages_when_destroy false # 好友/好友请求/用户设置 这三类数据同步的最大条目数。之前是客户第一次登录时,会把所有的对应数据一次下载到客户端,但如果有特别多的信息,会导致无法同步到客户端, # 因此需要分段多次同步,此开关定义了每次同步的数据的条数。此需要客户端支持,客户端SDK在2021.5.25日后支持此功能。如果确认所有客户端都在这个日志之后才可以打开此设置。 #sync.data_part_size 1000 ## 是否关闭api/version接口。api/version方法可以用来检查IM服务版本,上线确认无问题后,可以关掉这个接口。 #http.close_api_version false #********************************************************************* # 限频配置 #********************************************************************* ##API接口限频设置,时间是10秒内允许的请求次数。 ##管理api频率限制,默认是10秒10000次。 http.admin.rate_limit 10000 ##机器人api频率限制,默认是10秒1000次,按照机器人ID区分。 http.robot.rate_limit 1000 ##频道api频率限制,默认是10秒1000次,按照频道ID区分。 http.channel.rate_limit 1000 ##客户端请求频率限制,默认是5秒100次。通常情况下不要修改这个值。 client.request_rate_limit 100 #********************************************************************* # Media server configuration #********************************************************************* ##是否使用七牛云存储。1使用七牛;0使用内存文件服务器。默认的七牛账户信息不可用,请在七牛官网申请账户并配置 ##专业版另外支持阿里云存储和野火私有存储,关于野火私有存储请参考:https://github.com/wildfirechat/WF-minio ##关于对象存储的详细信息请参考:https://docs.wildfirechat.cn/server/oss.html media.server.use_qiniu 0 # qiniu media server configuration qiniu.server_url http://up.qbox.me qiniu.access_key tU3vdBK5BL5j4N7jI5N5uZgq_HQDo170w5C9Amnn qiniu.secret_key YfQIJdgp5YGhwEw14vGpaD2HJZsuJldWtqens7i5 qiniu.bucket_general_name media qiniu.bucket_general_domain http://pghnpyzos.bkt.clouddn.com qiniu.bucket_image_name media qiniu.bucket_image_domain http://pghnpyzos.bkt.clouddn.com qiniu.bucket_voice_name media qiniu.bucket_voice_domain http://pghnpyzos.bkt.clouddn.com qiniu.bucket_video_name media qiniu.bucket_video_domain http://pghnpyzos.bkt.clouddn.com qiniu.bucket_file_name media qiniu.bucket_file_domain http://pghnpyzos.bkt.clouddn.com qiniu.bucket_sticker_name media qiniu.bucket_sticker_domain http://pghnpyzos.bkt.clouddn.com qiniu.bucket_moments_name media qiniu.bucket_moments_domain http://pghnpyzos.bkt.clouddn.com qiniu.bucket_portrait_name storage qiniu.bucket_portrait_domain http://cdn2.wildfirechat.cn qiniu.bucket_favorite_name storage qiniu.bucket_favorite_domain http://cdn2.wildfirechat.cn ## custom的桶是给客户预留的,客户可以上传自己的文件到这3个桶中,野火不会用到这几个桶。如果不需要,可以忽略这几个配置 qiniu.bucket_custom1_name temp1 qiniu.bucket_custom1_domain http://temp1.wildfirechat.cn qiniu.bucket_custom2_name temp2 qiniu.bucket_custom2_domain http://temp2.wildfirechat.cn qiniu.bucket_custom3_name temp3 qiniu.bucket_custom3_domain http://temp3.wildfirechat.cn qiniu.bucket_pan_name pan qiniu.bucket_pan_domain http://pan.wildfirechat.cn ##媒体类型分类 #Media_Type_GENERAL = 0, #Media_Type_IMAGE = 1, #Media_Type_VOICE = 2, #Media_Type_VIDEO = 3, #Media_Type_FILE = 4, #Media_Type_PORTRAIT = 5, #Media_Type_FAVORITE = 6, #Media_Type_STICKER = 7, #Media_Type_MOMENTS = 8 # local media server configuration # 本地媒体服务器配置。 local.media.storage.root media # 如果使用内置文件存储,文件上传后地址默认为 http://server.ip:http_port/fs/5/2021/03/27/08/filename。fs目录下按照类型存放文件,媒体类型见上面注释,比如5就是Media_Type_PORTRAIT,是客户端的头像文件。 # 如果需要使用nginx添加https支持,请打开下面配置,这样客户端得到的文件地址为 https://example.com/media/fs/5/2021/03/27/08/filename。 # 需要nginx把请求从https://example.com/media/fs 转到 http://server.ip:http_port/fs。注意需要带上所有header。 # 尽管内置文件存储可以使用,但是我们还是建议使用专业级别的对象存储服务,社区版可以使用七牛,专业版另外支持阿里云和也是私有对象存储。详情请参考 https://docs.wildfirechat.cn/server/oss.html # local.media.storage.remote_server_url https://example.com/media # 是否支持任意多端登陆,为true时支持任意平台任意多个客户端同时登录;为false时每个平台只支持一个端登录,但不同平台可以同时登录。 # Android/iOS为移动平台,windows/mac/linux为pc平台,web为web平台,小程序为小程序平台。 # 建议使用false server.multi_endpoint false ## 是否支持PC多端登陆,当server.multi_endpoint为true时,此开关无意义,当为false时,可以单独打开PC端多端登录。 server.multi_pc_endpoint false ## 是否支持PAD多端登陆,当server.multi_endpoint为true时,此开关无意义,当为false时,可以单独打开PAD端多端登录。 server.multi_pad_endpoint false ## 是否支持可穿戴设备多端登陆,当server.multi_endpoint为true时,此开关无意义,当为false时,可以单独打开可穿戴设备多端登录。 server.multi_wearable_endpoint false ## 是否支持TV设备多端登陆,当server.multi_endpoint为true时,此开关无意义,当为false时,可以单独打开TV多端登录。 server.multi_tv_endpoint false # 多平台连接状态通知(仅当multi_endpoint为false时有效),true时移动端可以收到pc或pad或web端登录的通知。 server.multi_platform_notification true # 当pc或者web在线时,手机是否默认静音,默认为true。注意仅影响默认值,用户可以手动切换是否静音。 # 如果这里改为false,客户端那边需要同步修改pc在线默认通知状态,方法是client的setDefaultSilentWhenPcOnline函数。 server.mobile_default_silent_when_pc_online true ## 客户端是否支持kickoff事件。当客户端被其他端登录踢出时,如果此开关为false时,客户端协议栈上报secret_mismatch。如果此开关为ture时,客户端协议栈上报kicked_off。 ## 客户端被踢时上报kicked_off是在2021.9.15之后才加上的。如果客户端协议栈全部为此日期之后的版本才可以打开此开关。 server.client_support_kickoff_event true #********************************************************************* # Push server configuration #********************************************************************* ##推送服务项目地址:https://github.com/wildfirechat/push_server。 ##安卓推送服务器地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! push.android.server.address http://localhost:8085/android/push ##苹果推送服务器地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! push.ios.server.address http://localhost:8085/ios/push ##鸿蒙推送服务器地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! push.harmony.server.address http://localhost:8085/harmony/push #********************************************************************* # 监控配置 #********************************************************************* ##异常事件产生回调 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #monitor.exception_event_address http://localhost:8888/im_exception_event/ #********************************************************************* # 各种事件回调 #********************************************************************* ##用户在线状态事件回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #user.online_status_callback http://localhost:8888/im_event/user/online ##用户信息变动事件回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #relation.relation_update_callback http://localhost:8888/im_event/user/relation ##用户信息变动事件回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #user.user_info_update_callback http://localhost:8888/im_event/user/info ##消息转发地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #message.forward.url http://localhost:8888/im_event/message ##需要转发的消息类型,当有多个时以英文逗号分割,可以用-来指定区间,注意区间不能太大,因为要把区间内的所有数字都放入到Set中。如果转发所有消息,请注释掉配置或者设置为空 #message.forward.types 1,2,3,5-10 ##需要转发的消息类型,当有多个时以英文逗号分割,可以用-来指定区间,注意区间不能太大,因为要把区间内的所有数字都放入到Set中。 #message.forward.exclude_types 1,2,3,5-10 ##敏感消息转发地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #message.sensitive.forward.url http://localhost:8888/im_event/message ##提醒消息转发地址,@全体用户和@某个用户消息会回调此地址。 ##此转发不受${message.forward.types}和${message.forward.exclude_types}限制。 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #message.mentionmsg.forward.url http://localhost:8888/im_event/message ##撤回消息转发地址,当用户撤回消息会回调此地址。 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #message.recallmsg.forward.url http://localhost:8888/im_event/recall_message ##设备信息转发地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #things_message.forward.url http://localhost:8888/im_event/things/message ##群组信息变动事件回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #group.group_info_update_callback http://localhost:8888/im_event/group/info ##群组信息变动事件回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #group.group_member_update_callback http://localhost:8888/im_event/group/member ##频道信息变动回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #channel.channel_info_update_callback http://localhost:8888/im_event/channel/info ##聊天室信息变动回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #chatroom.chatroom_info_update_callback http://localhost:8888/im_event/chatroom/info ##聊天室成员变动回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #chatroom.chatroom_member_update_callback http://localhost:8888/im_event/chatroom/member #********************************************************************* # Sensitive configuration #********************************************************************* ## 内置文本敏感词过滤处理方法,当命中敏感词后,消息会被记录到t_sensitive_messages表中,然后根据type类型做不同的处理,处理方式如下: ## 0 发送失败;1 发送成功但消息被服务器直接丢弃;2 命中的敏感词被替换成***然后正常发送;3 正常发送。 ## 如果开启 message.sensitive.forward.url 配置,命中敏感词的消息还会被回调到这个地址 sensitive.filter.type 2 ## 敏感词是否只处理消息。如果为true,只过滤消息;如果为false,会同时过滤用户昵称、群组名和群昵称。 ## 除了消息之外的信息只支持内部敏感词处理,不支持外置审核。 sensitive.only_message false ## 敏感词添加或者删除有2种方式,一种是通过Server API进行,这种方式会立即生效。另外一种方法是修改数据库,直接中数据库的t_sensitive_word表中处理 ## 修改数据库的方法不会立即生效,IM服务会2个小时重新加载一次敏感词。所以如果直接修改敏感词表,需要等2个小时,或者重启才能生效。 ## 如果内置敏感词库无法满足您的需求,可以开发部署独立敏感词审核服务。配置如下地址和消息类型,IM服务会把指定消息类型的消息回调到指定地址,内置的敏感词审核和敏感词转发功能就不再起作用了。 ## 审核服务返回状态码200表示继续发送,如果需要替换内容,返回状态码200并且内容为替换后的内容。返回403表示不允许发送。其它错误继续发送。 ## 独立审核服务地址,IM服务会post SendMessageData。如果需要修改消息内容,返回 MessagePayload。请参考应用服务中 "/message/censor" Mapping. #sensitive.remote_server_url http://192.168.3.202:8888/message/censor ## 需要进行敏感词审核的消息类型,当有多个时以英文逗号分割 #sensitive.remote_sensitive_message_type 1,2,3 ## 如果远程审核服务返回403,返回给发送端发送失败还是成功?实际上这个值影响发送响应是否等待审核结果,当为false时,消息发送给审核服务就立即返回成功给客户端。 ## 当为true时,消息发送给审核服务,等待审核结果,如果结果为继续发送就返回给客户端为成功,结果为禁止发送就返回失败给客户端。 ## 客户端操作的超时一般为10s左右,且考虑到复杂的网络情况,建议处理时间不要超过3s。建议这个值为false。 #sensitive.remote_fail_when_matched false ================================================ FILE: broker/migrate/h2/V10__create_default_admin.sql ================================================ insert into t_user (`_uid`,`_name`,`_display_name`,`_type`,`_dt`) values ('admin','admin','系统管理员',3,1); ================================================ FILE: broker/migrate/h2/V11__alter_device_token.sql ================================================ ALTER TABLE t_user_session MODIFY _token VARCHAR(240) DEFAULT NULL; ================================================ FILE: broker/migrate/h2/V12__add_group_control_columns.sql ================================================ alter table `t_group` add column `_mute` tinyint NOT NULL DEFAULT 0; alter table `t_group` add column `_join_type` tinyint NOT NULL DEFAULT 0; alter table `t_group` add column `_private_chat` tinyint NOT NULL DEFAULT 0; alter table `t_group` add column `_searchable` tinyint NOT NULL DEFAULT 0; ================================================ FILE: broker/migrate/h2/V13__create_settings_table.sql ================================================ DROP TABLE IF EXISTS `t_settings`; CREATE TABLE `t_settings` ( `id` int(11) NOT NULL PRIMARY KEY, `value` varchar(64) NOT NULL, `desc` varchar(128) NOT NULL ); insert into t_settings(`id`, `value`,`desc`) values (1, '3000', '最大群成员数量'); ================================================ FILE: broker/migrate/h2/V14__add_id_for_sensitive_word.sql ================================================ alter table `t_sensitiveword` add column `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT; ================================================ FILE: broker/migrate/h2/V15__alter_voip_token_length.sql ================================================ alter table `t_user_session` modify column `_voip_token` varchar(240) DEFAULT ''; ================================================ FILE: broker/migrate/h2/V16__add_friend_blocked.sql ================================================ alter table t_friend add column `_blacked` tinyint DEFAULT 0; update t_friend set `_blacked` = 1 where `_state` = 2; ================================================ FILE: broker/migrate/h2/V17__add_user_session_token_index.sql ================================================ alter table `t_user_session` ADD INDEX `session_token_index` ( `_token` ); ================================================ FILE: broker/migrate/h2/V18__add_friend_request_index.sql ================================================ alter table t_friend_request add index `friend_request_uid_index` (`_friend_uid`); ================================================ FILE: broker/migrate/h2/V19__add_user_session_uid_index.sql ================================================ alter table `t_user_session` ADD INDEX `session_uid_index` ( `_uid` ); ================================================ FILE: broker/migrate/h2/V1__baseline.sql ================================================ ================================================ FILE: broker/migrate/h2/V20__user_session_add_deleted.sql ================================================ alter table `t_user_session` add column `_deleted` tinyint DEFAULT 0; ================================================ FILE: broker/migrate/h2/V21__user_add_deleted.sql ================================================ alter table `t_user` add column `_deleted` tinyint DEFAULT 0; ================================================ FILE: broker/migrate/h2/V22__refactor_channel_status.sql ================================================ update t_channel set `_status` = 64 where `_status` = 3; ================================================ FILE: broker/migrate/h2/V23__alter_message_add_to_column.sql ================================================ alter table t_messages add column `_to` varchar(64) DEFAULT NULL; ================================================ FILE: broker/migrate/h2/V24__add_friend_extra.sql ================================================ alter table t_friend add column `_extra` TEXT DEFAULT NULL; ================================================ FILE: broker/migrate/h2/V25__create_chatroom_blacklist_manager.sql ================================================ DROP TABLE IF EXISTS `t_chatroom_blacklist`; CREATE TABLE `t_chatroom_blacklist` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_cid` varchar(64) NOT NULL, `_uid` varchar(64) NOT NULL, `_state` tinyint NOT NULL DEFAULT 0, `_expired_time` bigint(20) NOT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `cr_bl_uid_index` (`_cid`,_uid) ); DROP TABLE IF EXISTS `t_chatroom_manager`; CREATE TABLE `t_chatroom_manager` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_cid` varchar(64) NOT NULL, `_uid` varchar(64) NOT NULL, `_state` tinyint NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `cr_man_uid_index` (`_cid`,_uid) ); ================================================ FILE: broker/migrate/h2/V26__add_user_messages_line.sql ================================================ alter table `t_user_messages` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages` ADD INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); ================================================ FILE: broker/migrate/h2/V27__create_device_table.sql ================================================ DROP TABLE IF EXISTS `t_thing`; DROP TABLE IF EXISTS `t_device`; CREATE TABLE `t_device` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_token` varchar(64) DEFAULT '', `_state` tinyint DEFAULT 0, `_extra` TEXT DEFAULT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `device_uid_index` (`_uid` ASC) ); DROP TABLE IF EXISTS `t_user_device`; CREATE TABLE `t_user_device` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_did` varchar(64) DEFAULT '', INDEX `user_device_uid_index` (`_uid` ASC), INDEX `user_device_did_index` (`_did` ASC) ); ================================================ FILE: broker/migrate/h2/V28__add_session_user_type.sql ================================================ alter table t_user_session add column `_user_type` tinyint DEFAULT 0; ================================================ FILE: broker/migrate/h2/V29__create_receipt_table.sql ================================================ DROP TABLE IF EXISTS `t_read_report`; CREATE TABLE `t_read_report` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NULL, `_type` tinyint NULL, `_line` int(11) NULL, `_target` varchar(64) NULL, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `read_report_index` (`_uid`, `_type`, `_line`, `_target`) ); DROP TABLE IF EXISTS `t_user_read_report`; CREATE TABLE `t_user_read_report` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_rid` int(11) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `user_read_report_index` (`_uid` DESC, `_seq` DESC), UNIQUE INDEX `user_read_report_index2` (`_uid` DESC, `_rid` DESC) ); DROP TABLE IF EXISTS `t_delivery_report`; CREATE TABLE `t_delivery_report` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `delivery_index` (`_uid`) ); DROP TABLE IF EXISTS `t_user_delivery_report`; CREATE TABLE `t_user_delivery_report` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_rid` varchar(64) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `user_delivery_index` (`_uid` DESC, `_seq` DESC), UNIQUE INDEX `user_delivery_index2` (`_uid` DESC, `_rid` DESC) ); ================================================ FILE: broker/migrate/h2/V2__create_table.sql ================================================ DROP TABLE IF EXISTS `t_group`; CREATE TABLE `t_group` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_gid` varchar(64) NOT NULL, `_name` varchar(64) DEFAULT '', `_portrait` varchar(1024) DEFAULT '', `_owner` varchar(64) DEFAULT '', `_type` tinyint NOT NULL DEFAULT 0, `_extra` TEXT DEFAULT NULL, `_dt` bigint(20) NOT NULL, `_member_count` int(11) DEFAULT 0, `_member_dt` bigint(20) NOT NULL, UNIQUE INDEX `group_gid_index` (`_gid` ASC), INDEX `group_name_index` (`_name` ASC) ); DROP TABLE IF EXISTS `t_group_member`; CREATE TABLE `t_group_member` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_gid` varchar(64) NOT NULL, `_mid` varchar(64) DEFAULT '', `_alias` varchar(64) DEFAULT '', `_type` tinyint DEFAULT 0, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `user_gid_mid_index` (`_gid`, `_mid`) ); DROP TABLE IF EXISTS `t_user`; CREATE TABLE `t_user` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_name` varchar(64) DEFAULT '', `_display_name` varchar(64) DEFAULT '', `_gender` int(11) NOT NULL DEFAULT 0, `_portrait` varchar(1024) DEFAULT '', `_mobile` varchar(64) DEFAULT '', `_email` varchar(64) DEFAULT '', `_address` varchar(64) DEFAULT '', `_company` varchar(64) DEFAULT '', `_social` varchar(64) DEFAULT '', `_passwd_md5` varchar(64) DEFAULT '', `_salt` varchar(64) DEFAULT '', `_extra` TEXT DEFAULT NULL, `_type` tinyint DEFAULT 0, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `user_uid_index` (`_uid` ASC), UNIQUE INDEX `user_name_index` (`_name` ASC), INDEX `user_display_name_index` (`_display_name` ASC), INDEX `user_mobile_index` (`_mobile` ASC), INDEX `user_email_index` (`_email` ASC) ); DROP TABLE IF EXISTS `t_user_status`; CREATE TABLE `t_user_status` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_status` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `user_status_uid_index` (`_uid` ASC), ); DROP TABLE IF EXISTS `t_friend_request`; CREATE TABLE `t_friend_request` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_friend_uid` varchar(64) NOT NULL, `_reason` TEXT DEFAULT NULL, `_status` tinyint NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL, `_from_read_status` tinyint DEFAULT 0, `_to_read_status` tinyint DEFAULT 0, UNIQUE INDEX `fr_user_target_index` (`_uid` ASC, `_friend_uid` ASC) ); DROP TABLE IF EXISTS `t_friend`; CREATE TABLE `t_friend` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_friend_uid` varchar(64) NOT NULL, `_state` tinyint DEFAULT 0, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `f_user_target_index` (`_uid` ASC, `_friend_uid` ASC) ); DROP TABLE IF EXISTS `t_user_setting`; CREATE TABLE `t_user_setting` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_scope` int NOT NULL, `_key` varchar(64) NOT NULL, `_value` varchar(4096) NOT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `user_setting_index` (`_uid` ASC, `_scope` ASC, `_key` ASC) ); DROP TABLE IF EXISTS `t_id_generator`; CREATE TABLE `t_id_generator` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT ) AUTO_INCREMENT = 3; DROP TABLE IF EXISTS `t_channel`; CREATE TABLE `t_channel` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_cid` varchar(64) NOT NULL, `_name` varchar(64) DEFAULT '', `_portrait` varchar(1024) DEFAULT '', `_owner` varchar(64) DEFAULT '', `_status` tinyint NOT NULL DEFAULT 0, `_desc` TEXT DEFAULT NULL, `_secret` varchar(64) DEFAULT '', `_callback` varchar(1024) DEFAULT '', `_automatic` tinyint NOT NULL DEFAULT 0, `_extra` TEXT DEFAULT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `channel_cid_index` (`_cid` DESC), INDEX `channel_name_index` (`_name` DESC) ); DROP TABLE IF EXISTS `t_channel_listener`; CREATE TABLE `t_channel_listener` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_cid` varchar(64) NOT NULL, `_mid` varchar(64) DEFAULT '', `_dt` bigint(20) NOT NULL, UNIQUE INDEX `channel_cid_mid_index` (`_cid`, `_mid`) ); DROP TABLE IF EXISTS `t_user_session`; CREATE TABLE `t_user_session` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_cid` varchar(64) NOT NULL, `_token` varchar(64) DEFAULT '', `_voip_token` varchar(64) DEFAULT '', `_secret` varchar(64) NOT NULL, `_db_secret` varchar(64) NOT NULL, `_platform` tinyint DEFAULT 0, `_push_type` tinyint DEFAULT 0, `_package_name` varchar(64) DEFAULT '', `_device_name` varchar(64) DEFAULT '', `_device_version` varchar(64) DEFAULT '', `_phone_name` varchar(64) DEFAULT '', `_language` varchar(64) DEFAULT '', `_carrier_name` varchar(64) DEFAULT '', `_dt` bigint(20) NOT NULL, UNIQUE INDEX `session_uid_cid_index` (`_cid`, `_uid`) ); DROP TABLE IF EXISTS `t_robot`; CREATE TABLE `t_robot` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_owner` varchar(64) DEFAULT '', `_secret` varchar(64) DEFAULT '', `_callback` varchar(1024) DEFAULT '', `_state` tinyint DEFAULT 0, `_extra` TEXT DEFAULT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `robot_uid_index` (`_uid` ASC), INDEX `robot_owner_index` (`_owner` ASC) ); DROP TABLE IF EXISTS `t_thing`; CREATE TABLE `t_thing` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_owner` varchar(64) DEFAULT '', `_token` varchar(64) DEFAULT '', `_extra` TEXT DEFAULT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `thing_uid_index` (`_uid` ASC), INDEX `thing_owner_index` (`_owner` ASC) ); DROP TABLE IF EXISTS `t_chatroom`; CREATE TABLE `t_chatroom` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_cid` varchar(64) NOT NULL, `_title` varchar(64) DEFAULT '', `_portrait` varchar(1024) DEFAULT '', `_state` tinyint NOT NULL DEFAULT 0, `_desc` TEXT DEFAULT NULL, `_extra` TEXT DEFAULT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `chatroom_cid_index` (`_cid` DESC) ); DROP TABLE IF EXISTS `t_sensitiveword`; CREATE TABLE `t_sensitiveword` ( `_word` TEXT DEFAULT NULL ); ================================================ FILE: broker/migrate/h2/V30__add_group_member_create_dt.sql ================================================ alter table t_group_member add column `_create_dt` bigint(20) DEFAULT 0; ================================================ FILE: broker/migrate/h2/V31__add_group_member_count_history_message.sql ================================================ alter table `t_group` add column `_history_message` tinyint NOT NULL DEFAULT 0; alter table `t_group` add column `_max_member_count` int(11) NOT NULL DEFAULT 2000; ================================================ FILE: broker/migrate/h2/V32__alter_setting_column_name.sql ================================================ alter table `t_settings` change column `value` `_value` varchar(64) NOT NULL; alter table `t_settings` change column `desc` `_desc` varchar(64) NOT NULL; ================================================ FILE: broker/migrate/h2/V33__alter_group_searchable_column.sql ================================================ alter table `t_group` modify column `_searchable` int(11) NOT NULL DEFAULT 0; ================================================ FILE: broker/migrate/h2/V34__create_files_table.sql ================================================ DROP TABLE IF EXISTS `t_file`; CREATE TABLE `t_file` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_name` varchar(128) DEFAULT '', `_url` varchar(1024) NOT NULL DEFAULT '', `_size` int(11) NOT NULL DEFAULT 0, `_download_count` int(11) DEFAULT 0, `_dt` bigint(20) NOT NULL, INDEX `file_conv_index` (`_type`, `_line`, `_target`, `_mid`), INDEX `file_user_index` (`_from`, `_mid`) ); ================================================ FILE: broker/migrate/h2/V35__create_file_transfer_user.sql ================================================ insert into t_user (`_uid`,`_name`,`_display_name`,`_portrait`,`_type`,`_dt`) values ('wfc_file_transfer','wfc_file_transfer','文件传输助手','https://static.wildfirechat.cn/wfc_file_transfer.png',1,1); insert into t_robot (`_uid`,`_owner`,`_secret`,`_callback`,`_state`,`_dt`) values ('wfc_file_transfer', 'wfc_file_transfer', '', '', 0, 1); ================================================ FILE: broker/migrate/h2/V36__alter_channel_status_column.sql ================================================ alter table `t_channel` modify column `_status` int(11) NOT NULL DEFAULT 0; ================================================ FILE: broker/migrate/h2/V37__add_user_messages_mid_index.sql ================================================ alter table `t_user_messages` ADD INDEX `user_messages_mid_index` ( `_mid`); ================================================ FILE: broker/migrate/h2/V38__add_user_messages_conv_info.sql ================================================ alter table `t_user_messages` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages` add column `_target` varchar(129) NOT NULL DEFAULT ''; alter table `t_user_messages` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); ================================================ FILE: broker/migrate/h2/V39__add_group_member_friend_request_extra.sql ================================================ alter table `t_group_member` add column `_extra` TEXT DEFAULT NULL; alter table `t_friend_request` add column `_extra` TEXT DEFAULT NULL; ================================================ FILE: broker/migrate/h2/V3__create_sharding_table.sql ================================================ DROP TABLE IF EXISTS `t_messages`; CREATE TABLE `t_messages` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), UNIQUE INDEX `message_uid_index` (`_mid` ASC) ); DROP TABLE IF EXISTS `t_user_messages`; CREATE TABLE `t_user_messages` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), UNIQUE INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ); ================================================ FILE: broker/migrate/h2/V40__add_user_messages_cont_type.sql ================================================ alter table `t_user_messages` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; ================================================ FILE: broker/migrate/h2/V41__alter_user_setting_key_column.sql ================================================ alter table `t_user_setting` modify column `_key` varchar(128) NOT NULL; ================================================ FILE: broker/migrate/h2/V42__create_secret_chat_table.sql ================================================ DROP TABLE IF EXISTS `t_secret_chat`; CREATE TABLE `t_secret_chat` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_from` varchar(64) DEFAULT '', `_from_cid` varchar(64) DEFAULT '', `_to` varchar(64) DEFAULT '', `_to_cid` varchar(64) DEFAULT '', `_state` tinyint NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `secret_chat_uid_index` (`_uid` DESC) ); ================================================ FILE: broker/migrate/h2/V43__add_message_table_conversation_index.sql ================================================ alter table `t_messages` add INDEX `messages_conv_index` ( `_type`, `_target`, `_line`); ================================================ FILE: broker/migrate/h2/V44__add_channel_listener_table_member_index.sql ================================================ alter table `t_channel_listener` add INDEX `channel_mid_index` ( `_mid`); ================================================ FILE: broker/migrate/h2/V45__add_channel_menu_column.sql ================================================ alter table `t_channel` add column `_menu` BLOB DEFAULT NULL; ================================================ FILE: broker/migrate/h2/V46__add_group_member_mid_index.sql ================================================ alter table `t_group_member` add INDEX `group_member_mid_index` (`_mid`); ================================================ FILE: broker/migrate/h2/V47__create_super_group.sql ================================================ alter table `t_group` add column `_super_group` tinyint NOT NULL DEFAULT 0; DROP TABLE IF EXISTS `t_group_messages`; CREATE TABLE `t_group_messages` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ); ================================================ FILE: broker/migrate/h2/V48__group_add_deleted_column.sql ================================================ alter table `t_group` add column `_deleted` tinyint NOT NULL DEFAULT 0; ================================================ FILE: broker/migrate/h2/V49__add_domain_table.sql ================================================ DROP TABLE IF EXISTS `t_domain`; CREATE TABLE `t_domain` ( `_domain_id` varchar(64) NOT NULL PRIMARY KEY, `_name` varchar(64) NOT NULL, `_desc` varchar(256) DEFAULT '', `_email` varchar(64) DEFAULT '', `_tel` varchar(64) DEFAULT '', `_address` varchar(64) DEFAULT '', `_extra` varchar(1024) DEFAULT '', `_dt` bigint(20) NOT NULL ); alter table `t_user` add column `_external` tinyint DEFAULT 0; ================================================ FILE: broker/migrate/h2/V4__create_default_chatroom.sql ================================================ insert into t_chatroom (`_cid`, `_title`, `_desc`,`_dt`) values ('chatroom1','火信聊天室1','火信测试聊天室1,用来演示聊天室功能', 1); insert into t_chatroom (`_cid`, `_title`, `_desc`,`_dt`) values ('chatroom2','火信聊天室2','火信测试聊天室2,用来演示聊天室功能', 1); insert into t_chatroom (`_cid`, `_title`, `_desc`,`_dt`) values ('chatroom3','火信聊天室3','火信测试聊天室3,用来演示聊天室功能', 1); ================================================ FILE: broker/migrate/h2/V50__update_group_member_index.sql ================================================ CREATE INDEX `user_gid_dt_index` ON `t_group_member` (`_gid`, `_dt`); ================================================ FILE: broker/migrate/h2/V51__add_not_allow_name_setting.sql ================================================ insert into t_settings(`id`, `_value`,`_desc`) values (2, '文件传输助手,客服,官方', '禁止使用名称,如果有多个,以英文逗号隔开。直接修改数据库,不用重启IM服务'); ================================================ FILE: broker/migrate/h2/V52__modify_message_target.sql ================================================ alter table `t_messages` modify column `_target` varchar(129) NOT NULL; ================================================ FILE: broker/migrate/h2/V53__session_add_ip_column.sql ================================================ ALTER TABLE `t_user_session` ADD COLUMN `_ip` varchar(40) DEFAULT ''; ================================================ FILE: broker/migrate/h2/V54__add_group_member_index.sql ================================================ CREATE INDEX `user_gid_type_index` ON `t_group_member` (`_gid`, `_type`); ================================================ FILE: broker/migrate/h2/V55__create_conference_table.sql ================================================ DROP TABLE IF EXISTS `t_conference`; CREATE TABLE `t_conference` ( `_id` varchar(64) NOT NULL PRIMARY KEY, `_des` varchar(64) NOT NULL, `_pin` varchar(16) NOT NULL, `_max_publishers` int(11) NOT NULL DEFAULT 0, `_bitrate` int(11) NOT NULL DEFAULT 0, `_advance` tinyint NOT NULL DEFAULT 0, `_recording` tinyint NOT NULL DEFAULT 0, `_create_dt` bigint(20) NOT NULL ); ================================================ FILE: broker/migrate/h2/V56__create_join_group_request_table.sql ================================================ DROP TABLE IF EXISTS `t_join_group_request`; CREATE TABLE `t_join_group_request` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_mid` varchar(64) NOT NULL, `_request_uid` varchar(64) NOT NULL, `_accept_uid` varchar(64) DEFAULT NULL, `_reason` TEXT DEFAULT NULL, `_extra` TEXT DEFAULT NULL, `_status` tinyint NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL, `_read_status` tinyint DEFAULT 0, UNIQUE INDEX `join_group_request_key_index` (`_uid` DESC, `_gid` DESC, `_mid` DESC, `_request_uid` DESC), INDEX `join_group_request_gm_index` (`_gid` DESC, `_mid` DESC), INDEX `join_group_request_sync_index` (`_uid` DESC, `_dt` DESC) ); ================================================ FILE: broker/migrate/h2/V57__create_friend_index.sql ================================================ alter table t_friend add index `friend_uid_index` (`_friend_uid`); ================================================ FILE: broker/migrate/h2/V5__create_default_robot.sql ================================================ insert into t_user (`_uid`,`_name`,`_display_name`,`_portrait`,`_type`,`_dt`) values ('FireRobot','FireRobot','小火','http://cdn2.wildfirechat.cn/robot.png',1,1); insert into t_robot (`_uid`,`_owner`,`_secret`,`_callback`,`_state`,`_dt`) values ('FireRobot', 'FireRobot', '123456', 'http://127.0.0.1:8883/robot/recvmsg', 0, 1); ================================================ FILE: broker/migrate/h2/V6__add_friend_alias.sql ================================================ alter table t_friend add column `_alias` varchar(64) DEFAULT NULL; ================================================ FILE: broker/migrate/h2/V7__add_createtime_user_group_table.sql ================================================ alter table t_user add column `_createTime` TIMESTAMP default CURRENT_TIMESTAMP; alter table t_group add column `_createTime` TIMESTAMP default CURRENT_TIMESTAMP; ================================================ FILE: broker/migrate/h2/V8__add_content_type_in_messages.sql ================================================ alter table `t_messages` add column `_content_type` int(11) NOT NULL DEFAULT '0'; ================================================ FILE: broker/migrate/h2/V9__add_sensitive_messages.sql ================================================ DROP TABLE IF EXISTS `t_sensitive_messages`; CREATE TABLE `t_sensitive_messages` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), `_content_type` int(11) NOT NULL DEFAULT 0, UNIQUE INDEX `sensitive_message_uid_index` (`_mid` ASC) ); ================================================ FILE: broker/migrate/mysql/V10__create_default_admin.sql ================================================ insert into t_user (`_uid`,`_name`,`_display_name`,`_type`,`_dt`) values ('admin','admin','系统管理员',3,1); ================================================ FILE: broker/migrate/mysql/V11__alter_device_token.sql ================================================ ALTER TABLE t_user_session MODIFY _token VARCHAR(240) DEFAULT NULL; ================================================ FILE: broker/migrate/mysql/V12__add_group_control_columns.sql ================================================ alter table `t_group` add column `_mute` tinyint NOT NULL DEFAULT 0; alter table `t_group` add column `_join_type` tinyint NOT NULL DEFAULT 0; alter table `t_group` add column `_private_chat` tinyint NOT NULL DEFAULT 0; alter table `t_group` add column `_searchable` tinyint NOT NULL DEFAULT 0; ================================================ FILE: broker/migrate/mysql/V13__create_session_table.sql ================================================ DROP TABLE IF EXISTS `t_session`; CREATE TABLE `t_session` ( `row_id` varchar(50) not null primary key, `del_flag` tinyint(1) default 0 null, `create_time` timestamp null, `update_time` timestamp null, `expire_time` timestamp null, `user_id` int null, constraint `t_session_pk_2` unique (`user_id`, `expire_time`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; ================================================ FILE: broker/migrate/mysql/V14__alter_createtime_user_group_table.sql ================================================ alter table t_user MODIFY column `_createTime` DATETIME NOT NULL DEFAULT NOW(); alter table t_group MODIFY column `_createTime` DATETIME NOT NULL DEFAULT NOW(); ================================================ FILE: broker/migrate/mysql/V15__alter_session_table_time.sql ================================================ alter table t_session MODIFY column `create_time` DATETIME NOT NULL DEFAULT NOW(); alter table t_session MODIFY column `update_time` DATETIME NOT NULL DEFAULT NOW(); alter table t_session MODIFY column `expire_time` DATETIME NOT NULL DEFAULT NOW(); ================================================ FILE: broker/migrate/mysql/V16__update_message_dt_gmt8.sql ================================================ update t_messages_0 set _dt = date_add(_dt, interval 8 hour); update t_messages_1 set _dt = date_add(_dt, interval 8 hour); update t_messages_2 set _dt = date_add(_dt, interval 8 hour); update t_messages_3 set _dt = date_add(_dt, interval 8 hour); update t_messages_4 set _dt = date_add(_dt, interval 8 hour); update t_messages_5 set _dt = date_add(_dt, interval 8 hour); update t_messages_6 set _dt = date_add(_dt, interval 8 hour); update t_messages_7 set _dt = date_add(_dt, interval 8 hour); update t_messages_8 set _dt = date_add(_dt, interval 8 hour); update t_messages_9 set _dt = date_add(_dt, interval 8 hour); update t_messages_10 set _dt = date_add(_dt, interval 8 hour); update t_messages_11 set _dt = date_add(_dt, interval 8 hour); update t_messages_12 set _dt = date_add(_dt, interval 8 hour); update t_messages_13 set _dt = date_add(_dt, interval 8 hour); update t_messages_14 set _dt = date_add(_dt, interval 8 hour); update t_messages_15 set _dt = date_add(_dt, interval 8 hour); update t_messages_16 set _dt = date_add(_dt, interval 8 hour); update t_messages_17 set _dt = date_add(_dt, interval 8 hour); update t_messages_18 set _dt = date_add(_dt, interval 8 hour); update t_messages_19 set _dt = date_add(_dt, interval 8 hour); update t_messages_20 set _dt = date_add(_dt, interval 8 hour); update t_messages_21 set _dt = date_add(_dt, interval 8 hour); update t_messages_22 set _dt = date_add(_dt, interval 8 hour); update t_messages_23 set _dt = date_add(_dt, interval 8 hour); update t_messages_24 set _dt = date_add(_dt, interval 8 hour); update t_messages_25 set _dt = date_add(_dt, interval 8 hour); update t_messages_26 set _dt = date_add(_dt, interval 8 hour); update t_messages_27 set _dt = date_add(_dt, interval 8 hour); update t_messages_28 set _dt = date_add(_dt, interval 8 hour); update t_messages_29 set _dt = date_add(_dt, interval 8 hour); update t_messages_30 set _dt = date_add(_dt, interval 8 hour); update t_messages_31 set _dt = date_add(_dt, interval 8 hour); update t_messages_32 set _dt = date_add(_dt, interval 8 hour); update t_messages_33 set _dt = date_add(_dt, interval 8 hour); update t_messages_34 set _dt = date_add(_dt, interval 8 hour); update t_messages_35 set _dt = date_add(_dt, interval 8 hour); ================================================ FILE: broker/migrate/mysql/V17__add_default_sensitive_word.sql ================================================ ================================================ FILE: broker/migrate/mysql/V18__create_settings_table.sql ================================================ DROP TABLE IF EXISTS `t_settings`; CREATE TABLE `t_settings` ( `id` int(11) NOT NULL PRIMARY KEY, `value` varchar(64) NOT NULL, `desc` varchar(128) NOT NULL default "" ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; insert into t_settings(`id`, `value`,`desc`) values (1, "3000", "最大群成员数量"); ================================================ FILE: broker/migrate/mysql/V19__add_id_for_sensitive_word.sql ================================================ alter table `t_sensitiveword` add column `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT; ================================================ FILE: broker/migrate/mysql/V1__baseline.sql ================================================ ================================================ FILE: broker/migrate/mysql/V20__alter_voip_token_length.sql ================================================ alter table `t_user_session` modify column `_voip_token` varchar(240) DEFAULT ''; ================================================ FILE: broker/migrate/mysql/V21__add_friend_blocked.sql ================================================ alter table t_friend add column `_blacked` tinyint DEFAULT 0 COMMENT "0, normal; 1, blacked"; update t_friend set `_blacked` = 1 where `_state` = 2; ================================================ FILE: broker/migrate/mysql/V22__add_user_session_token_index.sql ================================================ alter table `t_user_session` ADD INDEX `session_token_index` ( `_token` ); ================================================ FILE: broker/migrate/mysql/V23__add_friend_request_index.sql ================================================ alter table t_friend_request add index `friend_request_uid_index` (`_friend_uid`); ================================================ FILE: broker/migrate/mysql/V24__add_user_session_uid_index.sql ================================================ alter table `t_user_session` ADD INDEX `session_uid_index` ( `_uid` ); ================================================ FILE: broker/migrate/mysql/V25__user_session_add_deleted.sql ================================================ alter table `t_user_session` add column `_deleted` tinyint DEFAULT 0; ================================================ FILE: broker/migrate/mysql/V26__user_add_deleted.sql ================================================ alter table `t_user` add column `_deleted` tinyint DEFAULT 0; ================================================ FILE: broker/migrate/mysql/V27__refactor_channel_status.sql ================================================ update t_channel set `_status` = 64 where `_status` = 3; ================================================ FILE: broker/migrate/mysql/V28__alter_message_add_to_column.sql ================================================ alter table t_messages add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_0 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_1 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_2 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_3 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_4 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_5 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_6 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_7 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_8 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_9 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_10 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_11 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_12 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_13 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_14 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_15 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_16 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_17 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_18 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_19 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_20 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_21 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_22 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_23 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_24 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_25 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_26 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_27 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_28 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_29 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_30 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_31 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_32 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_33 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_34 add column `_to` varchar(64) DEFAULT NULL; alter table t_messages_35 add column `_to` varchar(64) DEFAULT NULL; ================================================ FILE: broker/migrate/mysql/V29__add_friend_extra.sql ================================================ alter table t_friend add column `_extra` TEXT DEFAULT NULL; ================================================ FILE: broker/migrate/mysql/V2__create_table.sql ================================================ DROP TABLE IF EXISTS `t_messages`; CREATE TABLE `t_messages` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages`; CREATE TABLE `t_user_messages` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_group`; CREATE TABLE `t_group` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_gid` varchar(64) NOT NULL, `_name` varchar(64) DEFAULT '', `_portrait` varchar(1024) DEFAULT '', `_owner` varchar(64) DEFAULT '', `_type` tinyint NOT NULL DEFAULT 0, `_extra` TEXT DEFAULT NULL, `_dt` bigint(20) NOT NULL, `_member_count` int(11) DEFAULT 0, `_member_dt` bigint(20) NOT NULL, UNIQUE INDEX `group_gid_index` (`_gid` DESC), INDEX `group_name_index` (`_name` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_group_member`; CREATE TABLE `t_group_member` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_gid` varchar(64) NOT NULL, `_mid` varchar(64) DEFAULT '', `_alias` varchar(64) DEFAULT '', `_type` tinyint DEFAULT 0 COMMENT "0普通成员;1,管理员;2,群主,与Owner相同", `_dt` bigint(20) NOT NULL, UNIQUE INDEX `user_gid_mid_index` (`_gid`, `_mid`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user`; CREATE TABLE `t_user` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_name` varchar(64) DEFAULT '', `_display_name` varchar(64) DEFAULT '', `_gender` int(11) NOT NULL DEFAULT 0, `_portrait` varchar(1024) DEFAULT '', `_mobile` varchar(64) DEFAULT '', `_email` varchar(64) DEFAULT '', `_address` varchar(64) DEFAULT '', `_company` varchar(64) DEFAULT '', `_social` varchar(64) DEFAULT '', `_passwd_md5` varchar(64) DEFAULT '', `_salt` varchar(64) DEFAULT '', `_extra` TEXT DEFAULT NULL, `_type` tinyint DEFAULT 0, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `user_uid_index` (`_uid` ASC), UNIQUE INDEX `user_name_index` (`_name` ASC), INDEX `user_display_name_index` (`_display_name` ASC), INDEX `user_mobile_index` (`_mobile` ASC), INDEX `user_email_index` (`_email` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_status`; CREATE TABLE `t_user_status` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_status` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `user_status_uid_index` (`_uid` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_friend_request`; CREATE TABLE `t_friend_request` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_friend_uid` varchar(64) NOT NULL, `_reason` TEXT DEFAULT NULL, `_status` tinyint NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL, `_from_read_status` tinyint DEFAULT 0, `_to_read_status` tinyint DEFAULT 0, UNIQUE INDEX `fr_user_target_index` (`_uid` ASC, `_friend_uid` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_friend`; CREATE TABLE `t_friend` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_friend_uid` varchar(64) NOT NULL, `_state` tinyint DEFAULT 0 COMMENT "0, normal; 1, deleted; 2, blacked", `_dt` bigint(20) NOT NULL, UNIQUE INDEX `f_user_target_index` (`_uid` ASC, `_friend_uid` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_setting`; CREATE TABLE `t_user_setting` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_scope` int NOT NULL, `_key` varchar(64) NOT NULL, `_value` varchar(4096) NOT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `user_setting_index` (`_uid` ASC, `_scope` ASC, `_key` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_id_generator`; CREATE TABLE `t_id_generator` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci AUTO_INCREMENT = 3; DROP TABLE IF EXISTS `t_channel`; CREATE TABLE `t_channel` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_cid` varchar(64) NOT NULL, `_name` varchar(64) DEFAULT '', `_portrait` varchar(1024) DEFAULT '', `_owner` varchar(64) DEFAULT '', `_status` tinyint NOT NULL DEFAULT 0, `_desc` TEXT DEFAULT NULL, `_secret` varchar(64) DEFAULT '', `_callback` varchar(1024) DEFAULT '', `_extra` TEXT DEFAULT NULL, `_automatic` tinyint NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `channel_cid_index` (`_cid` DESC), INDEX `channel_name_index` (`_name` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_channel_listener`; CREATE TABLE `t_channel_listener` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_cid` varchar(64) NOT NULL, `_mid` varchar(64) DEFAULT '', `_dt` bigint(20) NOT NULL, UNIQUE INDEX `channel_cid_mid_index` (`_cid`, `_mid`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_session`; CREATE TABLE `t_user_session` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_cid` varchar(64) NOT NULL, `_token` varchar(64) DEFAULT '', `_voip_token` varchar(64) DEFAULT '', `_secret` varchar(64) NOT NULL, `_db_secret` varchar(64) NOT NULL, `_platform` tinyint DEFAULT 0, `_push_type` tinyint DEFAULT 0, `_package_name` varchar(64) DEFAULT '', `_device_name` varchar(64) DEFAULT '', `_device_version` varchar(64) DEFAULT '', `_phone_name` varchar(64) DEFAULT '', `_language` varchar(64) DEFAULT '', `_carrier_name` varchar(64) DEFAULT '', `_dt` bigint(20) NOT NULL, UNIQUE INDEX `session_uid_cid_index` (`_cid`, `_uid`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_robot`; CREATE TABLE `t_robot` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_owner` varchar(64) DEFAULT '', `_secret` varchar(64) DEFAULT '', `_callback` varchar(1024) DEFAULT '', `_state` tinyint DEFAULT 0, `_extra` TEXT DEFAULT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `robot_uid_index` (`_uid` ASC), INDEX `robot_owner_index` (`_owner` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_thing`; CREATE TABLE `t_thing` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_owner` varchar(64) DEFAULT '', `_token` varchar(64) DEFAULT '', `_state` tinyint DEFAULT 0, `_extra` TEXT DEFAULT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `thing_uid_index` (`_uid` ASC), INDEX `thing_owner_index` (`_owner` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_chatroom`; CREATE TABLE `t_chatroom` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_cid` varchar(64) NOT NULL, `_title` varchar(64) DEFAULT '', `_portrait` varchar(1024) DEFAULT '', `_state` tinyint NOT NULL DEFAULT 0, `_desc` TEXT DEFAULT NULL, `_extra` TEXT DEFAULT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `chatroom_cid_index` (`_cid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_sensitiveword`; CREATE TABLE `t_sensitiveword` ( `_word` TEXT DEFAULT NULL ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; ================================================ FILE: broker/migrate/mysql/V30__create_chatroom_blacklist_manager.sql ================================================ DROP TABLE IF EXISTS `t_chatroom_blacklist`; CREATE TABLE `t_chatroom_blacklist` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_cid` varchar(64) NOT NULL, `_uid` varchar(64) NOT NULL, `_state` tinyint NOT NULL DEFAULT 0, `_expired_time` bigint(20) NOT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `cr_bl_uid_index` (`_cid`,_uid) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_chatroom_manager`; CREATE TABLE `t_chatroom_manager` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_cid` varchar(64) NOT NULL, `_uid` varchar(64) NOT NULL, `_state` tinyint NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `cr_man_uid_index` (`_cid`,_uid) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; ================================================ FILE: broker/migrate/mysql/V31__add_user_messages_line.sql ================================================ alter table `t_user_messages` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_0` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_1` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_2` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_3` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_4` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_5` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_6` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_7` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_8` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_9` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_10` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_11` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_12` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_13` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_14` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_15` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_16` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_17` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_18` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_19` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_20` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_21` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_22` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_23` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_24` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_25` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_26` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_27` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_28` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_29` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_30` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_31` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_32` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_33` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_34` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_35` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_36` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_37` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_38` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_39` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_40` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_41` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_42` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_43` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_44` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_45` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_46` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_47` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_48` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_49` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_50` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_51` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_52` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_53` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_54` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_55` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_56` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_57` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_58` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_59` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_60` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_61` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_62` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_63` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_64` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_65` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_66` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_67` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_68` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_69` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_70` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_71` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_72` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_73` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_74` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_75` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_76` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_77` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_78` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_79` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_80` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_81` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_82` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_83` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_84` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_85` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_86` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_87` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_88` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_89` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_90` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_91` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_92` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_93` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_94` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_95` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_96` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_97` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_98` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_99` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_100` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_101` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_102` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_103` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_104` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_105` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_106` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_107` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_108` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_109` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_110` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_111` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_112` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_113` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_114` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_115` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_116` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_117` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_118` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_119` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_120` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_121` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_122` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_123` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_124` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_125` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_126` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages_127` add column `_line` int(11) NOT NULL DEFAULT 0; alter table `t_user_messages` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_0` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_1` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_2` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_3` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_4` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_5` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_6` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_7` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_8` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_9` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_10` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_11` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_12` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_13` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_14` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_15` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_16` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_17` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_18` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_19` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_20` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_21` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_22` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_23` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_24` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_25` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_26` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_27` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_28` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_29` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_30` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_31` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_32` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_33` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_34` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_35` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_36` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_37` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_38` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_39` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_40` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_41` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_42` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_43` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_44` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_45` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_46` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_47` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_48` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_49` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_50` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_51` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_52` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_53` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_54` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_55` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_56` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_57` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_58` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_59` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_60` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_61` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_62` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_63` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_64` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_65` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_66` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_67` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_68` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_69` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_70` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_71` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_72` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_73` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_74` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_75` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_76` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_77` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_78` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_79` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_80` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_81` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_82` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_83` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_84` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_85` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_86` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_87` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_88` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_89` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_90` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_91` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_92` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_93` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_94` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_95` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_96` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_97` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_98` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_99` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_100` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_101` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_102` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_103` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_104` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_105` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_106` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_107` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_108` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_109` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_110` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_111` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_112` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_113` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_114` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_115` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_116` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_117` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_118` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_119` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_120` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_121` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_122` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_123` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_124` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_125` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_126` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); alter table `t_user_messages_127` add INDEX `message_mid_line_uid_index` ( `_uid` DESC, `_line` DESC, `_mid` DESC ); ================================================ FILE: broker/migrate/mysql/V32__create_device_table.sql ================================================ DROP TABLE IF EXISTS `t_thing`; DROP TABLE IF EXISTS `t_device`; CREATE TABLE `t_device` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_token` varchar(64) DEFAULT '', `_state` tinyint DEFAULT 0, `_extra` TEXT DEFAULT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `device_uid_index` (`_uid` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_device`; CREATE TABLE `t_user_device` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_did` varchar(64) DEFAULT '', UNIQUE INDEX `user_device_uid_index` (`_uid` ASC, `_did` ASC), INDEX `user_device_did_index` (`_did` ASC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; ================================================ FILE: broker/migrate/mysql/V33__add_session_user_type.sql ================================================ alter table t_user_session add column `_user_type` tinyint DEFAULT 0 COMMENT "0, normal user; 1, robot; 2, device;"; ================================================ FILE: broker/migrate/mysql/V34__create_receipt_table.sql ================================================ DROP TABLE IF EXISTS `t_read_report`; CREATE TABLE `t_read_report` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NULL, `_type` tinyint NULL, `_line` int(11) NULL, `_target` varchar(64) NULL, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `read_report_index` (`_uid`, `_type`, `_line`, `_target`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_read_report`; CREATE TABLE `t_user_read_report` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_rid` int(11) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `user_read_report_index` (`_uid` DESC, `_seq` DESC), UNIQUE INDEX `user_read_report_index2` (`_uid` DESC, `_rid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_delivery_report`; CREATE TABLE `t_delivery_report` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `delivery_index` (`_uid`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_delivery_report`; CREATE TABLE `t_user_delivery_report` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_rid` varchar(64) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `user_delivery_index` (`_uid` DESC, `_seq` DESC), UNIQUE INDEX `user_delivery_index2` (`_uid` DESC, `_rid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; ================================================ FILE: broker/migrate/mysql/V35__add_group_member_create_dt.sql ================================================ alter table t_group_member add column `_create_dt` bigint(20) DEFAULT 0, COMMENT "group member create time"; ================================================ FILE: broker/migrate/mysql/V36__add_group_member_count_history_message.sql ================================================ alter table `t_group` add column `_history_message` tinyint NOT NULL DEFAULT 0, COMMENT "new group member can load group history messages"; alter table `t_group` add column `_max_member_count` int(11) NOT NULL DEFAULT 2000, COMMENT "max group member count"; ================================================ FILE: broker/migrate/mysql/V37__alter_setting_column_name.sql ================================================ alter table `t_settings` change column `value` `_value` varchar(64) NOT NULL; alter table `t_settings` change column `desc` `_desc` varchar(64) NOT NULL; ================================================ FILE: broker/migrate/mysql/V38__alter_group_searchable_column.sql ================================================ alter table `t_group` modify column `_searchable` int(11) NOT NULL DEFAULT 0; ================================================ FILE: broker/migrate/mysql/V39__create_files_table.sql ================================================ DROP TABLE IF EXISTS `t_file`; CREATE TABLE `t_file` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_name` varchar(128) DEFAULT '', `_url` varchar(1024) NOT NULL DEFAULT '', `_size` int(11) NOT NULL DEFAULT 0, `_download_count` int(11) DEFAULT 0, `_dt` bigint(20) NOT NULL, INDEX `file_conv_index` (`_type`, `_line`, `_target`, `_mid`), INDEX `file_user_index` (`_from`, `_mid`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; ================================================ FILE: broker/migrate/mysql/V3__create_sharding_table.sql ================================================ DROP TABLE IF EXISTS `t_messages_0`; CREATE TABLE `t_messages_0` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_1`; CREATE TABLE `t_messages_1` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_2`; CREATE TABLE `t_messages_2` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_3`; CREATE TABLE `t_messages_3` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_4`; CREATE TABLE `t_messages_4` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_5`; CREATE TABLE `t_messages_5` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_6`; CREATE TABLE `t_messages_6` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_7`; CREATE TABLE `t_messages_7` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_8`; CREATE TABLE `t_messages_8` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_9`; CREATE TABLE `t_messages_9` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_10`; CREATE TABLE `t_messages_10` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_11`; CREATE TABLE `t_messages_11` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_12`; CREATE TABLE `t_messages_12` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_13`; CREATE TABLE `t_messages_13` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_14`; CREATE TABLE `t_messages_14` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_15`; CREATE TABLE `t_messages_15` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_16`; CREATE TABLE `t_messages_16` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_17`; CREATE TABLE `t_messages_17` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_18`; CREATE TABLE `t_messages_18` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_19`; CREATE TABLE `t_messages_19` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_20`; CREATE TABLE `t_messages_20` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_21`; CREATE TABLE `t_messages_21` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_22`; CREATE TABLE `t_messages_22` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_23`; CREATE TABLE `t_messages_23` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_24`; CREATE TABLE `t_messages_24` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_25`; CREATE TABLE `t_messages_25` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_26`; CREATE TABLE `t_messages_26` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_27`; CREATE TABLE `t_messages_27` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_28`; CREATE TABLE `t_messages_28` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_29`; CREATE TABLE `t_messages_29` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_30`; CREATE TABLE `t_messages_30` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_31`; CREATE TABLE `t_messages_31` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_32`; CREATE TABLE `t_messages_32` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_33`; CREATE TABLE `t_messages_33` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_34`; CREATE TABLE `t_messages_34` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_messages_35`; CREATE TABLE `t_messages_35` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, UNIQUE INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_0`; CREATE TABLE `t_user_messages_0` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_1`; CREATE TABLE `t_user_messages_1` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_2`; CREATE TABLE `t_user_messages_2` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_3`; CREATE TABLE `t_user_messages_3` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_4`; CREATE TABLE `t_user_messages_4` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_5`; CREATE TABLE `t_user_messages_5` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_6`; CREATE TABLE `t_user_messages_6` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_7`; CREATE TABLE `t_user_messages_7` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_8`; CREATE TABLE `t_user_messages_8` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_9`; CREATE TABLE `t_user_messages_9` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_10`; CREATE TABLE `t_user_messages_10` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_11`; CREATE TABLE `t_user_messages_11` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_12`; CREATE TABLE `t_user_messages_12` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_13`; CREATE TABLE `t_user_messages_13` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_14`; CREATE TABLE `t_user_messages_14` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_15`; CREATE TABLE `t_user_messages_15` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_16`; CREATE TABLE `t_user_messages_16` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_17`; CREATE TABLE `t_user_messages_17` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_18`; CREATE TABLE `t_user_messages_18` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_19`; CREATE TABLE `t_user_messages_19` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_20`; CREATE TABLE `t_user_messages_20` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_21`; CREATE TABLE `t_user_messages_21` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_22`; CREATE TABLE `t_user_messages_22` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_23`; CREATE TABLE `t_user_messages_23` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_24`; CREATE TABLE `t_user_messages_24` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_25`; CREATE TABLE `t_user_messages_25` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_26`; CREATE TABLE `t_user_messages_26` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_27`; CREATE TABLE `t_user_messages_27` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_28`; CREATE TABLE `t_user_messages_28` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_29`; CREATE TABLE `t_user_messages_29` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_30`; CREATE TABLE `t_user_messages_30` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_31`; CREATE TABLE `t_user_messages_31` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_32`; CREATE TABLE `t_user_messages_32` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_33`; CREATE TABLE `t_user_messages_33` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_34`; CREATE TABLE `t_user_messages_34` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_35`; CREATE TABLE `t_user_messages_35` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_36`; CREATE TABLE `t_user_messages_36` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_37`; CREATE TABLE `t_user_messages_37` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_38`; CREATE TABLE `t_user_messages_38` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_39`; CREATE TABLE `t_user_messages_39` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_40`; CREATE TABLE `t_user_messages_40` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_41`; CREATE TABLE `t_user_messages_41` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_42`; CREATE TABLE `t_user_messages_42` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_43`; CREATE TABLE `t_user_messages_43` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_44`; CREATE TABLE `t_user_messages_44` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_45`; CREATE TABLE `t_user_messages_45` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_46`; CREATE TABLE `t_user_messages_46` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_47`; CREATE TABLE `t_user_messages_47` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_48`; CREATE TABLE `t_user_messages_48` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_49`; CREATE TABLE `t_user_messages_49` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_50`; CREATE TABLE `t_user_messages_50` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_51`; CREATE TABLE `t_user_messages_51` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_52`; CREATE TABLE `t_user_messages_52` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_53`; CREATE TABLE `t_user_messages_53` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_54`; CREATE TABLE `t_user_messages_54` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_55`; CREATE TABLE `t_user_messages_55` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_56`; CREATE TABLE `t_user_messages_56` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_57`; CREATE TABLE `t_user_messages_57` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_58`; CREATE TABLE `t_user_messages_58` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_59`; CREATE TABLE `t_user_messages_59` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_60`; CREATE TABLE `t_user_messages_60` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_61`; CREATE TABLE `t_user_messages_61` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_62`; CREATE TABLE `t_user_messages_62` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_63`; CREATE TABLE `t_user_messages_63` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_64`; CREATE TABLE `t_user_messages_64` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_65`; CREATE TABLE `t_user_messages_65` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_66`; CREATE TABLE `t_user_messages_66` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_67`; CREATE TABLE `t_user_messages_67` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_68`; CREATE TABLE `t_user_messages_68` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_69`; CREATE TABLE `t_user_messages_69` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_70`; CREATE TABLE `t_user_messages_70` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_71`; CREATE TABLE `t_user_messages_71` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_72`; CREATE TABLE `t_user_messages_72` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_73`; CREATE TABLE `t_user_messages_73` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_74`; CREATE TABLE `t_user_messages_74` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_75`; CREATE TABLE `t_user_messages_75` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_76`; CREATE TABLE `t_user_messages_76` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_77`; CREATE TABLE `t_user_messages_77` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_78`; CREATE TABLE `t_user_messages_78` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_79`; CREATE TABLE `t_user_messages_79` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_80`; CREATE TABLE `t_user_messages_80` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_81`; CREATE TABLE `t_user_messages_81` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_82`; CREATE TABLE `t_user_messages_82` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_83`; CREATE TABLE `t_user_messages_83` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_84`; CREATE TABLE `t_user_messages_84` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_85`; CREATE TABLE `t_user_messages_85` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_86`; CREATE TABLE `t_user_messages_86` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_87`; CREATE TABLE `t_user_messages_87` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_88`; CREATE TABLE `t_user_messages_88` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_89`; CREATE TABLE `t_user_messages_89` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_90`; CREATE TABLE `t_user_messages_90` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_91`; CREATE TABLE `t_user_messages_91` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_92`; CREATE TABLE `t_user_messages_92` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_93`; CREATE TABLE `t_user_messages_93` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_94`; CREATE TABLE `t_user_messages_94` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_95`; CREATE TABLE `t_user_messages_95` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_96`; CREATE TABLE `t_user_messages_96` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_97`; CREATE TABLE `t_user_messages_97` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_98`; CREATE TABLE `t_user_messages_98` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_99`; CREATE TABLE `t_user_messages_99` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_100`; CREATE TABLE `t_user_messages_100` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_101`; CREATE TABLE `t_user_messages_101` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_102`; CREATE TABLE `t_user_messages_102` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_103`; CREATE TABLE `t_user_messages_103` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_104`; CREATE TABLE `t_user_messages_104` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_105`; CREATE TABLE `t_user_messages_105` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_106`; CREATE TABLE `t_user_messages_106` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_107`; CREATE TABLE `t_user_messages_107` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_108`; CREATE TABLE `t_user_messages_108` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_109`; CREATE TABLE `t_user_messages_109` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_110`; CREATE TABLE `t_user_messages_110` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_111`; CREATE TABLE `t_user_messages_111` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_112`; CREATE TABLE `t_user_messages_112` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_113`; CREATE TABLE `t_user_messages_113` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_114`; CREATE TABLE `t_user_messages_114` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_115`; CREATE TABLE `t_user_messages_115` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_116`; CREATE TABLE `t_user_messages_116` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_117`; CREATE TABLE `t_user_messages_117` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_118`; CREATE TABLE `t_user_messages_118` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_119`; CREATE TABLE `t_user_messages_119` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_120`; CREATE TABLE `t_user_messages_120` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_121`; CREATE TABLE `t_user_messages_121` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_122`; CREATE TABLE `t_user_messages_122` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_123`; CREATE TABLE `t_user_messages_123` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_124`; CREATE TABLE `t_user_messages_124` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_125`; CREATE TABLE `t_user_messages_125` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_126`; CREATE TABLE `t_user_messages_126` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; DROP TABLE IF EXISTS `t_user_messages_127`; CREATE TABLE `t_user_messages_127` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_uid` varchar(64) NOT NULL, `_seq` bigint(20) NOT NULL, `_dt` DATETIME NOT NULL DEFAULT NOW(), INDEX `message_seq_uid_index` (`_uid` DESC, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; ================================================ FILE: broker/migrate/mysql/V40__create_file_transfer_user.sql ================================================ insert into t_user (`_uid`,`_name`,`_display_name`,`_portrait`,`_type`,`_dt`) values ('wfc_file_transfer','wfc_file_transfer','文件传输助手','https://static.wildfirechat.cn/wfc_file_transfer.png',1,1); insert into t_robot (`_uid`,`_owner`,`_secret`,`_callback`,`_state`,`_dt`) values ('wfc_file_transfer', 'wfc_file_transfer', '', '', 0, 1); ================================================ FILE: broker/migrate/mysql/V41__alter_channel_status_column.sql ================================================ alter table `t_channel` modify column `_status` int(11) NOT NULL DEFAULT 0; ================================================ FILE: broker/migrate/mysql/V42__add_user_messages_mid_index.sql ================================================ alter table `t_user_messages` add INDEX `user_messages_mid_index` ( `_mid` ); alter table `t_user_messages_0` add INDEX `user_messages0_mid_index` ( `_mid` ); alter table `t_user_messages_1` add INDEX `user_messages1_mid_index` ( `_mid` ); alter table `t_user_messages_2` add INDEX `user_messages2_mid_index` ( `_mid` ); alter table `t_user_messages_3` add INDEX `user_messages3_mid_index` ( `_mid` ); alter table `t_user_messages_4` add INDEX `user_messages4_mid_index` ( `_mid` ); alter table `t_user_messages_5` add INDEX `user_messages5_mid_index` ( `_mid` ); alter table `t_user_messages_6` add INDEX `user_messages6_mid_index` ( `_mid` ); alter table `t_user_messages_7` add INDEX `user_messages7_mid_index` ( `_mid` ); alter table `t_user_messages_8` add INDEX `user_messages8_mid_index` ( `_mid` ); alter table `t_user_messages_9` add INDEX `user_messages9_mid_index` ( `_mid` ); alter table `t_user_messages_10` add INDEX `user_messages10_mid_index` ( `_mid` ); alter table `t_user_messages_11` add INDEX `user_messages11_mid_index` ( `_mid` ); alter table `t_user_messages_12` add INDEX `user_messages12_mid_index` ( `_mid` ); alter table `t_user_messages_13` add INDEX `user_messages13_mid_index` ( `_mid` ); alter table `t_user_messages_14` add INDEX `user_messages14_mid_index` ( `_mid` ); alter table `t_user_messages_15` add INDEX `user_messages15_mid_index` ( `_mid` ); alter table `t_user_messages_16` add INDEX `user_messages16_mid_index` ( `_mid` ); alter table `t_user_messages_17` add INDEX `user_messages17_mid_index` ( `_mid` ); alter table `t_user_messages_18` add INDEX `user_messages18_mid_index` ( `_mid` ); alter table `t_user_messages_19` add INDEX `user_messages19_mid_index` ( `_mid` ); alter table `t_user_messages_20` add INDEX `user_messages20_mid_index` ( `_mid` ); alter table `t_user_messages_21` add INDEX `user_messages21_mid_index` ( `_mid` ); alter table `t_user_messages_22` add INDEX `user_messages22_mid_index` ( `_mid` ); alter table `t_user_messages_23` add INDEX `user_messages23_mid_index` ( `_mid` ); alter table `t_user_messages_24` add INDEX `user_messages24_mid_index` ( `_mid` ); alter table `t_user_messages_25` add INDEX `user_messages25_mid_index` ( `_mid` ); alter table `t_user_messages_26` add INDEX `user_messages26_mid_index` ( `_mid` ); alter table `t_user_messages_27` add INDEX `user_messages27_mid_index` ( `_mid` ); alter table `t_user_messages_28` add INDEX `user_messages28_mid_index` ( `_mid` ); alter table `t_user_messages_29` add INDEX `user_messages29_mid_index` ( `_mid` ); alter table `t_user_messages_30` add INDEX `user_messages30_mid_index` ( `_mid` ); alter table `t_user_messages_31` add INDEX `user_messages31_mid_index` ( `_mid` ); alter table `t_user_messages_32` add INDEX `user_messages32_mid_index` ( `_mid` ); alter table `t_user_messages_33` add INDEX `user_messages33_mid_index` ( `_mid` ); alter table `t_user_messages_34` add INDEX `user_messages34_mid_index` ( `_mid` ); alter table `t_user_messages_35` add INDEX `user_messages35_mid_index` ( `_mid` ); alter table `t_user_messages_36` add INDEX `user_messages36_mid_index` ( `_mid` ); alter table `t_user_messages_37` add INDEX `user_messages37_mid_index` ( `_mid` ); alter table `t_user_messages_38` add INDEX `user_messages38_mid_index` ( `_mid` ); alter table `t_user_messages_39` add INDEX `user_messages39_mid_index` ( `_mid` ); alter table `t_user_messages_40` add INDEX `user_messages40_mid_index` ( `_mid` ); alter table `t_user_messages_41` add INDEX `user_messages41_mid_index` ( `_mid` ); alter table `t_user_messages_42` add INDEX `user_messages42_mid_index` ( `_mid` ); alter table `t_user_messages_43` add INDEX `user_messages43_mid_index` ( `_mid` ); alter table `t_user_messages_44` add INDEX `user_messages44_mid_index` ( `_mid` ); alter table `t_user_messages_45` add INDEX `user_messages45_mid_index` ( `_mid` ); alter table `t_user_messages_46` add INDEX `user_messages46_mid_index` ( `_mid` ); alter table `t_user_messages_47` add INDEX `user_messages47_mid_index` ( `_mid` ); alter table `t_user_messages_48` add INDEX `user_messages48_mid_index` ( `_mid` ); alter table `t_user_messages_49` add INDEX `user_messages49_mid_index` ( `_mid` ); alter table `t_user_messages_50` add INDEX `user_messages50_mid_index` ( `_mid` ); alter table `t_user_messages_51` add INDEX `user_messages51_mid_index` ( `_mid` ); alter table `t_user_messages_52` add INDEX `user_messages52_mid_index` ( `_mid` ); alter table `t_user_messages_53` add INDEX `user_messages53_mid_index` ( `_mid` ); alter table `t_user_messages_54` add INDEX `user_messages54_mid_index` ( `_mid` ); alter table `t_user_messages_55` add INDEX `user_messages55_mid_index` ( `_mid` ); alter table `t_user_messages_56` add INDEX `user_messages56_mid_index` ( `_mid` ); alter table `t_user_messages_57` add INDEX `user_messages57_mid_index` ( `_mid` ); alter table `t_user_messages_58` add INDEX `user_messages58_mid_index` ( `_mid` ); alter table `t_user_messages_59` add INDEX `user_messages59_mid_index` ( `_mid` ); alter table `t_user_messages_60` add INDEX `user_messages60_mid_index` ( `_mid` ); alter table `t_user_messages_61` add INDEX `user_messages61_mid_index` ( `_mid` ); alter table `t_user_messages_62` add INDEX `user_messages62_mid_index` ( `_mid` ); alter table `t_user_messages_63` add INDEX `user_messages63_mid_index` ( `_mid` ); alter table `t_user_messages_64` add INDEX `user_messages64_mid_index` ( `_mid` ); alter table `t_user_messages_65` add INDEX `user_messages65_mid_index` ( `_mid` ); alter table `t_user_messages_66` add INDEX `user_messages66_mid_index` ( `_mid` ); alter table `t_user_messages_67` add INDEX `user_messages67_mid_index` ( `_mid` ); alter table `t_user_messages_68` add INDEX `user_messages68_mid_index` ( `_mid` ); alter table `t_user_messages_69` add INDEX `user_messages69_mid_index` ( `_mid` ); alter table `t_user_messages_70` add INDEX `user_messages70_mid_index` ( `_mid` ); alter table `t_user_messages_71` add INDEX `user_messages71_mid_index` ( `_mid` ); alter table `t_user_messages_72` add INDEX `user_messages72_mid_index` ( `_mid` ); alter table `t_user_messages_73` add INDEX `user_messages73_mid_index` ( `_mid` ); alter table `t_user_messages_74` add INDEX `user_messages74_mid_index` ( `_mid` ); alter table `t_user_messages_75` add INDEX `user_messages75_mid_index` ( `_mid` ); alter table `t_user_messages_76` add INDEX `user_messages76_mid_index` ( `_mid` ); alter table `t_user_messages_77` add INDEX `user_messages77_mid_index` ( `_mid` ); alter table `t_user_messages_78` add INDEX `user_messages78_mid_index` ( `_mid` ); alter table `t_user_messages_79` add INDEX `user_messages79_mid_index` ( `_mid` ); alter table `t_user_messages_80` add INDEX `user_messages80_mid_index` ( `_mid` ); alter table `t_user_messages_81` add INDEX `user_messages81_mid_index` ( `_mid` ); alter table `t_user_messages_82` add INDEX `user_messages82_mid_index` ( `_mid` ); alter table `t_user_messages_83` add INDEX `user_messages83_mid_index` ( `_mid` ); alter table `t_user_messages_84` add INDEX `user_messages84_mid_index` ( `_mid` ); alter table `t_user_messages_85` add INDEX `user_messages85_mid_index` ( `_mid` ); alter table `t_user_messages_86` add INDEX `user_messages86_mid_index` ( `_mid` ); alter table `t_user_messages_87` add INDEX `user_messages87_mid_index` ( `_mid` ); alter table `t_user_messages_88` add INDEX `user_messages88_mid_index` ( `_mid` ); alter table `t_user_messages_89` add INDEX `user_messages89_mid_index` ( `_mid` ); alter table `t_user_messages_90` add INDEX `user_messages90_mid_index` ( `_mid` ); alter table `t_user_messages_91` add INDEX `user_messages91_mid_index` ( `_mid` ); alter table `t_user_messages_92` add INDEX `user_messages92_mid_index` ( `_mid` ); alter table `t_user_messages_93` add INDEX `user_messages93_mid_index` ( `_mid` ); alter table `t_user_messages_94` add INDEX `user_messages94_mid_index` ( `_mid` ); alter table `t_user_messages_95` add INDEX `user_messages95_mid_index` ( `_mid` ); alter table `t_user_messages_96` add INDEX `user_messages96_mid_index` ( `_mid` ); alter table `t_user_messages_97` add INDEX `user_messages97_mid_index` ( `_mid` ); alter table `t_user_messages_98` add INDEX `user_messages98_mid_index` ( `_mid` ); alter table `t_user_messages_99` add INDEX `user_messages99_mid_index` ( `_mid` ); alter table `t_user_messages_100` add INDEX `user_messages100_mid_index` ( `_mid` ); alter table `t_user_messages_101` add INDEX `user_messages101_mid_index` ( `_mid` ); alter table `t_user_messages_102` add INDEX `user_messages102_mid_index` ( `_mid` ); alter table `t_user_messages_103` add INDEX `user_messages103_mid_index` ( `_mid` ); alter table `t_user_messages_104` add INDEX `user_messages104_mid_index` ( `_mid` ); alter table `t_user_messages_105` add INDEX `user_messages105_mid_index` ( `_mid` ); alter table `t_user_messages_106` add INDEX `user_messages106_mid_index` ( `_mid` ); alter table `t_user_messages_107` add INDEX `user_messages107_mid_index` ( `_mid` ); alter table `t_user_messages_108` add INDEX `user_messages108_mid_index` ( `_mid` ); alter table `t_user_messages_109` add INDEX `user_messages109_mid_index` ( `_mid` ); alter table `t_user_messages_110` add INDEX `user_messages110_mid_index` ( `_mid` ); alter table `t_user_messages_111` add INDEX `user_messages111_mid_index` ( `_mid` ); alter table `t_user_messages_112` add INDEX `user_messages112_mid_index` ( `_mid` ); alter table `t_user_messages_113` add INDEX `user_messages113_mid_index` ( `_mid` ); alter table `t_user_messages_114` add INDEX `user_messages114_mid_index` ( `_mid` ); alter table `t_user_messages_115` add INDEX `user_messages115_mid_index` ( `_mid` ); alter table `t_user_messages_116` add INDEX `user_messages116_mid_index` ( `_mid` ); alter table `t_user_messages_117` add INDEX `user_messages117_mid_index` ( `_mid` ); alter table `t_user_messages_118` add INDEX `user_messages118_mid_index` ( `_mid` ); alter table `t_user_messages_119` add INDEX `user_messages119_mid_index` ( `_mid` ); alter table `t_user_messages_120` add INDEX `user_messages120_mid_index` ( `_mid` ); alter table `t_user_messages_121` add INDEX `user_messages121_mid_index` ( `_mid` ); alter table `t_user_messages_122` add INDEX `user_messages122_mid_index` ( `_mid` ); alter table `t_user_messages_123` add INDEX `user_messages123_mid_index` ( `_mid` ); alter table `t_user_messages_124` add INDEX `user_messages124_mid_index` ( `_mid` ); alter table `t_user_messages_125` add INDEX `user_messages125_mid_index` ( `_mid` ); alter table `t_user_messages_126` add INDEX `user_messages126_mid_index` ( `_mid` ); alter table `t_user_messages_127` add INDEX `user_messages127_mid_index` ( `_mid` ); ================================================ FILE: broker/migrate/mysql/V43__add_user_messages_conv_info.sql ================================================ alter table `t_user_messages` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_0` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_0` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_0` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_0` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_1` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_1` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_1` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_1` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_2` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_2` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_2` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_2` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_3` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_3` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_3` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_3` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_4` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_4` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_4` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_4` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_5` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_5` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_5` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_5` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_6` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_6` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_6` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_6` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_7` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_7` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_7` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_7` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_8` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_8` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_8` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_8` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_9` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_9` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_9` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_9` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_10` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_10` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_10` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_10` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_11` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_11` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_11` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_11` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_12` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_12` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_12` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_12` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_13` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_13` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_13` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_13` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_14` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_14` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_14` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_14` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_15` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_15` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_15` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_15` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_16` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_16` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_16` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_16` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_17` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_17` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_17` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_17` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_18` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_18` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_18` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_18` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_19` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_19` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_19` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_19` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_20` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_20` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_20` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_20` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_21` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_21` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_21` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_21` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_22` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_22` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_22` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_22` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_23` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_23` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_23` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_23` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_24` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_24` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_24` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_24` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_25` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_25` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_25` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_25` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_26` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_26` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_26` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_26` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_27` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_27` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_27` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_27` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_28` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_28` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_28` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_28` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_29` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_29` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_29` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_29` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_30` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_30` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_30` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_30` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_31` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_31` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_31` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_31` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_32` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_32` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_32` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_32` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_33` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_33` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_33` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_33` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_34` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_34` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_34` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_34` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_35` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_35` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_35` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_35` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_36` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_36` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_36` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_36` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_37` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_37` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_37` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_37` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_38` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_38` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_38` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_38` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_39` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_39` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_39` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_39` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_40` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_40` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_40` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_40` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_41` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_41` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_41` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_41` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_42` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_42` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_42` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_42` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_43` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_43` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_43` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_43` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_44` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_44` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_44` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_44` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_45` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_45` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_45` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_45` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_46` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_46` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_46` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_46` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_47` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_47` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_47` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_47` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_48` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_48` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_48` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_48` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_49` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_49` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_49` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_49` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_50` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_50` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_50` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_50` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_51` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_51` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_51` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_51` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_52` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_52` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_52` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_52` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_53` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_53` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_53` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_53` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_54` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_54` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_54` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_54` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_55` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_55` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_55` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_55` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_56` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_56` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_56` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_56` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_57` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_57` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_57` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_57` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_58` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_58` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_58` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_58` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_59` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_59` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_59` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_59` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_60` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_60` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_60` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_60` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_61` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_61` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_61` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_61` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_62` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_62` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_62` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_62` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_63` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_63` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_63` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_63` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_64` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_64` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_64` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_64` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_65` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_65` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_65` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_65` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_66` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_66` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_66` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_66` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_67` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_67` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_67` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_67` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_68` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_68` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_68` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_68` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_69` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_69` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_69` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_69` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_70` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_70` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_70` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_70` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_71` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_71` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_71` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_71` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_72` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_72` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_72` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_72` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_73` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_73` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_73` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_73` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_74` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_74` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_74` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_74` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_75` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_75` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_75` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_75` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_76` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_76` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_76` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_76` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_77` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_77` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_77` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_77` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_78` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_78` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_78` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_78` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_79` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_79` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_79` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_79` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_80` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_80` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_80` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_80` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_81` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_81` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_81` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_81` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_82` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_82` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_82` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_82` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_83` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_83` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_83` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_83` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_84` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_84` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_84` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_84` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_85` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_85` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_85` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_85` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_86` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_86` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_86` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_86` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_87` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_87` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_87` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_87` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_88` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_88` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_88` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_88` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_89` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_89` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_89` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_89` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_90` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_90` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_90` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_90` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_91` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_91` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_91` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_91` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_92` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_92` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_92` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_92` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_93` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_93` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_93` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_93` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_94` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_94` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_94` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_94` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_95` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_95` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_95` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_95` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_96` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_96` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_96` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_96` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_97` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_97` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_97` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_97` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_98` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_98` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_98` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_98` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_99` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_99` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_99` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_99` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_100` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_100` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_100` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_100` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_101` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_101` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_101` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_101` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_102` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_102` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_102` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_102` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_103` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_103` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_103` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_103` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_104` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_104` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_104` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_104` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_105` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_105` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_105` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_105` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_106` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_106` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_106` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_106` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_107` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_107` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_107` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_107` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_108` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_108` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_108` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_108` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_109` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_109` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_109` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_109` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_110` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_110` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_110` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_110` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_111` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_111` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_111` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_111` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_112` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_112` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_112` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_112` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_113` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_113` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_113` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_113` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_114` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_114` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_114` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_114` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_115` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_115` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_115` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_115` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_116` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_116` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_116` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_116` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_117` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_117` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_117` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_117` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_118` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_118` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_118` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_118` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_119` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_119` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_119` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_119` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_120` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_120` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_120` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_120` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_121` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_121` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_121` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_121` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_122` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_122` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_122` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_122` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_123` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_123` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_123` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_123` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_124` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_124` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_124` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_124` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_125` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_125` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_125` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_125` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_126` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_126` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_126` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_126` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); alter table `t_user_messages_127` add column `_type` tinyint(4) NOT NULL DEFAULT '0'; alter table `t_user_messages_127` add column `_target` varchar(129) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT ''; alter table `t_user_messages_127` add column `_directing` tinyint(1) NOT NULL DEFAULT '0'; alter table `t_user_messages_127` add INDEX `user_messages_conv_index` ( `_uid`, `_type`, `_target`, `_line`, `_mid` desc); ================================================ FILE: broker/migrate/mysql/V44__add_group_member_friend_request_extra.sql ================================================ alter table `t_group_member` add column `_extra` TEXT DEFAULT NULL; alter table `t_friend_request` add column `_extra` TEXT DEFAULT NULL; ================================================ FILE: broker/migrate/mysql/V45__add_user_messages_cont_type.sql ================================================ alter table `t_user_messages` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_0` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_1` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_2` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_3` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_4` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_5` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_6` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_7` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_8` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_9` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_10` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_11` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_12` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_13` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_14` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_15` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_16` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_17` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_18` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_19` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_20` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_21` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_22` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_23` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_24` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_25` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_26` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_27` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_28` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_29` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_30` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_31` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_32` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_33` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_34` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_35` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_36` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_37` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_38` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_39` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_40` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_41` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_42` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_43` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_44` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_45` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_46` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_47` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_48` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_49` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_50` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_51` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_52` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_53` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_54` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_55` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_56` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_57` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_58` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_59` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_60` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_61` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_62` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_63` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_64` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_65` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_66` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_67` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_68` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_69` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_70` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_71` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_72` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_73` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_74` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_75` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_76` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_77` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_78` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_79` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_80` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_81` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_82` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_83` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_84` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_85` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_86` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_87` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_88` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_89` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_90` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_91` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_92` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_93` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_94` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_95` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_96` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_97` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_98` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_99` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_100` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_101` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_102` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_103` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_104` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_105` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_106` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_107` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_108` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_109` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_110` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_111` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_112` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_113` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_114` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_115` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_116` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_117` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_118` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_119` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_120` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_121` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_122` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_123` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_124` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_125` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_126` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; alter table `t_user_messages_127` add column `_cont_type` int(11) NOT NULL DEFAULT '0'; ================================================ FILE: broker/migrate/mysql/V46__utf8mb4_unicode_ci_to_utf8mb4_bin.sql ================================================ ALTER TABLE `t_channel` MODIFY COLUMN `_cid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_channel` MODIFY COLUMN `_owner` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_channel_listener` MODIFY COLUMN `_cid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_channel_listener` MODIFY COLUMN `_mid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_chatroom` MODIFY COLUMN `_cid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_chatroom_blacklist` MODIFY COLUMN `_cid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_chatroom_blacklist` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_chatroom_manager` MODIFY COLUMN `_cid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_chatroom_manager` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_delivery_report` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_device` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_file` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_file` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_friend` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_friend` MODIFY COLUMN `_friend_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_friend_request` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_friend_request` MODIFY COLUMN `_friend_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_group` MODIFY COLUMN `_gid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_group` MODIFY COLUMN `_owner` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT ''; ALTER TABLE `t_group_member` MODIFY COLUMN `_gid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_group_member` MODIFY COLUMN `_mid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_0` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_0` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_0` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_1` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_1` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_1` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_10` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_10` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_10` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_11` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_11` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_11` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_12` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_12` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_12` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_13` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_13` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_13` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_14` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_14` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_14` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_15` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_15` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_15` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_16` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_16` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_16` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_17` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_17` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_17` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_18` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_18` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_18` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_19` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_19` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_19` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_2` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_2` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_2` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_20` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_20` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_20` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_21` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_21` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_21` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_22` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_22` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_22` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_23` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_23` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_23` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_24` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_24` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_24` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_25` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_25` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_25` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_26` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_26` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_26` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_27` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_27` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_27` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_28` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_28` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_28` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_29` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_29` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_29` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_3` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_3` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_3` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_30` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_30` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_30` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_31` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_31` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_31` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_32` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_32` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_32` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_33` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_33` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_33` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_34` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_34` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_34` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_35` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_35` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_35` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_4` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_4` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_4` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_5` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_5` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_5` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_6` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_6` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_6` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_7` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_7` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_7` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_8` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_8` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_8` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_messages_9` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_9` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_messages_9` MODIFY COLUMN `_to` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_read_report` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_read_report` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_robot` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_robot` MODIFY COLUMN `_owner` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT ''; ALTER TABLE `t_sensitive_messages` MODIFY COLUMN `_from` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_sensitive_messages` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_session` MODIFY COLUMN `row_id` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user` MODIFY COLUMN `_name` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_delivery_report` MODIFY COLUMN `_rid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_delivery_report` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_device` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_device` MODIFY COLUMN `_did` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_0` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_0` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_1` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_1` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_10` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_10` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_100` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_100` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_101` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_101` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_102` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_102` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_103` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_103` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_104` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_104` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_105` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_105` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_106` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_106` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_107` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_107` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_108` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_108` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_109` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_109` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_11` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_11` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_110` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_110` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_111` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_111` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_112` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_112` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_113` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_113` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_114` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_114` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_115` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_115` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_116` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_116` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_117` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_117` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_118` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_118` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_119` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_119` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_12` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_12` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_120` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_120` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_121` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_121` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_122` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_122` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_123` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_123` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_124` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_124` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_125` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_125` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_126` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_126` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_127` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_127` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_13` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_13` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_14` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_14` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_15` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_15` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_16` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_16` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_17` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_17` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_18` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_18` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_19` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_19` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_2` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_2` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_20` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_20` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_21` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_21` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_22` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_22` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_23` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_23` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_24` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_24` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_25` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_25` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_26` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_26` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_27` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_27` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_28` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_28` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_29` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_29` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_3` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_3` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_30` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_30` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_31` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_31` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_32` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_32` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_33` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_33` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_34` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_34` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_35` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_35` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_36` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_36` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_37` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_37` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_38` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_38` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_39` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_39` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_4` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_4` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_40` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_40` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_41` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_41` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_42` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_42` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_43` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_43` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_44` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_44` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_45` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_45` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_46` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_46` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_47` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_47` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_48` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_48` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_49` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_49` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_5` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_5` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_50` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_50` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_51` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_51` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_52` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_52` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_53` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_53` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_54` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_54` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_55` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_55` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_56` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_56` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_57` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_57` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_58` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_58` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_59` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_59` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_6` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_6` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_60` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_60` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_61` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_61` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_62` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_62` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_63` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_63` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_64` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_64` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_65` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_65` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_66` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_66` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_67` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_67` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_68` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_68` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_69` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_69` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_7` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_7` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_70` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_70` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_71` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_71` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_72` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_72` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_73` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_73` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_74` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_74` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_75` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_75` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_76` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_76` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_77` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_77` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_78` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_78` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_79` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_79` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_8` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_8` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_80` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_80` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_81` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_81` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_82` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_82` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_83` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_83` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_84` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_84` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_85` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_85` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_86` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_86` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_87` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_87` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_88` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_88` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_89` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_89` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_9` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_9` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_90` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_90` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_91` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_91` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_92` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_92` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_93` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_93` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_94` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_94` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_95` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_95` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_96` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_96` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_97` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_97` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_98` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_98` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_99` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_messages_99` MODIFY COLUMN `_target` VARCHAR(129) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_read_report` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_session` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_session` MODIFY COLUMN `_cid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_session` MODIFY COLUMN `_token` VARCHAR(240) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_user_setting` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_setting` MODIFY COLUMN `_key` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ALTER TABLE `t_user_status` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ================================================ FILE: broker/migrate/mysql/V47__fix_read_report_error.sql ================================================ ALTER TABLE `t_read_report` MODIFY COLUMN `_uid` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ALTER TABLE `t_read_report` MODIFY COLUMN `_target` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL; ================================================ FILE: broker/migrate/mysql/V48__alter_user_setting_key_column.sql ================================================ alter table `t_user_setting` modify column `_key` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL; ================================================ FILE: broker/migrate/mysql/V49__create_secret_chat_table.sql ================================================ DROP TABLE IF EXISTS `t_secret_chat`; CREATE TABLE `t_secret_chat` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_from` varchar(64) DEFAULT '', `_from_cid` varchar(64) DEFAULT '', `_to` varchar(64) DEFAULT '', `_to_cid` varchar(64) DEFAULT '', `_state` tinyint NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL, UNIQUE INDEX `secret_chat_uid_index` (`_uid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; ================================================ FILE: broker/migrate/mysql/V4__create_default_chatroom.sql ================================================ insert into t_chatroom (`_cid`, `_title`, `_desc`,`_dt`) values ('chatroom1','火信聊天室1','火信测试聊天室1,用来演示聊天室功能', 1); insert into t_chatroom (`_cid`, `_title`, `_desc`,`_dt`) values ('chatroom2','火信聊天室2','火信测试聊天室2,用来演示聊天室功能', 1); insert into t_chatroom (`_cid`, `_title`, `_desc`,`_dt`) values ('chatroom3','火信聊天室3','火信测试聊天室3,用来演示聊天室功能', 1); ================================================ FILE: broker/migrate/mysql/V50__add_message_table_conversation_index.sql ================================================ alter table `t_messages` add INDEX `messages_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_0` add INDEX `messages0_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_1` add INDEX `messages1_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_2` add INDEX `messages2_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_3` add INDEX `messages3_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_4` add INDEX `messages4_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_5` add INDEX `messages5_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_6` add INDEX `messages6_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_7` add INDEX `messages7_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_8` add INDEX `messages8_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_9` add INDEX `messages9_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_10` add INDEX `messages10_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_11` add INDEX `messages11_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_12` add INDEX `messages12_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_13` add INDEX `messages13_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_14` add INDEX `messages14_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_15` add INDEX `messages15_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_16` add INDEX `messages16_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_17` add INDEX `messages17_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_18` add INDEX `messages18_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_19` add INDEX `messages19_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_20` add INDEX `messages20_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_21` add INDEX `messages21_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_22` add INDEX `messages22_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_23` add INDEX `messages23_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_24` add INDEX `messages24_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_25` add INDEX `messages25_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_26` add INDEX `messages26_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_27` add INDEX `messages27_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_28` add INDEX `messages28_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_29` add INDEX `messages29_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_30` add INDEX `messages30_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_31` add INDEX `messages31_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_32` add INDEX `messages32_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_33` add INDEX `messages33_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_34` add INDEX `messages34_conv_index` (`_type`, `_target`, `_line`); alter table `t_messages_35` add INDEX `messages35_conv_index` (`_type`, `_target`, `_line`); ================================================ FILE: broker/migrate/mysql/V51__add_channel_listener_table_member_index.sql ================================================ alter table `t_channel_listener` add INDEX `channel_mid_index` (`_mid`); ================================================ FILE: broker/migrate/mysql/V52__add_channel_menu_column.sql ================================================ alter table `t_channel` add column `_menu` BLOB DEFAULT NULL; ================================================ FILE: broker/migrate/mysql/V53__add_group_member_mid_index.sql ================================================ alter table `t_group_member` add INDEX `group_member_mid_index` (`_mid`); ================================================ FILE: broker/migrate/mysql/V54__create_super_group.sql ================================================ alter table `t_group` add column `_super_group` tinyint NOT NULL DEFAULT 0; DROP TABLE IF EXISTS `t_group_messages`; CREATE TABLE `t_group_messages` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_0`; CREATE TABLE `t_group_messages_0` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message0_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_1`; CREATE TABLE `t_group_messages_1` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message1_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_2`; CREATE TABLE `t_group_messages_2` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message2_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_3`; CREATE TABLE `t_group_messages_3` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message3_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_4`; CREATE TABLE `t_group_messages_4` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message4_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_5`; CREATE TABLE `t_group_messages_5` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message5_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_6`; CREATE TABLE `t_group_messages_6` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message6_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_7`; CREATE TABLE `t_group_messages_7` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message7_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_8`; CREATE TABLE `t_group_messages_8` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message8_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_9`; CREATE TABLE `t_group_messages_9` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message9_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_10`; CREATE TABLE `t_group_messages_10` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message10_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_11`; CREATE TABLE `t_group_messages_11` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message11_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_12`; CREATE TABLE `t_group_messages_12` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message12_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_13`; CREATE TABLE `t_group_messages_13` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message13_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_14`; CREATE TABLE `t_group_messages_14` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message14_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_15`; CREATE TABLE `t_group_messages_15` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message15_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_16`; CREATE TABLE `t_group_messages_16` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message16_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_17`; CREATE TABLE `t_group_messages_17` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message17_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_18`; CREATE TABLE `t_group_messages_18` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message18_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_19`; CREATE TABLE `t_group_messages_19` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message19_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_20`; CREATE TABLE `t_group_messages_20` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message20_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_21`; CREATE TABLE `t_group_messages_21` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message21_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_22`; CREATE TABLE `t_group_messages_22` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message22_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_23`; CREATE TABLE `t_group_messages_23` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message23_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_24`; CREATE TABLE `t_group_messages_24` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message24_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_25`; CREATE TABLE `t_group_messages_25` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message25_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_26`; CREATE TABLE `t_group_messages_26` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message26_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_27`; CREATE TABLE `t_group_messages_27` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message27_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_28`; CREATE TABLE `t_group_messages_28` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message28_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_29`; CREATE TABLE `t_group_messages_29` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message29_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_30`; CREATE TABLE `t_group_messages_30` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message30_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_31`; CREATE TABLE `t_group_messages_31` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message31_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_32`; CREATE TABLE `t_group_messages_32` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message32_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_33`; CREATE TABLE `t_group_messages_33` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message33_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_34`; CREATE TABLE `t_group_messages_34` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message34_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_35`; CREATE TABLE `t_group_messages_35` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message35_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_36`; CREATE TABLE `t_group_messages_36` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message36_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_37`; CREATE TABLE `t_group_messages_37` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message37_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_38`; CREATE TABLE `t_group_messages_38` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message38_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_39`; CREATE TABLE `t_group_messages_39` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message39_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_40`; CREATE TABLE `t_group_messages_40` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message40_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_41`; CREATE TABLE `t_group_messages_41` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message41_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_42`; CREATE TABLE `t_group_messages_42` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message42_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_43`; CREATE TABLE `t_group_messages_43` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message43_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_44`; CREATE TABLE `t_group_messages_44` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message44_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_45`; CREATE TABLE `t_group_messages_45` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message45_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_46`; CREATE TABLE `t_group_messages_46` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message46_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_47`; CREATE TABLE `t_group_messages_47` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message47_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_48`; CREATE TABLE `t_group_messages_48` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message48_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_49`; CREATE TABLE `t_group_messages_49` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message49_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_50`; CREATE TABLE `t_group_messages_50` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message50_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_51`; CREATE TABLE `t_group_messages_51` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message51_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_52`; CREATE TABLE `t_group_messages_52` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message52_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_53`; CREATE TABLE `t_group_messages_53` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message53_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_54`; CREATE TABLE `t_group_messages_54` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message54_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_55`; CREATE TABLE `t_group_messages_55` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message55_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_56`; CREATE TABLE `t_group_messages_56` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message56_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_57`; CREATE TABLE `t_group_messages_57` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message57_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_58`; CREATE TABLE `t_group_messages_58` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message58_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_59`; CREATE TABLE `t_group_messages_59` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message59_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_60`; CREATE TABLE `t_group_messages_60` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message60_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_61`; CREATE TABLE `t_group_messages_61` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message61_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_62`; CREATE TABLE `t_group_messages_62` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message62_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_63`; CREATE TABLE `t_group_messages_63` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message63_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_64`; CREATE TABLE `t_group_messages_64` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message64_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_65`; CREATE TABLE `t_group_messages_65` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message65_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_66`; CREATE TABLE `t_group_messages_66` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message66_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_67`; CREATE TABLE `t_group_messages_67` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message67_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_68`; CREATE TABLE `t_group_messages_68` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message68_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_69`; CREATE TABLE `t_group_messages_69` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message69_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_70`; CREATE TABLE `t_group_messages_70` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message70_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_71`; CREATE TABLE `t_group_messages_71` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message71_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_72`; CREATE TABLE `t_group_messages_72` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message72_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_73`; CREATE TABLE `t_group_messages_73` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message73_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_74`; CREATE TABLE `t_group_messages_74` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message74_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_75`; CREATE TABLE `t_group_messages_75` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message75_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_76`; CREATE TABLE `t_group_messages_76` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message76_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_77`; CREATE TABLE `t_group_messages_77` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message77_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_78`; CREATE TABLE `t_group_messages_78` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message78_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_79`; CREATE TABLE `t_group_messages_79` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message79_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_80`; CREATE TABLE `t_group_messages_80` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message80_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_81`; CREATE TABLE `t_group_messages_81` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message81_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_82`; CREATE TABLE `t_group_messages_82` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message82_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_83`; CREATE TABLE `t_group_messages_83` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message83_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_84`; CREATE TABLE `t_group_messages_84` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message84_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_85`; CREATE TABLE `t_group_messages_85` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message85_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_86`; CREATE TABLE `t_group_messages_86` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message86_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_87`; CREATE TABLE `t_group_messages_87` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message87_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_88`; CREATE TABLE `t_group_messages_88` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message88_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_89`; CREATE TABLE `t_group_messages_89` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message89_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_90`; CREATE TABLE `t_group_messages_90` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message90_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_91`; CREATE TABLE `t_group_messages_91` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message91_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_92`; CREATE TABLE `t_group_messages_92` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message92_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_93`; CREATE TABLE `t_group_messages_93` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message93_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_94`; CREATE TABLE `t_group_messages_94` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message94_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_95`; CREATE TABLE `t_group_messages_95` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message95_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_96`; CREATE TABLE `t_group_messages_96` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message96_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_97`; CREATE TABLE `t_group_messages_97` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message97_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_98`; CREATE TABLE `t_group_messages_98` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message98_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_99`; CREATE TABLE `t_group_messages_99` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message99_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_100`; CREATE TABLE `t_group_messages_100` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message100_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_101`; CREATE TABLE `t_group_messages_101` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message101_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_102`; CREATE TABLE `t_group_messages_102` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message102_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_103`; CREATE TABLE `t_group_messages_103` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message103_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_104`; CREATE TABLE `t_group_messages_104` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message104_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_105`; CREATE TABLE `t_group_messages_105` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message105_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_106`; CREATE TABLE `t_group_messages_106` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message106_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_107`; CREATE TABLE `t_group_messages_107` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message107_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_108`; CREATE TABLE `t_group_messages_108` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message108_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_109`; CREATE TABLE `t_group_messages_109` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message109_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_110`; CREATE TABLE `t_group_messages_110` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message110_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_111`; CREATE TABLE `t_group_messages_111` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message111_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_112`; CREATE TABLE `t_group_messages_112` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message112_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_113`; CREATE TABLE `t_group_messages_113` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message113_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_114`; CREATE TABLE `t_group_messages_114` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message114_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_115`; CREATE TABLE `t_group_messages_115` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message115_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_116`; CREATE TABLE `t_group_messages_116` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message116_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_117`; CREATE TABLE `t_group_messages_117` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message117_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_118`; CREATE TABLE `t_group_messages_118` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message118_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_119`; CREATE TABLE `t_group_messages_119` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message119_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_120`; CREATE TABLE `t_group_messages_120` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message120_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_121`; CREATE TABLE `t_group_messages_121` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message121_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_122`; CREATE TABLE `t_group_messages_122` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message122_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_123`; CREATE TABLE `t_group_messages_123` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message123_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_124`; CREATE TABLE `t_group_messages_124` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message124_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_125`; CREATE TABLE `t_group_messages_125` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message125_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_126`; CREATE TABLE `t_group_messages_126` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message126_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; DROP TABLE IF EXISTS `t_group_messages_127`; CREATE TABLE `t_group_messages_127` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_sender` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_line` int(11) NOT NULL, `_client_id` varchar(64) NULL, `_seq` bigint(20) NOT NULL, `_persist_flag` int(11) NOT NULL, `_mentioned_type` int(11) NOT NULL, `_mentioned_targets` BLOB NULL, `_to` BLOB NULL, `_cont_type` int(11) NOT NULL DEFAULT 0, `_duration` int(11) NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL DEFAULT 0, INDEX `group_message127_seq_uid_index` (`_gid` DESC, `_line`, `_seq` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin; ================================================ FILE: broker/migrate/mysql/V55__group_add_deleted_column.sql ================================================ alter table `t_group` add column `_deleted` tinyint NOT NULL DEFAULT 0; ================================================ FILE: broker/migrate/mysql/V56__add_domain_table.sql ================================================ DROP TABLE IF EXISTS `t_domain`; CREATE TABLE `t_domain` ( `_domain_id` varchar(128) NOT NULL PRIMARY KEY, `_name` varchar(64) NOT NULL, `_desc` varchar(256) DEFAULT '', `_email` varchar(64) DEFAULT '', `_tel` varchar(64) DEFAULT '', `_address` varchar(64) DEFAULT '', `_extra` varchar(1024) DEFAULT '', `_dt` bigint(20) NOT NULL ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; alter table `t_user` add column `_external` tinyint DEFAULT 0; ================================================ FILE: broker/migrate/mysql/V57__update_group_member_index.sql ================================================ CREATE INDEX `user_gid_mid_dt_index` ON `t_group_member` (`_gid`, `_mid`, `_dt`); ================================================ FILE: broker/migrate/mysql/V58__reupdate_group_member_index.sql ================================================ DROP INDEX `user_gid_mid_dt_index` ON `t_group_member`; CREATE INDEX `user_gid_dt_index` ON `t_group_member` (`_gid`, `_dt`); ================================================ FILE: broker/migrate/mysql/V59__add_no_allow_name_setting.sql ================================================ insert into t_settings(`id`, `_value`,`_desc`) values (2, '文件传输助手,客服,官方', '禁止使用名称,如果有多个,以英文逗号隔开。直接修改数据库,不用重启IM服务'); ================================================ FILE: broker/migrate/mysql/V5__create_default_robot.sql ================================================ insert into t_user (`_uid`,`_name`,`_display_name`,`_portrait`,`_type`,`_dt`) values ('FireRobot','FireRobot','小火','http://cdn2.wildfirechat.cn/robot.png',1,1); insert into t_robot (`_uid`,`_owner`,`_secret`,`_callback`,`_state`,`_dt`) values ('FireRobot', 'FireRobot', '123456', 'http://127.0.0.1:8883/robot/recvmsg', 0, 1); ================================================ FILE: broker/migrate/mysql/V60__modify_messages_target.sql ================================================ alter table `t_messages` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_0` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_1` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_2` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_3` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_4` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_5` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_6` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_7` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_8` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_9` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_10` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_11` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_12` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_13` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_14` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_15` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_16` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_17` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_18` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_19` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_20` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_21` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_22` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_23` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_24` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_25` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_26` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_27` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_28` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_29` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_30` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_31` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_32` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_33` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_34` modify column `_target` varchar(129) NOT NULL; alter table `t_messages_35` modify column `_target` varchar(129) NOT NULL; ================================================ FILE: broker/migrate/mysql/V61__session_add_ip_column.sql ================================================ ALTER TABLE `t_user_session` ADD COLUMN `_ip` varchar(40) DEFAULT ''; ================================================ FILE: broker/migrate/mysql/V64__add_group_member_index.sql ================================================ CREATE INDEX `user_gid_type_index` ON `t_group_member` (`_gid`, `_type`); ================================================ FILE: broker/migrate/mysql/V65__create_conference_table.sql ================================================ DROP TABLE IF EXISTS `t_conference`; CREATE TABLE `t_conference` ( `_id` varchar(64) NOT NULL PRIMARY KEY, `_des` varchar(64) NOT NULL, `_pin` varchar(16) NOT NULL, `_max_publishers` int(11) NOT NULL DEFAULT 0, `_bitrate` int(11) NOT NULL DEFAULT 0, `_advance` tinyint NOT NULL DEFAULT 0, `_recording` tinyint NOT NULL DEFAULT 0, `_create_dt` bigint(20) NOT NULL ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; ================================================ FILE: broker/migrate/mysql/V66__create_join_group_request_table.sql ================================================ DROP TABLE IF EXISTS `t_join_group_request`; CREATE TABLE `t_join_group_request` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_uid` varchar(64) NOT NULL, `_gid` varchar(64) NOT NULL, `_mid` varchar(64) NOT NULL, `_request_uid` varchar(64) NOT NULL, `_accept_uid` varchar(64) DEFAULT NULL, `_reason` TEXT DEFAULT NULL, `_extra` TEXT DEFAULT NULL, `_status` tinyint NOT NULL DEFAULT 0, `_dt` bigint(20) NOT NULL, `_read_status` tinyint DEFAULT 0, UNIQUE INDEX `join_group_request_key_index` (`_uid` DESC, `_gid` DESC, `_mid` DESC, `_request_uid` DESC), INDEX `join_group_request_gm_index` (`_gid` DESC, `_mid` DESC), INDEX `join_group_request_sync_index` (`_uid` DESC, `_dt` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; ================================================ FILE: broker/migrate/mysql/V67__create_friend_index.sql ================================================ alter table t_friend add index `friend_uid_index` (`_friend_uid`); ================================================ FILE: broker/migrate/mysql/V6__add_friend_alias.sql ================================================ alter table t_friend add column `_alias` varchar(64) DEFAULT NULL; ================================================ FILE: broker/migrate/mysql/V7__add_createtime_user_group_table.sql ================================================ alter table t_user add column `_createTime` TIMESTAMP default CURRENT_TIMESTAMP; alter table t_group add column `_createTime` TIMESTAMP default CURRENT_TIMESTAMP; ================================================ FILE: broker/migrate/mysql/V8__add_content_type_in_messages.sql ================================================ alter table `t_messages_0` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_1` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_2` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_3` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_4` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_5` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_6` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_7` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_8` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_9` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_10` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_11` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_12` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_13` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_14` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_15` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_16` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_17` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_18` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_19` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_20` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_21` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_22` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_23` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_24` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_25` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_26` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_27` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_28` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_29` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_30` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_31` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_32` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_33` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_34` add column `_content_type` int(11) NOT NULL DEFAULT '0'; alter table `t_messages_35` add column `_content_type` int(11) NOT NULL DEFAULT '0'; ================================================ FILE: broker/migrate/mysql/V9__add_sensitive_messages.sql ================================================ DROP TABLE IF EXISTS `t_sensitive_messages`; CREATE TABLE `t_sensitive_messages` ( `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT, `_mid` bigint(20) NOT NULL, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_data` BLOB NOT NULL, `_searchable_key` TEXT DEFAULT NULL, `_dt` DATETIME NOT NULL, `_content_type` int(11) NOT NULL DEFAULT '0', INDEX `message_uid_index` (`_mid` DESC) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; ================================================ FILE: broker/migrate/重要!!!必看!!!.txt ================================================ 程序会自动创建数据库和执行migrate里的数据库,不需要手动创建库和执行sql语句。 数据库版本管理使用了flyway,flyway进行数据库升级时会校验数据库脚本的有效性,如果修改过这里的脚本,下次升级时就会失败。 强烈不建议修改数据库表结构,如果有内容(比如默认用户或者默认机器人的属性)需要修改,可以等数据库升级完成后,通过命令行或者数据库客户端进行修改。 由于服务具有缓存,一般修改过数据库内容后要重启后才能生效。 ================================================ FILE: broker/nginx/imserver.conf ================================================ upstream imserver { server 127.0.0.1:8080; #Apache } server { listen 80; server_name www.wildfirechat.cn; root html; index index.html index.htm index.php; #同步服务设置 location /route { proxy_set_header Host $host; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://imserver; } #客户端短连接业务 location /im { proxy_set_header Host $host; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://imserver; } #版本检查/api/version,可以删掉 location /api { proxy_pass http://imserver; } #内置文件上传和下载 location /fs { client_max_body_size 200M; proxy_set_header Host $host; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://imserver; } #机器人API location /robot { proxy_set_header Host $host; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://imserver; } #频道API location /channel { proxy_set_header Host $host; proxy_set_header X-real-ip $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://imserver; } } ================================================ FILE: broker/pom.xml ================================================ 4.0.0 ../ wildfirechat-parent cn.wildfirechat 1.4.5 moquette-broker jar Moquette - broker UTF-8 io.moquette.moquette-broker cn.wildfirechat common ${project.version} org.apache.logging.log4j log4j-core 2.17.2 org.apache.logging.log4j log4j-api 2.17.2 org.apache.logging.log4j log4j-slf4j2-impl 2.22.1 org.slf4j slf4j-api 2.0.12 com.lmax disruptor 3.4.1 mysql mysql-connector-java 8.0.28 com.googlecode.json-simple json-simple 1.1.1 junit junit 4.13.2 com.google.protobuf protobuf-java 3.25.3 io.netty netty-common ${netty.version} io.netty netty-buffer ${netty.version} io.netty netty-transport ${netty.version} io.netty netty-handler ${netty.version} org.apache.httpcomponents httpclient 4.5.13 org.apache.httpcomponents httpcore 4.4.1 io.netty netty-codec-http ${netty.version} io.netty netty-transport-native-epoll ${netty.version} linux-x86_64 commons-codec commons-codec 1.13 com.hazelcast hazelcast 3.11.5 cn.hutool hutool-all 5.8.26 com.mchange c3p0 0.9.5.4 org.fusesource.mqtt-client mqtt-client 1.12 org.eclipse.paho org.eclipse.paho.client.mqttv3 1.2.2 com.qiniu qiniu-java-sdk 7.1.3 commons-io commons-io 2.7 com.h2database h2 1.4.197 runtime com.squareup.okhttp3 okhttp 4.12.0 org.flywaydb flyway-core 5.2.4 org.mongodb mongo-java-driver 3.4.1 org.apache.tika tika-core 2.4.1 pl.project13.maven git-commit-id-plugin 2.1.5 revision yyyyMMddHHmmss true ${project.basedir}/.git false true config/git.properties false false false 7 -dirty false ================================================ FILE: broker/src/main/java/cn/wildfirechat/push/PushMessage.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.push; public class PushMessage { public String sender; public String senderName; public String senderPortrait; public int convType; public String target; public String targetName; public String targetPortrait; public String userId; public int line; public int cntType; public long serverTime; //消息的类型,普通消息通知栏;voip要透传。 public int pushMessageType; //推送类型,android推送分为小米/华为/魅族等。ios分别为开发和发布。 public int pushType; public String pushContent; public String pushData; public int unReceivedMsg; public int mentionedType; public String packageName; public String deviceToken; public String voipDeviceToken; public boolean isHiddenDetail; public String language; public boolean republish; public long messageId; public long callStartUid; public int existBadgeNumber; public PushMessage(String sender, int conversationType, String target, int line, int messageContentType, long serverTime, String senderName, String senderPortrait, String targetName, String targetPortrait, int unReceivedMsg, int mentionedType, boolean isHiddenDetail, String language) { this.sender = sender; this.convType = conversationType; this.target = target; this.senderName = senderName; this.senderPortrait = senderPortrait; this.targetName = targetName; this.targetPortrait = targetPortrait; this.line = line; this.cntType = messageContentType; this.serverTime = serverTime; this.unReceivedMsg = unReceivedMsg; if (cntType == 400 || cntType == 406) { this.pushMessageType = PushServer.PushMessageType.PUSH_MESSAGE_TYPE_VOIP_INVITE; } else if(cntType == 402) { this.pushMessageType = PushServer.PushMessageType.PUSH_MESSAGE_TYPE_VOIP_BYE; } else if(cntType == 401) { this.pushMessageType = PushServer.PushMessageType.PUSH_MESSAGE_TYPE_VOIP_ANSWER; } else if(cntType == 80) { this.pushMessageType = PushServer.PushMessageType.PUSH_MESSAGE_TYPE_RECALLED; } else if(cntType == 81) { this.pushMessageType = PushServer.PushMessageType.PUSH_MESSAGE_TYPE_DELETED; } else { this.pushMessageType = PushServer.PushMessageType.PUSH_MESSAGE_TYPE_NORMAL; } this.mentionedType = mentionedType; this.isHiddenDetail = isHiddenDetail; this.language = language; this.republish = messageContentType == 80 || messageContentType == 81; } public PushMessage(String sender, String target, long serverTime, String senderName, int unReceivedMsg, String language, int pushMessageType) { this.sender = sender; this.target = target; this.senderName = senderName; this.serverTime = serverTime; this.unReceivedMsg = unReceivedMsg; this.pushMessageType = pushMessageType; this.language = language; } } ================================================ FILE: broker/src/main/java/cn/wildfirechat/push/PushServer.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.push; import cn.wildfirechat.common.IMExceptionEvent; import cn.wildfirechat.proto.ProtoConstants; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import io.moquette.persistence.MemorySessionStore; import io.moquette.server.config.IConfig; import io.moquette.spi.ISessionsStore; import io.netty.util.internal.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.HttpUtils; import win.liyufan.im.Utility; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import static io.moquette.BrokerConstants.*; import static win.liyufan.im.HttpUtils.HttpPostType.POST_TYPE_Push; public class PushServer { private static final Logger LOG = LoggerFactory.getLogger(PushServer.class); protected static final Gson gson = new GsonBuilder().disableHtmlEscaping().create(); public interface PushMessageType { int PUSH_MESSAGE_TYPE_NORMAL = 0; int PUSH_MESSAGE_TYPE_VOIP_INVITE = 1; int PUSH_MESSAGE_TYPE_VOIP_BYE = 2; int PUSH_MESSAGE_TYPE_FRIEND_REQUEST = 3; int PUSH_MESSAGE_TYPE_VOIP_ANSWER = 4; int PUSH_MESSAGE_TYPE_RECALLED = 5; int PUSH_MESSAGE_TYPE_DELETED = 6; } private static PushServer INSTANCE = new PushServer(); private ISessionsStore sessionsStore; private static ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()*5); private String androidPushServerUrl; private String iOSPushServerUrl; private String harmonyPushServerUrl; private PushServer() { } public static PushServer getServer() { return INSTANCE; } public void init(IConfig config, ISessionsStore sessionsStore) { this.sessionsStore = sessionsStore; this.androidPushServerUrl = config.getProperty(PUSH_ANDROID_SERVER_ADDRESS); this.iOSPushServerUrl = config.getProperty(PUSH_IOS_SERVER_ADDRESS); this.harmonyPushServerUrl = config.getProperty(PUSH_HARMONY_SERVER_ADDRESS); } public void pushMessage(PushMessage pushMessage, String deviceId, String pushContent) { LOG.info("try to delivery push diviceId = {}, conversationType = {}, pushContent = {}", deviceId, pushMessage.convType, pushContent); executorService.execute(() ->{ try { pushMessageInternel(pushMessage, deviceId, pushContent); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, IMExceptionEvent.EventType.PUSH_SERVER_Exception); } }); } private void pushMessageInternel(PushMessage pushMessage, String deviceId, String pushContent) { if (pushMessage.pushMessageType == PushMessageType.PUSH_MESSAGE_TYPE_NORMAL && StringUtil.isNullOrEmpty(pushContent)) { LOG.info("push content empty, deviceId {}", deviceId); return; } MemorySessionStore.Session session = sessionsStore.getSession(deviceId); if (StringUtil.isNullOrEmpty(session.getDeviceToken())) { LOG.warn("Device token is empty for device {}", deviceId); return; } pushMessage.packageName = session.getAppName(); pushMessage.pushType = session.getPushType(); pushMessage.pushContent = pushContent; pushMessage.deviceToken = session.getDeviceToken(); pushMessage.userId = session.getUsername(); if (session.getPlatform() == ProtoConstants.Platform.Platform_iOS || session.getPlatform() == ProtoConstants.Platform.Platform_iPad || session.getPlatform() == ProtoConstants.Platform.Platform_Android || session.getPlatform() == ProtoConstants.Platform.Platform_APad || session.getPlatform() == ProtoConstants.Platform.Platform_Harmony || session.getPlatform() == ProtoConstants.Platform.Platform_HarmonyPad || session.getPlatform() == ProtoConstants.Platform.Platform_AppleTV || session.getPlatform() == ProtoConstants.Platform.Platform_AndroidTV || session.getPlatform() == ProtoConstants.Platform.Platform_HarmonyTV || session.getPlatform() == ProtoConstants.Platform.Platform_HarmonyWearable || session.getPlatform() == ProtoConstants.Platform.Platform_AndroidWearable ) { String url = androidPushServerUrl; if (session.getPlatform() == ProtoConstants.Platform.Platform_iOS || session.getPlatform() == ProtoConstants.Platform.Platform_iPad || session.getPlatform() == ProtoConstants.Platform.Platform_AppleTV) { url = iOSPushServerUrl; pushMessage.voipDeviceToken = session.getVoipDeviceToken(); } else if (session.getPlatform() == ProtoConstants.Platform.Platform_Harmony || session.getPlatform() == ProtoConstants.Platform.Platform_HarmonyPad || session.getPlatform() == ProtoConstants.Platform.Platform_HarmonyWearable || session.getPlatform() == ProtoConstants.Platform.Platform_HarmonyTV) { url = harmonyPushServerUrl; } HttpUtils.httpJsonPost(url, gson.toJson(pushMessage, pushMessage.getClass()), POST_TYPE_Push); } else { LOG.info("Not mobile platform {}", session.getPlatform()); } } } ================================================ FILE: broker/src/main/java/cn/wildfirechat/server/Server.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.server; import java.io.IOException; public class Server { public static void main(String[] args) throws IOException { io.moquette.server.Server.start(args); } } ================================================ FILE: broker/src/main/java/cn/wildfirechat/server/ThreadPoolExecutorWrapper.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.server; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.atomic.AtomicInteger; public class ThreadPoolExecutorWrapper { private static final Logger LOG = LoggerFactory.getLogger(ThreadPoolExecutorWrapper.class); private final ScheduledExecutorService executor; private final int count; private final AtomicInteger runCounter; private final String name; public ThreadPoolExecutorWrapper(ScheduledExecutorService executor, int count, String name) { this.executor = executor; this.count = count; this.runCounter = new AtomicInteger(); this.name = name; } public void execute(Runnable task) { int startCount = runCounter.incrementAndGet(); LOG.debug("Submit task and current task count {}", startCount); final long startTime = System.currentTimeMillis(); executor.execute(() -> { try { task.run(); } catch (Exception e) { e.printStackTrace(); LOG.info("execute error = {}", e.toString()); } finally { int endCount = runCounter.decrementAndGet(); LOG.debug("Finish task and current task count {} use time {}", endCount, System.currentTimeMillis()-startTime); } }); } public void shutdown() { executor.shutdown(); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/LoFileServer.java ================================================ package com.xiaoleilu.loServer; import cn.hutool.core.date.DateUtil; import com.xiaoleilu.loServer.action.Action; import com.xiaoleilu.loServer.action.ClassUtil; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.ActionHandler; import com.xiaoleilu.loServer.handler.HttpFileServerHandler; import io.moquette.spi.IMessagesStore; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.codec.http.HttpObjectAggregator; import io.netty.handler.codec.http.HttpRequestDecoder; import io.netty.handler.codec.http.HttpResponseEncoder; import io.netty.handler.codec.http.HttpServerCodec; import io.netty.handler.stream.ChunkedWriteHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; /** * LoServer starter
* 用于启动服务器的主对象
* 使用LoServer.start()启动服务器
* 服务的Action类和端口等设置在ServerSetting中设置 * @author Looly * */ public class LoFileServer { private static final org.slf4j.Logger Logger = LoggerFactory.getLogger(LoFileServer.class); private int port; private IMessagesStore messagesStore; private Channel channel; public LoFileServer(int port, IMessagesStore messagesStore) { this.port = port; this.messagesStore = messagesStore; } /** * 启动服务 * @throws InterruptedException */ public void start() throws InterruptedException { long start = System.currentTimeMillis(); // Configure the server. final EventLoopGroup bossGroup = new NioEventLoopGroup(1); final EventLoopGroup workerGroup = new NioEventLoopGroup(); try { final ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .option(ChannelOption.SO_BACKLOG, 1024) // 服务端可连接队列大小 .option(ChannelOption.SO_KEEPALIVE, true) .option(ChannelOption.SO_REUSEADDR, true) .option(ChannelOption.TCP_NODELAY, true) .option(ChannelOption.SO_SNDBUF, 1024*1024*10) .option(ChannelOption.SO_RCVBUF, 1024*1024*10) .childHandler(new ChannelInitializer() { @Override protected void initChannel(SocketChannel socketChannel) throws Exception { socketChannel.pipeline().addLast(new HttpRequestDecoder()); socketChannel.pipeline().addLast(new HttpResponseEncoder()); socketChannel.pipeline().addLast(new ChunkedWriteHandler()); socketChannel.pipeline().addLast(new HttpObjectAggregator(100 * 1024 * 1024)); socketChannel.pipeline().addLast(new HttpFileServerHandler()); } }); channel = b.bind(port).sync().channel(); Logger.info("***** Welcome To LoServer on port [{}], startting spend {}ms *****", port, DateUtil.spendMs(start)); } catch (Exception e) { e.printStackTrace(); Logger.error("端口 {} 已经被占用。请检查该端口被那个程序占用,找到程序停掉。\n查找端口被那个程序占用的命令是: netstat -tunlp | grep {}", port, port); System.out.println("端口 " + port + " 已经被占用。请检查该端口被那个程序占用,找到程序停掉。\n查找端口被那个程序占用的命令是: netstat -tunlp | grep " + port); System.exit(-1); } } public void shutdown() { if (this.channel != null) { this.channel.close(); try { this.channel.closeFuture().sync(); } catch (InterruptedException e) { e.printStackTrace(); } } } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/LoServer.java ================================================ package com.xiaoleilu.loServer; import cn.hutool.core.date.DateUtil; import com.xiaoleilu.loServer.action.Action; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.AdminActionHandler; import com.xiaoleilu.loServer.handler.IMActionHandler; import io.moquette.spi.IMessagesStore; import io.moquette.spi.ISessionsStore; import io.netty.bootstrap.ServerBootstrap; import io.netty.channel.Channel; import io.netty.channel.ChannelInitializer; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.codec.http.HttpObjectAggregator; import io.netty.handler.codec.http.HttpRequestDecoder; import io.netty.handler.codec.http.HttpResponseEncoder; import io.netty.handler.stream.ChunkedWriteHandler; import com.xiaoleilu.loServer.action.ClassUtil; import org.slf4j.LoggerFactory; import win.liyufan.im.Utility; import java.io.IOException; /** * LoServer starter
* 用于启动服务器的主对象
* 使用LoServer.start()启动服务器
* 服务的Action类和端口等设置在ServerSetting中设置 * @author Looly * */ public class LoServer { private static final org.slf4j.Logger Logger = LoggerFactory.getLogger(LoServer.class); private int port; private int adminPort; private IMessagesStore messagesStore; private ISessionsStore sessionsStore; private Channel channel; private Channel adminChannel; public LoServer(int port, int adminPort, IMessagesStore messagesStore, ISessionsStore sessionsStore) { this.port = port; this.adminPort = adminPort; this.messagesStore = messagesStore; this.sessionsStore = sessionsStore; } /** * 启动服务 * @throws InterruptedException */ public void start() throws InterruptedException { long start = System.currentTimeMillis(); // Configure the server. final EventLoopGroup bossGroup = new NioEventLoopGroup(2); final EventLoopGroup workerGroup = new NioEventLoopGroup(); registerAllAction(); int bindingPort = port; try { final ServerBootstrap b = new ServerBootstrap(); final ServerBootstrap adminB = new ServerBootstrap(); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .option(ChannelOption.SO_BACKLOG, 10240) // 服务端可连接队列大小 .childOption(ChannelOption.SO_KEEPALIVE, true) .option(ChannelOption.SO_REUSEADDR, true) .childOption(ChannelOption.TCP_NODELAY, true) .childOption(ChannelOption.SO_SNDBUF, 1024*64) .childOption(ChannelOption.SO_RCVBUF, 1024*64) .childHandler(new ChannelInitializer() { @Override protected void initChannel(SocketChannel socketChannel) throws Exception { socketChannel.pipeline().addLast(new HttpRequestDecoder()); socketChannel.pipeline().addLast(new HttpResponseEncoder()); socketChannel.pipeline().addLast(new ChunkedWriteHandler()); socketChannel.pipeline().addLast(new HttpObjectAggregator(100 * 1024 * 1024)); socketChannel.pipeline().addLast(new IMActionHandler(messagesStore, sessionsStore)); } }); channel = b.bind(port).sync().channel(); bindingPort = adminPort; adminB.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .option(ChannelOption.SO_BACKLOG, 10240) // 服务端可连接队列大小 .childOption(ChannelOption.SO_KEEPALIVE, true) .option(ChannelOption.SO_REUSEADDR, true) .childOption(ChannelOption.TCP_NODELAY, true) .childOption(ChannelOption.SO_SNDBUF, 1024*64) .childOption(ChannelOption.SO_RCVBUF, 1024*64) .childHandler(new ChannelInitializer() { @Override protected void initChannel(SocketChannel socketChannel) throws Exception { socketChannel.pipeline().addLast(new HttpRequestDecoder()); socketChannel.pipeline().addLast(new HttpResponseEncoder()); socketChannel.pipeline().addLast(new ChunkedWriteHandler()); socketChannel.pipeline().addLast(new HttpObjectAggregator(100 * 1024 * 1024)); socketChannel.pipeline().addLast(new AdminActionHandler(messagesStore, sessionsStore)); } }); adminChannel = adminB.bind(adminPort).sync().channel(); Logger.info("***** Welcome To LoServer on port [{},{}], startting spend {}ms *****", port, adminPort, DateUtil.spendMs(start)); } catch (Exception e) { e.printStackTrace(); Logger.error("端口 {} 已经被占用。请检查该端口被那个程序占用,找到程序停掉。\n查找端口被那个程序占用的命令是: netstat -tunlp | grep {}", bindingPort, bindingPort); System.out.println("端口 " + bindingPort + " 已经被占用。请检查该端口被那个程序占用,找到程序停掉。\n查找端口被那个程序占用的命令是: netstat -tunlp | grep " + bindingPort); System.exit(-1); } } public void shutdown() { if (this.channel!= null) { this.channel.close(); try { this.channel.closeFuture().sync(); } catch (InterruptedException e) { e.printStackTrace(); } } if (this.adminChannel != null) { this.adminChannel.close(); try { this.adminChannel.closeFuture().sync(); } catch (InterruptedException e) { e.printStackTrace(); } } } private void registerAllAction() { try { for (Class cls:ClassUtil.getAllAssignedClass(Action.class) ) { if(cls.getAnnotation(Route.class) != null) { ServerSetting.setAction((Class)cls); } } } catch (IOException e) { e.printStackTrace(); Utility.printExecption(Logger, e); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/RestResult.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer; import cn.wildfirechat.common.ErrorCode; public class RestResult { int code; String msg; Object result; public static RestResult ok(Object object) { return resultOf(ErrorCode.ERROR_CODE_SUCCESS, ErrorCode.ERROR_CODE_SUCCESS.getMsg(), object); } public static RestResult ok() { return resultOf(ErrorCode.ERROR_CODE_SUCCESS, ErrorCode.ERROR_CODE_SUCCESS.getMsg(), null); } public static RestResult resultOf(ErrorCode errorCode) { return resultOf(errorCode, errorCode.msg, null); } public static RestResult resultOf(ErrorCode errorCode, String msg) { return resultOf(errorCode, msg, null); } public static RestResult resultOf(ErrorCode errorCode, String msg, Object object) { RestResult result = new RestResult(); result.code = errorCode.code; result.msg = msg; result.result = object; return result; } public void setErrorCode(ErrorCode errorCode) { setCode(errorCode.code); } public int getCode() { return code; } public void setCode(int code) { this.code = code; } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public Object getResult() { return result; } public void setResult(Object result) { this.result = result; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/ServerSetting.java ================================================ package com.xiaoleilu.loServer; import java.io.File; import java.nio.charset.Charset; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import cn.hutool.core.io.FileUtil; import cn.hutool.core.lang.Singleton; import cn.hutool.core.util.StrUtil; import com.xiaoleilu.loServer.action.Action; import com.xiaoleilu.loServer.action.DefaultIndexAction; import com.xiaoleilu.loServer.action.UnknownErrorAction; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.exception.ServerSettingException; import com.xiaoleilu.loServer.filter.Filter; import org.slf4j.LoggerFactory; /** * 全局设定文件 * @author xiaoleilu * */ public class ServerSetting { private static final org.slf4j.Logger Logger = LoggerFactory.getLogger(ServerSetting.class); //-------------------------------------------------------- Default value start /** 默认的字符集编码 */ public final static String DEFAULT_CHARSET = "utf-8"; public final static String MAPPING_ALL = "/*"; public final static String MAPPING_ERROR = "/_error"; //-------------------------------------------------------- Default value end /** 字符编码 */ private static String charset = DEFAULT_CHARSET; /** 端口 */ private static int port = 8090; /** 根目录 */ private static File root; /** Filter映射表 */ private static Map filterMap = new ConcurrentHashMap<>(); /** Action映射表 */ private static Map> getActionMap = new ConcurrentHashMap<>(); private static Map> postActionMap = new ConcurrentHashMap<>(); private static Map> putActionMap = new ConcurrentHashMap<>(); private static Map> deleteActionMap = new ConcurrentHashMap<>(); private static Map> errorActionMap = new ConcurrentHashMap<>(); static{ errorActionMap.put(StrUtil.SLASH, DefaultIndexAction.class); errorActionMap.put(MAPPING_ERROR, UnknownErrorAction.class); } /** * @return 获取编码 */ public static String getCharset() { return charset; } /** * @return 字符集 */ public static Charset charset() { return Charset.forName(getCharset()); } /** * 设置编码 * @param charset 编码 */ public static void setCharset(String charset) { ServerSetting.charset = charset; } /** * @return 监听端口 */ public static int getPort() { return port; } /** * 设置监听端口 * @param port 端口 */ public static void setPort(int port) { ServerSetting.port = port; } //----------------------------------------------------------------------------------------------- Root start /** * @return 根目录 */ public static File getRoot() { return root; } /** * @return 根目录 */ public static boolean isRootAvailable() { if(root != null && root.isDirectory() && root.isHidden() == false && root.canRead()){ return true; } return false; } /** * @return 根目录 */ public static String getRootPath() { return FileUtil.getAbsolutePath(root); } /** * 根目录 * @param root 根目录绝对路径 */ public static void setRoot(String root) { ServerSetting.root = FileUtil.mkdir(root); Logger.debug("Set root to [{}]", ServerSetting.root.getAbsolutePath()); } /** * 根目录 * @param root 根目录绝对路径 */ public static void setRoot(File root) { if(root.exists() == false){ root.mkdirs(); }else if(root.isDirectory() == false){ throw new ServerSettingException(StrUtil.format("{} is not a directory!", root.getPath())); } ServerSetting.root = root; } //----------------------------------------------------------------------------------------------- Root end //----------------------------------------------------------------------------------------------- Filter start /** * @return 获取FilterMap */ public static Map getFilterMap() { return filterMap; } /** * 获得路径对应的Filter * @param path 路径,为空时将获得 根目录对应的Action * @return Filter */ public static Filter getFilter(String path){ if(StrUtil.isBlank(path)){ path = StrUtil.SLASH; } return getFilterMap().get(path.trim()); } /** * 设置FilterMap * @param filterMap FilterMap */ public static void setFilterMap(Map filterMap) { ServerSetting.filterMap = filterMap; } /** * 设置Filter类,已有的Filter类将被覆盖 * @param path 拦截路径(必须以"/"开头) * @param filter Action类 */ public static void setFilter(String path, Filter filter) { if(StrUtil.isBlank(path)){ path = StrUtil.SLASH; } if(null == filter) { Logger.warn("Added blank action, pass it."); return; } //所有路径必须以 "/" 开头,如果没有则补全之 if(false == path.startsWith(StrUtil.SLASH)) { path = StrUtil.SLASH + path; } ServerSetting.filterMap.put(path, filter); } /** * 设置Filter类,已有的Filter类将被覆盖 * @param path 拦截路径(必须以"/"开头) * @param filterClass Filter类 */ public static void setFilter(String path, Class filterClass) { setFilter(path, (Filter) Singleton.get(filterClass)); } //----------------------------------------------------------------------------------------------- Filter end //----------------------------------------------------------------------------------------------- Action start /** * @return 获取ActionMap */ public static Map> getActionMap(String method) { if (method.equals("GET")) { return getActionMap; } else if(method.equals("POST")) { return postActionMap; } else if(method.equals("PUT")) { return putActionMap; } else if(method.equals("DELETE")) { return deleteActionMap; } return getActionMap; } public static Action getErrorAction(String path) { Class cls = errorActionMap.get(path); if(cls != null) { try { return cls.newInstance(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } return null; } /** * 获得路径对应的Action * @param path 路径,为空时将获得 根目录对应的Action * @return Action */ public static Action getAction(String path, String method){ if(StrUtil.isBlank(path)){ path = StrUtil.SLASH; } Class cls = getActionMap(method).get(path.trim()); if(cls != null) { try { return cls.newInstance(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } return null; } /** * 增加Action类,已有的Action类将被覆盖
* 所有Action都是以单例模式存在的! * @param path 拦截路径(必须以"/"开头) * @param actionClass Action类 */ public static void setAction(String path, Class actionClass) { if(StrUtil.isBlank(path)){ path = StrUtil.SLASH; } if(null == actionClass) { Logger.warn("Added blank action, pass it."); return; } //所有路径必须以 "/" 开头,如果没有则补全之 if(false == path.startsWith(StrUtil.SLASH)) { path = StrUtil.SLASH + path; } String method = "GET"; HttpMethod methodAnnotation = actionClass.getAnnotation(HttpMethod.class); if (methodAnnotation != null) { method = methodAnnotation.value(); } ServerSetting.getActionMap(method).put(path, actionClass); } /** * 增加Action类,已有的Action类将被覆盖
* 所有Action都是以单例模式存在的! * @param actionClass 带注解的Action类 */ public static void setAction(Class actionClass) { final Route route = actionClass.getAnnotation(Route.class); if(route != null){ final String path = route.value(); if(StrUtil.isNotBlank(path)){ setAction(path, actionClass); return; } } throw new ServerSettingException("Can not find Route annotation,please add annotation to Action class!"); } //----------------------------------------------------------------------------------------------- Action start } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/Action.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action; import cn.wildfirechat.common.IMExceptionEvent; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonSyntaxException; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.action.channel.ChannelAction; import com.xiaoleilu.loServer.action.robot.RobotAction; import com.xiaoleilu.loServer.annotation.RequireAuthentication; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.server.config.IConfig; import io.moquette.spi.IMessagesStore; import io.moquette.spi.ISessionsStore; import io.moquette.spi.impl.Utils; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import cn.wildfirechat.common.ErrorCode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.RateLimiter; import win.liyufan.im.Utility; import java.nio.charset.StandardCharsets; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; import static io.moquette.BrokerConstants.*; /** * 请求处理接口
* 当用户请求某个Path,则调用相应Action的doAction方法 * @author Looly * */ abstract public class Action { private static final Logger LOG = LoggerFactory.getLogger(Action.class); public static IMessagesStore messagesStore = null; public static ISessionsStore sessionsStore = null; protected static final Gson gson = new GsonBuilder().disableHtmlEscaping().create(); public ChannelHandlerContext ctx; protected static RateLimiter adminLimiter = null; protected static RateLimiter robotLimiter = null; protected static RateLimiter channelLimiter = null; protected static boolean closeApiVersion = false; public static void init(IConfig config) { int adminRate = 10000; int robotRate = 1000; int channelRate = 1000; try { adminRate = Integer.parseInt(config.getProperty(HTTP_ADMIN_RATE_LIMIT, "10000")); } catch (NumberFormatException e) { } try { robotRate = Integer.parseInt(config.getProperty(HTTP_ROBOT_RATE_LIMIT, "1000")); } catch (NumberFormatException e) { } try { channelRate = Integer.parseInt(config.getProperty(HTTP_CHANNEL_RATE_LIMIT, "1000")); } catch (NumberFormatException e) { } adminLimiter = new RateLimiter(10, adminRate); robotLimiter = new RateLimiter(10, robotRate); channelLimiter = new RateLimiter(10, channelRate); try { closeApiVersion = Boolean.parseBoolean(config.getProperty(HTTP_CLOSE_API_VERSION, "false")); } catch (Exception e) { } } protected class Result { Object data; ErrorCode errorCode; public Result(ErrorCode errorCode) { this.errorCode = errorCode; } public Result(ErrorCode errorCode, Object data) { this.data = data; this.errorCode = errorCode; } public Object getData() { return data; } public ErrorCode getErrorCode() { return errorCode; } } protected interface ApiCallback { Result onResult(byte[] response); } public ErrorCode preAction(Request request, Response response) { if (getClass().getAnnotation(RequireAuthentication.class) != null) { //do authentication } return ERROR_CODE_SUCCESS; } public boolean doAction(Request request, Response response) { ErrorCode errorCode = preAction(request, response); boolean isSync = true; if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { //事务逻辑有缺陷,先注释掉 // if (isTransactionAction() && !(this instanceof IMAction)) { // DBUtil.beginTransaction(); // try { // action(request, response); // DBUtil.commit(); // } catch (Exception e) { // e.printStackTrace(); // DBUtil.roolback(); // throw e; // } // } else { isSync = action(request, response); // } } else { response.setStatus(HttpResponseStatus.OK); if (errorCode == null) { errorCode = ErrorCode.ERROR_CODE_SUCCESS; } RestResult result = RestResult.resultOf(errorCode, errorCode.getMsg(), RestResult.resultOf(errorCode)); response.setContent(gson.toJson(result)); response.send(); } return isSync; } public boolean isTransactionAction() { return false; } abstract public boolean action(Request request, Response response); protected T getRequestBody(HttpRequest request, Class cls) { if (request instanceof FullHttpRequest) { FullHttpRequest fullHttpRequest = (FullHttpRequest) request; byte[] bytes = Utils.readBytesAndRewind(fullHttpRequest.content()); String content = new String(bytes, StandardCharsets.UTF_8);//contribute by JiaRG from github try { T t = gson.fromJson(content, cls); return t; } catch (JsonSyntaxException e) { e.printStackTrace(); LOG.error("Object {} from json {} failure", cls.getName(), content); int exception = IMExceptionEvent.EventType.ADMIN_API_Exception; if (this instanceof RobotAction) { exception = IMExceptionEvent.EventType.ROBOT_API_Exception; } else if (this instanceof ChannelAction) { exception = IMExceptionEvent.EventType.CHANNEL_API_Exception; } Utility.printExecption(LOG, e, exception); throw new RuntimeException(e); } } return null; } protected void setResponseContent(RestResult result, Response response) { response.setStatus(HttpResponseStatus.OK); response.setContent(gson.toJson(result)); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/CheckTokenAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action; import com.google.gson.Gson; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.MemorySessionStore; import io.moquette.spi.security.Tokenor; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import win.liyufan.im.GitRepositoryState; import win.liyufan.im.RateLimiter; import win.liyufan.im.Utility; import java.io.IOException; @Route("/api/verify_token") @HttpMethod("GET") public class CheckTokenAction extends Action { private final RateLimiter mLimitCounter = new RateLimiter(10, 1); @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { if(closeApiVersion) { response.sendError(HttpResponseStatus.NOT_FOUND, "404 Not found!"); return true; } response.setStatus(HttpResponseStatus.OK); String userId = request.getParam("userId"); String clientId = request.getParam("clientId"); String token = request.getParam("token"); String result = "这是个检查token有效性的接口,如果客户端无法连接成功,可以使用这个接口检查token是否正确。\n"; result += "使用方法是在浏览器中输入http://imserverip/api/verify_token?userId=${userId}&clientId=${clientId}&token=${token}。\n"; result += "例如:http://localhost/api/verify_token?userId=123&clientId=456&token=789。\n"; result += "特别注意的是:必须使用正确的clientId,clientId必须是在测试手机上调用im接口获取。不用手机上获取到的clientId也都是不同的,一定不能用错!!!\n\n\n"; if (StringUtil.isNullOrEmpty(userId)) { result += "错误,userId为空"; } else if (StringUtil.isNullOrEmpty(clientId)) { result += "错误,clientId为空"; } else if (StringUtil.isNullOrEmpty(token)) { result += "错误,token为空"; } else if(!mLimitCounter.isGranted("verify_token")) { result += "接口请求超频!接口限制每10秒只能验证一次!"; } else { MemorySessionStore.Session session = sessionsStore.getSession(clientId); if (session == null) { result += "错误,session不存在。请确认token是从本服务通过getToken接口获取的,另外请确认clientId是否正确"; } else if (session.getDeleted() == 1) { result += "错误,session已经被清除,请确认当前客户没有多端登录或者主动退出"; } else if(!session.getUsername().equals(userId)) { result += "错误,当前客户端的登录用户不是" + userId + "。这一般发生在当前clientId又为其它用户获取过token"; } else { String id = Tokenor.getUserId(token.getBytes()); if (id == null) { result += "错误,无效的token"; } else if(!id.equals(userId)) { result += "错误,改token是用户" + id + "的"; } else { result += "恭喜,您的信息是正确的"; } } } response.setContent(result); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/ClassUtil.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action; import java.io.File; import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; public class ClassUtil { /** * 获取同一路径下所有子类或接口实现类 * * @param cls * @return * @throws IOException * @throws ClassNotFoundException */ public static List> getAllAssignedClass(Class cls) throws IOException, ClassNotFoundException { List> classes = new ArrayList>(); for (Class c : getClasses(cls)) { if (cls.isAssignableFrom(c) && !cls.equals(c)) { classes.add(c); } } return classes; } /** * 取得当前类路径下的所有类 * * @param cls * @return * @throws IOException * @throws ClassNotFoundException */ public static List> getClasses(Class cls) throws IOException, ClassNotFoundException { String pk = cls.getPackage().getName(); // String path = pk.replace('.', '/'); // ClassLoader classloader = Thread.currentThread().getContextClassLoader(); // URL url = classloader.getResource(path); // String type = url.getProtocol(); // // System.out.println("the type is " + type); // System.out.println(url.getPath()); // // return getClasses(new File(url.getFile()), pk); List classNames = getClassName(pk, true); List> classes = new ArrayList<>(); for (String className : classNames) { if (className.endsWith(".class")) { className = className.substring(0, className.length() - 6); className = className.substring(className.lastIndexOf("/")+1, className.length()); } classes.add(Class.forName(className)); } return classes; } /** * 迭代查找类 * * @param dir * @param pk * @return * @throws ClassNotFoundException */ private static List> getClasses(File dir, String pk) throws ClassNotFoundException { System.out.println(dir.getAbsolutePath()); List> classes = new ArrayList>(); if (!dir.exists()) { return classes; } for (File f : dir.listFiles()) { if (f.isDirectory()) { classes.addAll(getClasses(f, pk + "." + f.getName())); } String name = f.getName(); if (name.endsWith(".class")) { classes.add(Class.forName(pk + "." + name.substring(0, name.length() - 6))); } } return classes; } /** * 获取某包下所有类 * @param packageName 包名 * @param childPackage 是否遍历子包 * @return 类的完整名称 */ public static List getClassName(String packageName, boolean childPackage) { List fileNames = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); String packagePath = packageName.replace(".", "/"); URL url = loader.getResource(packagePath); if (url != null) { String type = url.getProtocol(); if (type.equals("file")) { fileNames = getClassNameByFile(url.getPath(), null, childPackage); } else if (type.equals("jar")) { fileNames = getClassNameByJar(url.getPath(), childPackage); } } else { fileNames = getClassNameByJars(((URLClassLoader) loader).getURLs(), packagePath, childPackage); } return fileNames; } /** * 从项目文件获取某包下所有类 * @param filePath 文件路径 * @param className 类名集合 * @param childPackage 是否遍历子包 * @return 类的完整名称 */ private static List getClassNameByFile(String filePath, List className, boolean childPackage) { List myClassName = new ArrayList(); File file = new File(filePath); File[] childFiles = file.listFiles(); for (File childFile : childFiles) { if (childFile.isDirectory()) { if (childPackage) { myClassName.addAll(getClassNameByFile(childFile.getPath(), myClassName, childPackage)); } } else { String childFilePath = childFile.getPath(); if (childFilePath.endsWith(".class")) { if (childFilePath.indexOf("\\classes") >= 0 || childFilePath.indexOf("/classes") >= 0) { int start = childFilePath.indexOf("\\classes"); if (start == -1) { start = childFilePath.indexOf("/classes"); } childFilePath = childFilePath.substring(start + 9, childFilePath.lastIndexOf(".")); } childFilePath = childFilePath.replace("\\", "."); childFilePath = childFilePath.replace("/", "."); myClassName.add(childFilePath); } } } return myClassName; } /** * 从jar获取某包下所有类 * @param jarPath jar文件路径 * @param childPackage 是否遍历子包 * @return 类的完整名称 */ private static List getClassNameByJar(String jarPath, boolean childPackage) { List myClassName = new ArrayList(); String[] jarInfo = jarPath.split("!"); String jarFilePath = jarInfo[0].substring(jarInfo[0].indexOf("/")); String packagePath = jarInfo[1].substring(1); try { JarFile jarFile = new JarFile(jarFilePath); Enumeration entrys = jarFile.entries(); while (entrys.hasMoreElements()) { JarEntry jarEntry = entrys.nextElement(); String entryName = jarEntry.getName(); if (entryName.endsWith(".class")) { if (childPackage) { if (entryName.startsWith(packagePath)) { entryName = entryName.replace("/", ".").substring(0, entryName.lastIndexOf(".")); myClassName.add(entryName); } } else { int index = entryName.lastIndexOf("/"); String myPackagePath; if (index != -1) { myPackagePath = entryName.substring(0, index); } else { myPackagePath = entryName; } if (myPackagePath.equals(packagePath)) { entryName = entryName.replace("/", ".").substring(0, entryName.lastIndexOf(".")); myClassName.add(entryName); } } } } } catch (Exception e) { e.printStackTrace(); } return myClassName; } /** * 从所有jar中搜索该包,并获取该包下所有类 * @param urls URL集合 * @param packagePath 包路径 * @param childPackage 是否遍历子包 * @return 类的完整名称 */ private static List getClassNameByJars(URL[] urls, String packagePath, boolean childPackage) { List myClassName = new ArrayList(); if (urls != null) { for (int i = 0; i < urls.length; i++) { URL url = urls[i]; String urlPath = url.getPath(); // 不必搜索classes文件夹 if (urlPath.endsWith("classes/")) { continue; } String jarPath = urlPath + "!/" + packagePath; myClassName.addAll(getClassNameByJar(jarPath, childPackage)); } } return myClassName; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/DefaultIndexAction.java ================================================ package com.xiaoleilu.loServer.action; import com.hazelcast.core.HazelcastInstance; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.spi.IMessagesStore; /** * 默认的主页Action,当访问主页且没有定义主页Action时,调用此Action * @author Looly * */ public class DefaultIndexAction extends Action{ @Override public boolean action(Request request, Response response) { response.setContent("Welcome to LoServer."); return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/FileAction.java ================================================ package com.xiaoleilu.loServer.action; import java.io.File; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; import java.nio.file.Files; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.regex.Pattern; import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.ReUtil; import cn.hutool.core.util.StrUtil; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.ServerSetting; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.spi.IMessagesStore; import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpResponseStatus; import org.slf4j.LoggerFactory; import static cn.hutool.core.date.DatePattern.HTTP_DATETIME_PATTERN; /** * 默认的主页Action,当访问主页且没有定义主页Action时,调用此Action * * @author Looly * */ public class FileAction extends Action { private static final org.slf4j.Logger Logger = LoggerFactory.getLogger(FileAction.class); @Override public boolean action(Request request, Response response) { response.setHeader("Access-Control-Allow-Origin", "*"); if (false == Request.METHOD_GET.equalsIgnoreCase(request.getMethod())) { response.sendError(HttpResponseStatus.METHOD_NOT_ALLOWED, "Please use GET method to request file!"); return true; } if(ServerSetting.isRootAvailable() == false){ response.sendError(HttpResponseStatus.NOT_FOUND, "404 Root dir not avaliable!"); return true; } File file = null; try { file = getFileByPath(request.getPath()); } catch (Exception e) { response.sendError(HttpResponseStatus.NOT_FOUND, "404 File not found!"); return true; } // 隐藏文件或不存在,跳过 if (file == null || file.isHidden() || !file.exists()) { response.sendError(HttpResponseStatus.NOT_FOUND, "404 File not found!"); return true; } // 非文件,跳过 if (!file.isFile()) { response.sendError(HttpResponseStatus.FORBIDDEN, "403 Forbidden!"); return true; } Logger.debug("Client [{}] get file [{}]", request.getIp(), file.getPath()); // Cache Validation String ifModifiedSince = request.getHeader(HttpHeaderNames.IF_MODIFIED_SINCE.toString()); if (StrUtil.isNotBlank(ifModifiedSince)) { Date ifModifiedSinceDate = null; try { ifModifiedSinceDate = DateUtil.parse(ifModifiedSince, HTTP_DATE_FORMATER); } catch (Exception e) { Logger.warn("If-Modified-Since header parse error: {}", e.getMessage()); } if(ifModifiedSinceDate != null) { // 只对比到秒一级别 long ifModifiedSinceDateSeconds = ifModifiedSinceDate.getTime() / 1000; long fileLastModifiedSeconds = file.lastModified() / 1000; if (ifModifiedSinceDateSeconds == fileLastModifiedSeconds) { Logger.debug("File {} not modified.", file.getPath()); response.sendNotModified(); return true; } } } response.setContent(file); if (isAudioOrVideoFile(file.getName())) { response.setHeader("Accept-Ranges", "bytes"); } else { response.setHeader("Content-Disposition", "attachment; filename=\"" + file.getName() + "\""); } return true; } private static boolean isAudioOrVideoFile(String name) { try { if (StringUtil.isNullOrEmpty(name)) return false; String mimeType = Files.probeContentType(new File(name).toPath()); return mimeType != null && (mimeType.startsWith("audio/") || mimeType.startsWith("video/")); } catch (IOException e) { return false; } } private static final Pattern INSECURE_URI = Pattern.compile(".*[<>&\"].*"); private static final SimpleDateFormat HTTP_DATE_FORMATER = new SimpleDateFormat(HTTP_DATETIME_PATTERN, Locale.US); /** * 通过URL中的path获得文件的绝对路径 * * @param httpPath Http请求的Path * @return 文件绝对路径 */ public static File getFileByPath(String httpPath) { // Decode the path. try { httpPath = URLDecoder.decode(httpPath, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new Error(e); } if (httpPath.isEmpty() || httpPath.charAt(0) != '/') { return null; } // 路径安全检查 String path = httpPath.substring(0, httpPath.lastIndexOf("/")); if (path.contains("/.") || path.contains("./") || ReUtil.isMatch(INSECURE_URI, path)) { return null; } // 转换为绝对路径 return FileUtil.file(ServerSetting.getRoot(), httpPath); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/IMAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.protobuf.InvalidProtocolBufferException; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.ServerAPIHelper; import io.moquette.persistence.MemorySessionStore; import io.moquette.spi.impl.Utils; import io.moquette.spi.impl.security.AES; import io.moquette.spi.security.Tokenor; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import cn.wildfirechat.common.ErrorCode; import java.util.Base64; import java.util.concurrent.Executor; @Route("/im") @HttpMethod("POST") public class IMAction extends Action { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { FullHttpRequest fullHttpRequest = (FullHttpRequest)request.getNettyRequest(); byte[] bytes = Utils.readBytesAndRewind(fullHttpRequest.content()); String str = new String(bytes); try { bytes = Base64.getDecoder().decode(str); } catch (IllegalArgumentException e) { sendResponse(response, ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH, null); return true; } String cid = fullHttpRequest.headers().get("cid"); byte[] cbytes = Base64.getDecoder().decode(cid); cbytes = AES.AESDecrypt(cbytes, "", true); if (cbytes == null) { sendResponse(response, ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH, null); return true; } cid = new String(cbytes); MemorySessionStore.Session session = sessionsStore.getSession(cid); if (session != null) { bytes = AES.AESDecrypt(bytes, session.getSecret(), true); } else { sendResponse(response, ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH, null); return true; } if (bytes == null) { sendResponse(response, ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH, null); return true; } try { WFCMessage.IMHttpWrapper wrapper = WFCMessage.IMHttpWrapper.parseFrom(bytes); String token = wrapper.getToken(); String userId = Tokenor.getUserId(token.getBytes()); if (userId == null) { sendResponse(response, ErrorCode.ERROR_CODE_TOKEN_ERROR, null); } else { if(messagesStore.getUserStatus(userId) == ProtoConstants.UserStatus.Forbidden) { sendResponse(response, ErrorCode.ERROR_CODE_USER_BLOCKED, null); return true; } ServerAPIHelper.sendRequest(userId, wrapper.getClientId(), wrapper.getRequest(), wrapper.getData().toByteArray(), new ServerAPIHelper.Callback() { @Override public void onSuccess(byte[] result) { sendResponse(response, null, result); } @Override public void onError(ErrorCode errorCode) { sendResponse(response, errorCode, null); } @Override public void onTimeout() { sendResponse(response, ErrorCode.ERROR_CODE_TIMEOUT, null); } @Override public Executor getResponseExecutor() { return command -> { ctx.executor().execute(command); }; } }, ProtoConstants.RequestSourceType.Request_From_User); return false; } } catch (InvalidProtocolBufferException e) { sendResponse(response, ErrorCode.ERROR_CODE_INVALID_DATA, null); } } return true; } private void sendResponse(Response response, ErrorCode errorCode, byte[] contents) { response.setStatus(HttpResponseStatus.OK); if(contents == null) { ByteBuf ackPayload = Unpooled.buffer(); ackPayload.ensureWritable(1).writeByte(errorCode.getCode()); response.setContent(ackPayload); } else { response.setContent(contents); } response.send(); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/NotFoundAction.java ================================================ package com.xiaoleilu.loServer.action; import com.hazelcast.core.HazelcastInstance; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.spi.IMessagesStore; import io.netty.handler.codec.http.HttpResponseStatus; import org.slf4j.LoggerFactory; import java.io.PrintWriter; import java.io.StringWriter; /** * 错误堆栈Action类 * @author Looly * */ public class NotFoundAction extends Action{ private static final org.slf4j.Logger Logger = LoggerFactory.getLogger(NotFoundAction.class); public final static String ERROR_PARAM_NAME = "_e"; private final static String TEMPLATE_ERROR = "LoServer - Error report

HTTP Status {} - {}


{}


LoServer

"; @Override public boolean action(Request request, Response response) { response.sendError(HttpResponseStatus.NOT_FOUND, "404 Not found!"); return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/RouteAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.protobuf.InvalidProtocolBufferException; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.MemorySessionStore; import io.moquette.persistence.ServerAPIHelper; import io.moquette.spi.impl.Utils; import io.moquette.spi.impl.security.AES; import io.moquette.spi.security.Tokenor; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import cn.wildfirechat.common.ErrorCode; import java.net.InetSocketAddress; import java.util.Base64; import java.util.Map; import java.util.concurrent.Executor; @Route("/route") @HttpMethod("POST") public class RouteAction extends Action { private static final Logger LOG = LoggerFactory.getLogger(RouteAction.class); @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { response.setContentType("application/octet-stream"); response.setHeader("Access-Control-Allow-Origin", "*"); FullHttpRequest fullHttpRequest = (FullHttpRequest) request.getNettyRequest(); byte[] bytes = Utils.readBytesAndRewind(fullHttpRequest.content()); String str = new String(bytes); try { bytes = Base64.getDecoder().decode(str); } catch (IllegalArgumentException e) { sendResponse(response, ErrorCode.ERROR_CODE_INVALID_DATA, null); return true; } String cid = fullHttpRequest.headers().get("cid"); byte[] cbytes = Base64.getDecoder().decode(cid); boolean[] invalidTime = new boolean[1]; cbytes = AES.AESDecrypt(cbytes, "", true, invalidTime); if (cbytes == null) { if(invalidTime[0]) { sendResponse(response, ErrorCode.ERROR_CODE_TIME_INCONSISTENT, null); } else { sendResponse(response, ErrorCode.ERROR_CODE_INVALID_DATA, null); } return true; } cid = new String(cbytes); String uid = fullHttpRequest.headers().get("uid"); byte[] ubytes = Base64.getDecoder().decode(uid); ubytes = AES.AESDecrypt(ubytes, "", true); if (ubytes == null) { sendResponse(response, ErrorCode.ERROR_CODE_INVALID_DATA, null); return true; } uid = new String(ubytes); MemorySessionStore.Session session = sessionsStore.sessionForClientAndUser(uid, cid); if (session == null) { ErrorCode errorCode = sessionsStore.loadActiveSession(uid, cid); if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { sendResponse(response, errorCode, null); return true; } session = sessionsStore.sessionForClientAndUser(uid, cid); } if (session != null) { bytes = AES.AESDecrypt(bytes, session.getSecret(), true); } else { sendResponse(response, ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH, null); return true; } if (bytes == null) { sendResponse(response, ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH, null); return true; } if(messagesStore.getUserStatus(uid) == ProtoConstants.UserStatus.Forbidden) { sendResponse(response, ErrorCode.ERROR_CODE_USER_BLOCKED, null); return true; } try { WFCMessage.IMHttpWrapper wrapper = WFCMessage.IMHttpWrapper.parseFrom(bytes); String token = wrapper.getToken(); String userId = Tokenor.getUserId(token.getBytes()); String remote = ((InetSocketAddress) ctx.channel().remoteAddress()) .getAddress().getHostAddress(); String ip = computeRealIp(request.getHeaders(), remote); LOG.info("RouteAction token={}, userId={}", token, userId); if (userId == null) { sendResponse(response, ErrorCode.ERROR_CODE_TOKEN_ERROR, null); } else { ServerAPIHelper.sendRequest(userId, wrapper.getClientId(), wrapper.getRequest(), wrapper.getData().toByteArray(), new ServerAPIHelper.Callback() { @Override public void onSuccess(byte[] result) { sendResponse(response, null, result); //save ip after success response. sessionsStore.updateSessionIp(userId, wrapper.getClientId(), ip); } @Override public void onError(ErrorCode errorCode) { sendResponse(response, errorCode, null); } @Override public void onTimeout() { sendResponse(response, ErrorCode.ERROR_CODE_TIMEOUT, null); } @Override public Executor getResponseExecutor() { return command -> { ctx.executor().execute(command); }; } }, ProtoConstants.RequestSourceType.Request_From_User); return false; } } catch (InvalidProtocolBufferException e) { sendResponse(response, ErrorCode.ERROR_CODE_INVALID_DATA, null); } } return true; } private String computeRealIp(Map h, String remote) { String xff = h.get("X-Forwarded-For"); if (xff != null && !xff.isEmpty() && !"unknown".equalsIgnoreCase(xff)) { int idx = xff.indexOf(','); String first = (idx > 0 ? xff.substring(0, idx) : xff).trim(); return first; } String xri = h.get("X-Real-IP"); if (xri != null && !xri.isEmpty() && !"unknown".equalsIgnoreCase(xri)) { return xri; } return remote; } private void sendResponse(Response response, ErrorCode errorCode, byte[] contents) { response.setStatus(HttpResponseStatus.OK); if (contents == null) { ByteBuf ackPayload = Unpooled.buffer(); ackPayload.ensureWritable(1).writeByte(errorCode.getCode()); contents = ackPayload.array(); } response.setContent(contents); response.send(); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/UnknownErrorAction.java ================================================ package com.xiaoleilu.loServer.action; import java.io.PrintWriter; import java.io.StringWriter; import com.hazelcast.core.HazelcastInstance; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.spi.IMessagesStore; import io.netty.handler.codec.http.HttpResponseStatus; import org.slf4j.LoggerFactory; /** * 错误堆栈Action类 * @author Looly * */ public class UnknownErrorAction extends Action{ private static final org.slf4j.Logger Logger = LoggerFactory.getLogger(UnknownErrorAction.class); public final static String ERROR_PARAM_NAME = "_e"; private final static String TEMPLATE_ERROR = "LoServer - Error report

HTTP Status {} - {}


{}


LoServer

"; @Override public boolean action(Request request, Response response) { response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR); return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/UploadFileAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.RequireAuthentication; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.*; import io.moquette.server.config.MediaServerConfig; import io.moquette.spi.impl.security.AES; import io.moquette.spi.security.DES; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.http.*; import io.netty.handler.codec.http.multipart.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.RandomAccessFile; import java.nio.file.Path; import java.nio.file.Paths; import java.text.SimpleDateFormat; import java.util.Date; import java.util.UUID; import static com.xiaoleilu.loServer.handler.HttpResponseHelper.getFileExt; @Route("/fs") @HttpMethod("POST") @RequireAuthentication public class UploadFileAction extends Action { private static final String KEY = "imfile"; private static final Logger logger = LoggerFactory.getLogger(UploadFileAction.class); private static final HttpDataFactory factory = new DefaultHttpDataFactory(false); public static class InvalidateTokenExecption extends Exception { } public static String getToken(int type) { String signKey = KEY + "|" + (System.currentTimeMillis()) + "|" + type; try { return DES.encryptDES(signKey); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } public static int validateToken(String token) throws InvalidateTokenExecption { try { String signKey = DES.decryptDES(token); String[] parts = signKey.split("\\|"); if(parts.length == 3) { if(parts[0].equals(KEY)) { long timestamp = Long.parseLong(parts[1]); if(Math.abs(System.currentTimeMillis() - timestamp) < 2 * 60 * 60 * 1000) { return Integer.parseInt(parts[2]); } } } } catch (Exception e) { // TODO Auto-generated catch block //e.printStackTrace(); } throw new InvalidateTokenExecption(); } @Override public boolean action(Request r, Response response) { if (r.getNettyRequest() instanceof FullHttpRequest) { FullHttpRequest request = (FullHttpRequest) r.getNettyRequest(); String requestId = UUID.randomUUID().toString().replace("-", ""); logger.info("HttpFileServerHandler received a request: method=" + request.getMethod() + ", uri=" + request.getUri() + ", requestId=" + requestId); if (!request.getDecoderResult().isSuccess()) { logger.warn("http decode failed!"); response.setStatus(HttpResponseStatus.BAD_REQUEST); response.setContent("http decode failed"); return true; } multipartUpload(request, requestId, response); } return true; } /** * multipart上传 */ private void multipartUpload(FullHttpRequest request, String requestId, Response response) { HttpPostRequestDecoder decoder = null; try { decoder = new HttpPostRequestDecoder(factory, request); } catch (HttpPostRequestDecoder.ErrorDataDecoderException e1) { logger.error("Failed to decode file data!", e1); response.setStatus(HttpResponseStatus.BAD_REQUEST); response.setContent("Failed to decode file data!"); return; } if (decoder != null) { if (request instanceof HttpContent) { HttpContent chunk = (HttpContent) request; try { decoder.offer(chunk); } catch (HttpPostRequestDecoder.ErrorDataDecoderException e1) { logger.warn("BAD_REQUEST, Failed to decode file data"); response.setStatus(HttpResponseStatus.BAD_REQUEST); response.setContent("Failed to decode file data!"); return; } long fileTotalSize = 0; if (request.headers().contains("X-File-Total-Size")) { try { fileTotalSize = Integer.parseInt(request.headers().get("X-File-Total-Size")); } catch (Exception e) { logger.warn("invalid X-File-Total-Size value!"); } } readHttpDataChunkByChunk(response, decoder, requestId, HttpHeaders.isKeepAlive(request)); decoder.destroy(); if (chunk instanceof LastHttpContent) { } } else { logger.warn("BAD_REQUEST, Not a http request"); response.setStatus(HttpResponseStatus.BAD_REQUEST); response.setContent("Not a http request"); } } } /** * readHttpDataChunkByChunk */ private void readHttpDataChunkByChunk(Response response, HttpPostRequestDecoder decoder, String requestId, boolean isKeepAlive) { try { int[] bucket = new int[1]; bucket[0] = -1; while (decoder.hasNext()) { InterfaceHttpData data = decoder.next(); if (data != null) { try { if(!writeFileUploadData(data, response, requestId, isKeepAlive, bucket)) { break; } } finally { data.release(); } } } } catch (Exception e) { logger.info("chunk end"); } } /** * writeFileUploadData */ private boolean writeFileUploadData(InterfaceHttpData data, Response response, String requestId, boolean isKeepAlive, int[] bucket) { try { if (data.getHttpDataType() == InterfaceHttpData.HttpDataType.FileUpload) { FileUpload fileUpload = (FileUpload) data; String remoteFileName = fileUpload.getFilename(); long remoteFileSize = fileUpload.length(); if(bucket[0] == -1) { logger.warn("Not authenticated!"); response.setStatus(HttpResponseStatus.BAD_REQUEST); response.setContent("Not authenticated!"); return false; } if(remoteFileName != null && remoteFileName.length() > 2 && remoteFileName.startsWith("'") && remoteFileName.endsWith("'")) { remoteFileName = remoteFileName.substring(1, remoteFileName.length()-1); } if (StringUtil.isNullOrEmpty(remoteFileName)) { logger.warn("remoteFileName is empty!"); response.setStatus(HttpResponseStatus.BAD_REQUEST); response.setContent("file name is empty"); return false; } if (StringUtil.isNullOrEmpty(requestId)) { logger.warn("requestId is empty!"); response.setStatus(HttpResponseStatus.BAD_REQUEST); response.setContent("requestId is empty!"); return false; } if (remoteFileSize > 200 * 1024 * 1024) { logger.warn("file over limite!(" + remoteFileSize + ")"); response.setStatus(HttpResponseStatus.BAD_REQUEST); response.setContent("file over limite!"); return false; } remoteFileName = getSafeFileName(remoteFileName); String remoteFileExt = ""; if (remoteFileName.lastIndexOf(".") == -1) { remoteFileExt = "octetstream"; remoteFileName = remoteFileName + "." + remoteFileExt; } else { remoteFileExt = getFileExt(remoteFileName); } if (StringUtil.isNullOrEmpty(remoteFileExt) || remoteFileExt.equals("ing")) { logger.warn("Invalid file extention name"); response.setStatus(HttpResponseStatus.BAD_REQUEST); response.setContent("Invalid file extention name"); return false; } int remoteFileTotalSize = (int) remoteFileSize; ByteBuf byteBuf = null; int savedThunkSize = 0; // 分片接收保存的大小 int offset = 0; // 断点续传开始位置 Date nowTime=new Date(); SimpleDateFormat time=new SimpleDateFormat("yyyy/MM/dd/HH/mm/ss"); String datePath = time.format(nowTime); datePath = "fs/" + bucket[0] + "/" + datePath; //add bucket String dir; if(MediaServerConfig.FILE_STROAGE_ROOT.startsWith("/") || MediaServerConfig.FILE_STROAGE_ROOT.startsWith("~/") || MediaServerConfig.FILE_STROAGE_ROOT.startsWith("./")) { dir = MediaServerConfig.FILE_STROAGE_ROOT + "/" + datePath; } else { dir = "./" + MediaServerConfig.FILE_STROAGE_ROOT + "/" + datePath; } File dirFile = new File(dir); boolean bFile = dirFile.exists(); if(!bFile) { bFile = dirFile.mkdirs(); if (!bFile) { logger.error("create dirs error! {}", dir); response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR); response.setContent("服务器错误:无法创建文件"); return false; } } String filePath = dir + "/" + (StringUtil.isNullOrEmpty(remoteFileName) ? requestId : remoteFileName); logger.info("the file path is " + filePath); File tmpFile = new File(filePath); logger.info("before write the file"); boolean isError = false; while (true) { byte[] thunkData; try { byteBuf = fileUpload.getChunk(128 * 1024); int readableBytesSize = byteBuf.readableBytes(); thunkData = new byte[readableBytesSize]; byteBuf.readBytes(thunkData); put(tmpFile, offset, thunkData); savedThunkSize += readableBytesSize; offset += readableBytesSize; byteBuf.release(); byteBuf = null; if (savedThunkSize >= remoteFileSize) { fileUpload.release(); response.setStatus(HttpResponseStatus.OK); String relativePath = datePath + "/" + (StringUtil.isNullOrEmpty(remoteFileName) ? requestId : remoteFileName); response.setContent("{\"key\":\"" + relativePath + "\"}"); break; } } catch (Exception e) { logger.error("save thunckData error!", e); if (fileUpload != null) fileUpload.release(); if (byteBuf != null) byteBuf.release(); response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR); response.setContent("服务器错误:" + e.getMessage()); isError = true; return false; } finally { thunkData = null; if (isError) { tmpFile.delete(); } } } } else if(data.getHttpDataType() == InterfaceHttpData.HttpDataType.Attribute) { Attribute attribute = (Attribute)data; if(attribute.getName().equals("token")) { String token = attribute.getValue(); try { bucket[0] = validateToken(token); } catch (InvalidateTokenExecption e) { logger.error("无效的token!", e); response.setStatus(HttpResponseStatus.BAD_REQUEST); response.setContent("无效的token:" + e.getMessage()); return false; } } } } catch (Exception e) { logger.error("writeHttpData error!", e); response.setStatus(HttpResponseStatus.INTERNAL_SERVER_ERROR); response.setContent("服务器错误:" + e.getMessage()); return false; } return true; } private static String getSafeFileName(String originalFilename) { // Paths.get() 会解析路径,getFileName() 只取最后一部分(纯文件名) Path filenamePath = Paths.get(originalFilename.trim()); String safeFilename = filenamePath.getFileName().toString(); // 额外过滤特殊字符(可选,根据业务需要) safeFilename = safeFilename.replaceAll("[\\\\/:*?\"<>|]", "_"); return safeFilename.isEmpty() ? "default_file_" + System.currentTimeMillis() : safeFilename; } public static void put(File file, long pos, byte[] data) throws Exception { RandomAccessFile raf = null; try { raf = new RandomAccessFile(file, "rwd"); raf.seek(pos); raf.write(data); } finally { try { if (raf != null) raf.close(); } catch (Exception e) { logger.warn("release error!", e); } } } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/VersionAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action; import com.google.gson.Gson; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.InputUserLogin; import cn.wildfirechat.pojos.OutputLoginData; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.GitRepositoryState; import win.liyufan.im.Utility; import java.io.IOException; @Route("/api/version") @HttpMethod("GET") public class VersionAction extends Action { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { if(closeApiVersion) { response.sendError(HttpResponseStatus.NOT_FOUND, "404 Not found!"); return true; } response.setStatus(HttpResponseStatus.OK); try { response.setContent(Utility.formatJson(gson.toJson(GitRepositoryState.getGitRepositoryState()))); } catch (IOException e) { e.printStackTrace(); response.setContent("{\"version\":\"unknown\"}"); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/AddFriendRequestAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputAddFriendRequest; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import win.liyufan.im.IMTopic; @Route(APIPath.Friend_Send_Request) @HttpMethod("POST") public class AddFriendRequestAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputAddFriendRequest input = getRequestBody(request.getNettyRequest(), InputAddFriendRequest.class); if (StringUtil.isNullOrEmpty(input.getUserId()) || StringUtil.isNullOrEmpty(input.getFriendUid())) { sendResponse(response, ErrorCode.INVALID_PARAMETER, null); return true; } WFCMessage.AddFriendRequest addFriendRequest = WFCMessage.AddFriendRequest.newBuilder().setReason(input.getReason()).setTargetUid(input.getFriendUid()).build(); sendApiMessage(response, input.getUserId(), IMTopic.AddFriendRequestTopic, addFriendRequest.toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }, !input.isForce()); return false; } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/AddGroupMemberAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import cn.wildfirechat.pojos.InputAddGroupMember; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Route(APIPath.Group_Member_Add) @HttpMethod("POST") public class AddGroupMemberAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputAddGroupMember inputAddGroupMember = getRequestBody(request.getNettyRequest(), InputAddGroupMember.class); if (inputAddGroupMember.isValide()) { sendApiMessage(response, inputAddGroupMember.getOperator(), IMTopic.AddGroupMemberTopic, inputAddGroupMember.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/AdminAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.proto.ProtoConstants; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.action.Action; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.ServerAPIHelper; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import org.apache.commons.codec.digest.DigestUtils; import cn.wildfirechat.common.ErrorCode; import org.slf4j.LoggerFactory; import win.liyufan.im.RateLimiter; import win.liyufan.im.Utility; import java.util.concurrent.Executor; abstract public class AdminAction extends Action { private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(AdminAction.class); private static String SECRET_KEY = "123456"; private static boolean NO_CHECK_TIME = false; public static void setSecretKey(String secretKey) { SECRET_KEY = secretKey; } public static String getSecretKey() { return SECRET_KEY; } public static void setNoCheckTime(String noCheckTime) { try { NO_CHECK_TIME = Boolean.parseBoolean(noCheckTime); } catch (Exception e) { } } @Override public ErrorCode preAction(Request request, Response response) { if (!adminLimiter.isGranted("admin")) { return ErrorCode.ERROR_CODE_OVER_FREQUENCY; } if(APIPath.Health.equals(request.getUri())) { return ErrorCode.ERROR_CODE_SUCCESS; } String nonce = request.getHeader("nonce"); if (StringUtil.isNullOrEmpty(nonce)) { nonce = request.getHeader("Nonce"); } String timestamp = request.getHeader("timestamp"); if (StringUtil.isNullOrEmpty(timestamp)) { timestamp = request.getHeader("Timestamp"); } String sign = request.getHeader("sign"); if (StringUtil.isNullOrEmpty(sign)) { sign = request.getHeader("Sign"); } if (StringUtil.isNullOrEmpty(nonce) || StringUtil.isNullOrEmpty(timestamp) || StringUtil.isNullOrEmpty(sign)) { return ErrorCode.ERROR_CODE_API_NOT_SIGNED; } Long ts; try { ts = Long.parseLong(timestamp); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); return ErrorCode.ERROR_CODE_API_NOT_SIGNED; } if (!NO_CHECK_TIME && System.currentTimeMillis() - ts > 2 * 60 * 60 * 1000) { return ErrorCode.ERROR_CODE_SIGN_EXPIRED; } String str = nonce + "|" + SECRET_KEY + "|" + timestamp; String localSign = DigestUtils.sha1Hex(str); return localSign.equals(sign) ? ErrorCode.ERROR_CODE_SUCCESS : ErrorCode.ERROR_CODE_AUTH_FAILURE; } protected void sendResponse(Response response, ErrorCode errorCode, Object data) { if(response != null) { response.setStatus(HttpResponseStatus.OK); if (errorCode == null) { errorCode = ErrorCode.ERROR_CODE_SUCCESS; } RestResult result = RestResult.resultOf(errorCode, errorCode.getMsg(), data); response.setContent(gson.toJson(result)); response.send(); } } protected void sendApiMessage(Response response, String fromUser, String topic, byte[] message, ApiCallback callback) { sendApiMessage(response, fromUser, null, topic, message, callback, false); } protected void sendApiMessage(Response response, String fromUser, String topic, byte[] message, ApiCallback callback, boolean noAdmin) { sendApiMessage(response, fromUser, null, topic, message, callback, noAdmin); } protected void sendApiMessage(Response response, String fromUser, String clientId, String topic, byte[] message, ApiCallback callback, boolean noAdmin) { ServerAPIHelper.sendRequest(fromUser, clientId, topic, message, callback == null ? null : new ServerAPIHelper.Callback() { @Override public void onSuccess(byte[] result) { if(callback != null) { Result r = callback.onResult(result); sendResponse(response, r.getErrorCode(), r.getData()); } } @Override public void onError(ErrorCode errorCode) { sendResponse(response, errorCode, null); } @Override public void onTimeout() { sendResponse(response, ErrorCode.ERROR_CODE_TIMEOUT, null); } @Override public Executor getResponseExecutor() { return command -> { ctx.executor().execute(command); }; } }, noAdmin ? ProtoConstants.RequestSourceType.Request_From_User : ProtoConstants.RequestSourceType.Request_From_Admin); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/AliasGetAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetAlias; import cn.wildfirechat.pojos.InputGetFriendList; import cn.wildfirechat.pojos.OutputGetAlias; import cn.wildfirechat.pojos.OutputStringList; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import com.xiaoleilu.loServer.model.FriendData; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import java.util.ArrayList; import java.util.List; @Route(APIPath.Friend_Get_Alias) @HttpMethod("POST") public class AliasGetAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetAlias input = getRequestBody(request.getNettyRequest(), InputGetAlias.class); List dataList = messagesStore.getFriendList(input.getOperator(), null, 0); List list = new ArrayList<>(); OutputGetAlias out = new OutputGetAlias(input.getOperator(), input.getTargetId()); for (FriendData data : dataList) { if (data.getFriendUid().equals(input.getTargetId())) { out.setAlias(data.getAlias()); break; } } setResponseContent(RestResult.ok(out), response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/AliasPutAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetFriendList; import cn.wildfirechat.pojos.InputUpdateAlias; import cn.wildfirechat.pojos.OutputCreateChannel; import cn.wildfirechat.pojos.OutputStringList; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import com.xiaoleilu.loServer.model.FriendData; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; import java.util.ArrayList; import java.util.List; @Route(APIPath.Friend_Set_Alias) @HttpMethod("POST") public class AliasPutAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputUpdateAlias input = getRequestBody(request.getNettyRequest(), InputUpdateAlias.class); if(!StringUtil.isNullOrEmpty(input.getOperator()) && !StringUtil.isNullOrEmpty(input.getTargetId())) { WFCMessage.AddFriendRequest addFriendRequest = WFCMessage.AddFriendRequest.newBuilder().setTargetUid(input.getTargetId()).setReason(input.getAlias()==null?"":input.getAlias()).build(); sendApiMessage(response, input.getOperator(), IMTopic.SetFriendAliasTopic, addFriendRequest.toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { ErrorCode errorCode = messagesStore.setFriendAliasRequest(input.getOperator(), input.getTargetId(), input.getAlias(), new long[1]); setResponseContent(RestResult.resultOf(errorCode), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/ApplicationGetUserInfoAction.java ================================================ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputApplicationGetUserInfo; import cn.wildfirechat.pojos.OutputApplicationUserInfo; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; @Route(APIPath.User_Application_Get_UserInfo) @HttpMethod("POST") public class ApplicationGetUserInfoAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputApplicationGetUserInfo inputUserToken = getRequestBody(request.getNettyRequest(), InputApplicationGetUserInfo.class); RestResult result; if (inputUserToken == null || StringUtil.isNullOrEmpty(inputUserToken.getAuthCode())) { result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER); } else { String userId = messagesStore.verifyApplicationAuthCode(inputUserToken.getAuthCode(), "admin", ProtoConstants.ApplicationType.ApplicationType_Admin); if(userId != null) { OutputApplicationUserInfo outputVerifyApplicationUser = new OutputApplicationUserInfo(); outputVerifyApplicationUser.setUserId(userId); WFCMessage.User user = messagesStore.getUserInfo(userId); if(user != null) { outputVerifyApplicationUser.setDisplayName(user.getDisplayName()); outputVerifyApplicationUser.setPortraitUrl(user.getPortrait()); } result = RestResult.ok(outputVerifyApplicationUser); } else { result = RestResult.resultOf(ErrorCode.ERROR_CODE_TOKEN_ERROR); } } response.setStatus(HttpResponseStatus.OK); response.setContent(gson.toJson(result)); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/BlacklistAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputBlacklistRequest; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import win.liyufan.im.IMTopic; @Route(APIPath.Blacklist_Update_Status) @HttpMethod("POST") public class BlacklistAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputBlacklistRequest inputData = getRequestBody(request.getNettyRequest(), InputBlacklistRequest.class); if (inputData != null && !StringUtil.isNullOrEmpty(inputData.getUserId()) && !StringUtil.isNullOrEmpty(inputData.getTargetUid()) ) { WFCMessage.BlackUserRequest friendRequest = WFCMessage.BlackUserRequest.newBuilder().setUid(inputData.getTargetUid()).setStatus(inputData.getStatus()).build(); sendApiMessage(response, inputData.getUserId(), IMTopic.BlackListUserTopic, friendRequest.toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/BlacklistGetAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.InputGetFriendList; import cn.wildfirechat.pojos.InputUserId; import cn.wildfirechat.pojos.OutputStringList; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import com.xiaoleilu.loServer.model.FriendData; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import java.util.ArrayList; import java.util.List; @Route(APIPath.Blacklist_Get_List) @HttpMethod("POST") public class BlacklistGetAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputUserId inputGetFriendList = getRequestBody(request.getNettyRequest(), InputUserId.class); List dataList = messagesStore.getFriendList(inputGetFriendList.getUserId(), null, 0); List list = new ArrayList<>(); for (FriendData data : dataList) { if (data.getBlacked() > 0) { list.add(data.getFriendUid()); } } setResponseContent(RestResult.ok(new OutputStringList(list)), response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/BlockUserAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import cn.wildfirechat.pojos.InputOutputUserBlockStatus; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.ServerAPIHelper; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import cn.wildfirechat.common.ErrorCode; @Route(APIPath.User_Update_Block_Status) @HttpMethod("POST") public class BlockUserAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputOutputUserBlockStatus inputUserBlock = getRequestBody(request.getNettyRequest(), InputOutputUserBlockStatus.class); if (inputUserBlock != null && !StringUtil.isNullOrEmpty(inputUserBlock.getUserId())) { ErrorCode errorCode = messagesStore.modifyUserStatus(inputUserBlock.getUserId(), inputUserBlock.getStatus()); response.setStatus(HttpResponseStatus.OK); RestResult result; result = RestResult.resultOf(errorCode); response.setContent(gson.toJson(result)); if (inputUserBlock.getStatus() == 2) { sendApiMessage(null, null, ServerAPIHelper.KICKOFF_USER_REQUEST, inputUserBlock.getUserId().getBytes(), null); } sendResponse(response, ErrorCode.ERROR_CODE_SUCCESS, null); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/BroadcastMessageAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.BroadMessageData; import cn.wildfirechat.pojos.BroadMessageResult; import com.google.gson.Gson; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Msg_Broadcast) @HttpMethod("POST") public class BroadcastMessageAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { BroadMessageData sendMessageData = getRequestBody(request.getNettyRequest(), BroadMessageData.class); if (BroadMessageData.isValide(sendMessageData) && !StringUtil.isNullOrEmpty(sendMessageData.getSender())) { sendApiMessage(response, sendMessageData.getSender(), IMTopic.BroadcastMessageTopic, sendMessageData.toProtoMessage().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { long messageId = byteBuf.readLong(); long count = byteBuf.readLong(); return new Result(errorCode, new BroadMessageResult(messageId, count)); } else { return new Result(errorCode); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/ChannelSubscriberAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputChannelSubscribe; import cn.wildfirechat.pojos.InputCreateChannel; import cn.wildfirechat.pojos.InputSubscribeChannel; import cn.wildfirechat.pojos.OutputCreateChannel; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.action.channel.ChannelAction; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import win.liyufan.im.IMTopic; @Route(APIPath.Subscribe_Channel) @HttpMethod("POST") public class ChannelSubscriberAction extends AdminAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputSubscribeChannel inputSubscribeChannel = getRequestBody(request.getNettyRequest(), InputSubscribeChannel.class); if (inputSubscribeChannel != null && !io.netty.util.internal.StringUtil.isNullOrEmpty(inputSubscribeChannel.getChannelId()) && !io.netty.util.internal.StringUtil.isNullOrEmpty(inputSubscribeChannel.getUserId())) { WFCMessage.ListenChannel.Builder builder = WFCMessage.ListenChannel.newBuilder().setChannelId(inputSubscribeChannel.getChannelId()).setListen(inputSubscribeChannel.getSubscribe()); sendApiMessage(response, inputSubscribeChannel.getUserId(), IMTopic.ChannelListenTopic, builder.build().toByteArray(), result -> { ErrorCode errorCode = ErrorCode.fromCode(result[0]); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { return new Result(ErrorCode.ERROR_CODE_SUCCESS); } else { return new Result(errorCode); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/CheckUserOnlineAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.OutputCheckUserOnline; import com.google.gson.Gson; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import cn.wildfirechat.pojos.InputGetUserInfo; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.ServerAPIHelper; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import cn.wildfirechat.common.ErrorCode; @Route(APIPath.User_Get_Online_Status) @HttpMethod("POST") public class CheckUserOnlineAction extends AdminAction { @Override public boolean isTransactionAction() { return false; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetUserInfo inputUserId = getRequestBody(request.getNettyRequest(), InputGetUserInfo.class); if (inputUserId == null || !StringUtil.isNullOrEmpty(inputUserId.getUserId())) { sendApiMessage(response, inputUserId.getUserId(), ServerAPIHelper.CHECK_USER_ONLINE_REQUEST, inputUserId.getUserId().getBytes(), res -> { OutputCheckUserOnline out = gson.fromJson(new String(res), OutputCheckUserOnline.class); return new Result(ErrorCode.ERROR_CODE_SUCCESS, out); }); return false; } else { sendResponse(response, ErrorCode.INVALID_PARAMETER, null); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/CheckUserSubscribeChannelAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputChannelId; import cn.wildfirechat.pojos.InputSubscribeChannel; import cn.wildfirechat.pojos.OutputBooleanValue; import cn.wildfirechat.pojos.OutputGetChannelInfo; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; @Route(APIPath.Check_User_Subscribe_Channel) @HttpMethod("POST") public class CheckUserSubscribeChannelAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputSubscribeChannel inputSubscribeChannel = getRequestBody(request.getNettyRequest(), InputSubscribeChannel.class); if (inputSubscribeChannel != null && !StringUtil.isNullOrEmpty(inputSubscribeChannel.getChannelId()) && !StringUtil.isNullOrEmpty(inputSubscribeChannel.getUserId())) { boolean isInChannel = messagesStore.checkUserInChannel(inputSubscribeChannel.getUserId(), inputSubscribeChannel.getChannelId()); OutputBooleanValue outputBooleanValue = new OutputBooleanValue(); outputBooleanValue.value = isInChannel; setResponseContent(RestResult.ok(outputBooleanValue), response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/CreateChannelAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.*; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import win.liyufan.im.IMTopic; @Route(APIPath.Create_Channel) @HttpMethod("POST") public class CreateChannelAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputCreateChannel inputCreateChannel = getRequestBody(request.getNettyRequest(), InputCreateChannel.class); if (inputCreateChannel != null && !StringUtil.isNullOrEmpty(inputCreateChannel.getName()) && !StringUtil.isNullOrEmpty(inputCreateChannel.getOwner())) { if(StringUtil.isNullOrEmpty(inputCreateChannel.getTargetId())) { inputCreateChannel.setTargetId(messagesStore.getShortUUID()); } sendApiMessage(response, inputCreateChannel.getOwner(), IMTopic.CreateChannelTopic, inputCreateChannel.toProtoChannelInfo().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { byte[] data = new byte[byteBuf.readableBytes()]; byteBuf.readBytes(data); String str = new String(data); String[] ss = str.split("\\|"); String channelId = ss[0]; String secret = ss[1]; return new Result(ErrorCode.ERROR_CODE_SUCCESS, new OutputCreateChannel(channelId, secret)); } else { return new Result(errorCode); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/CreateChatroomAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.InputCreateChatroom; import cn.wildfirechat.pojos.OutputCreateChatroom; import io.moquette.spi.impl.Utils; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import cn.wildfirechat.common.ErrorCode; @Route(APIPath.Create_Chatroom) @HttpMethod("POST") public class CreateChatroomAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { FullHttpRequest fullHttpRequest = (FullHttpRequest)request.getNettyRequest(); byte[] bytes = Utils.readBytesAndRewind(fullHttpRequest.content()); String content = new String(bytes); InputCreateChatroom inputCreateChatroom = gson.fromJson(content, InputCreateChatroom.class); if (inputCreateChatroom != null && !StringUtil.isNullOrEmpty(inputCreateChatroom.getTitle())) { if (StringUtil.isNullOrEmpty(inputCreateChatroom.getChatroomId())) { inputCreateChatroom.setChatroomId(messagesStore.getShortUUID()); } WFCMessage.ChatroomInfo info = inputCreateChatroom.toChatroomInfo(); messagesStore.createChatroom(inputCreateChatroom.getChatroomId(), info); setResponseContent(RestResult.ok(new OutputCreateChatroom(inputCreateChatroom.getChatroomId())), response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/CreateGroupAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import cn.wildfirechat.pojos.InputCreateGroup; import cn.wildfirechat.pojos.OutputCreateGroupResult; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Route(APIPath.Create_Group) @HttpMethod("POST") public class CreateGroupAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputCreateGroup inputCreateGroup = getRequestBody(request.getNettyRequest(), InputCreateGroup.class); if (inputCreateGroup.isValide()) { sendApiMessage(response, inputCreateGroup.getOperator(), IMTopic.CreateGroupTopic, inputCreateGroup.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { byte[] data = new byte[byteBuf.readableBytes()]; byteBuf.readBytes(data); String groupId = new String(data); return new Result(ErrorCode.ERROR_CODE_SUCCESS, new OutputCreateGroupResult(groupId)); } else { return new Result(errorCode); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/CreateRobotAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.IMExceptionEvent; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.InputCreateRobot; import cn.wildfirechat.pojos.OutputCreateRobot; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import cn.wildfirechat.common.ErrorCode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.UUIDGenerator; import win.liyufan.im.Utility; @Route(APIPath.Create_Robot) @HttpMethod("POST") public class CreateRobotAction extends AdminAction { private static final Logger LOG = LoggerFactory.getLogger(CreateRobotAction.class); @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputCreateRobot inputCreateRobot = getRequestBody(request.getNettyRequest(), InputCreateRobot.class); if (inputCreateRobot != null && !StringUtil.isNullOrEmpty(inputCreateRobot.getName())) { if(StringUtil.isNullOrEmpty(inputCreateRobot.getUserId())) { inputCreateRobot.setUserId(messagesStore.getShortUUID()); } WFCMessage.User newUser = inputCreateRobot.toUser(); try { messagesStore.addUserInfo(newUser); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, IMExceptionEvent.EventType.ADMIN_API_Exception); response.setStatus(HttpResponseStatus.OK); RestResult result = RestResult.resultOf(ErrorCode.ERROR_CODE_SERVER_ERROR, e.getMessage()); response.setContent(gson.toJson(result)); return true; } if (StringUtil.isNullOrEmpty(inputCreateRobot.getOwner())) { inputCreateRobot.setOwner(inputCreateRobot.getUserId()); } if (StringUtil.isNullOrEmpty(inputCreateRobot.getSecret())) { inputCreateRobot.setSecret(UUIDGenerator.getUUID()); } messagesStore.addRobot(inputCreateRobot.toRobot()); setResponseContent(RestResult.ok(new OutputCreateRobot(inputCreateRobot.getUserId(), inputCreateRobot.getSecret())), response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/CreateUserAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.IMExceptionEvent; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.OutputCreateUser; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import cn.wildfirechat.common.ErrorCode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.UUIDGenerator; import win.liyufan.im.Utility; @Route(APIPath.Create_User) @HttpMethod("POST") public class CreateUserAction extends AdminAction { private static final Logger LOG = LoggerFactory.getLogger(CreateUserAction.class); @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputOutputUserInfo inputCreateUser = getRequestBody(request.getNettyRequest(), InputOutputUserInfo.class); if (inputCreateUser != null && !StringUtil.isNullOrEmpty(inputCreateUser.getName()) && (inputCreateUser.getType() == ProtoConstants.UserType.UserType_Normal || inputCreateUser.getType() == ProtoConstants.UserType.UserType_Admin || inputCreateUser.getType() == ProtoConstants.UserType.UserType_Super_Admin)) { if(StringUtil.isNullOrEmpty(inputCreateUser.getUserId())) { inputCreateUser.setUserId(messagesStore.getShortUUID()); } WFCMessage.User.Builder newUserBuilder = WFCMessage.User.newBuilder() .setUid(StringUtil.isNullOrEmpty(inputCreateUser.getUserId()) ? "" : inputCreateUser.getUserId()); if (inputCreateUser.getName() != null) newUserBuilder.setName(inputCreateUser.getName()); if (inputCreateUser.getDisplayName() != null) newUserBuilder.setDisplayName(inputCreateUser.getDisplayName()); if (inputCreateUser.getPortrait() != null) newUserBuilder.setPortrait(inputCreateUser.getPortrait()); if (inputCreateUser.getEmail() != null) newUserBuilder.setEmail(inputCreateUser.getEmail()); if (inputCreateUser.getAddress() != null) newUserBuilder.setAddress(inputCreateUser.getAddress()); if (inputCreateUser.getCompany() != null) newUserBuilder.setCompany(inputCreateUser.getCompany()); if (inputCreateUser.getSocial() != null) newUserBuilder.setSocial(inputCreateUser.getSocial()); if (inputCreateUser.getMobile() != null) newUserBuilder.setMobile(inputCreateUser.getMobile()); newUserBuilder.setGender(inputCreateUser.getGender()); if (inputCreateUser.getExtra() != null) newUserBuilder.setExtra(inputCreateUser.getExtra()); newUserBuilder.setType(inputCreateUser.getType()); newUserBuilder.setUpdateDt(System.currentTimeMillis()); try { messagesStore.addUserInfo(newUserBuilder.build()); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, IMExceptionEvent.EventType.ADMIN_API_Exception); setResponseContent(RestResult.resultOf(ErrorCode.ERROR_CODE_SERVER_ERROR, e.getMessage()), response); return true; } setResponseContent(RestResult.ok(new OutputCreateUser(inputCreateUser.getUserId(), inputCreateUser.getName())), response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/DestoryChatroomAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.InputDestoryChatroom; import io.moquette.spi.impl.Utils; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import cn.wildfirechat.common.ErrorCode; @Route(APIPath.Chatroom_Destroy) @HttpMethod("POST") public class DestoryChatroomAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { FullHttpRequest fullHttpRequest = (FullHttpRequest)request.getNettyRequest(); byte[] bytes = Utils.readBytesAndRewind(fullHttpRequest.content()); String content = new String(bytes); InputDestoryChatroom inputDestoryChatroom = gson.fromJson(content, InputDestoryChatroom.class); if (inputDestoryChatroom != null && !StringUtil.isNullOrEmpty(inputDestoryChatroom.getChatroomId())) { messagesStore.destoryChatroom(inputDestoryChatroom.getChatroomId()); setResponseContent(RestResult.ok(), response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/DestroyChannelAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputChannelId; import cn.wildfirechat.pojos.OutputCreateChannel; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import win.liyufan.im.IMTopic; @Route(APIPath.Destroy_Channel) @HttpMethod("POST") public class DestroyChannelAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputChannelId inputCreateChannel = getRequestBody(request.getNettyRequest(), InputChannelId.class); if (inputCreateChannel != null && !StringUtil.isNullOrEmpty(inputCreateChannel.channelId)) { WFCMessage.ChannelInfo channelInfo = messagesStore.getChannelInfo(inputCreateChannel.channelId); if(channelInfo == null) { setResponseContent(RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST), response); return true; } WFCMessage.IDBuf.Builder builder = WFCMessage.IDBuf.newBuilder().setId(inputCreateChannel.channelId); sendApiMessage(response, channelInfo.getOwner(), IMTopic.DestroyChannelInfoTopic, builder.build().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/DestroyUserAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputDestroyUser; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import win.liyufan.im.IMTopic; import java.util.Base64; @Route(APIPath.Destroy_User) @HttpMethod("POST") public class DestroyUserAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputDestroyUser inputDestroyUser = getRequestBody(request.getNettyRequest(), InputDestroyUser.class); if (inputDestroyUser != null && !StringUtil.isNullOrEmpty(inputDestroyUser.getUserId())) { WFCMessage.IDBuf idBuf = WFCMessage.IDBuf.newBuilder().setId(inputDestroyUser.getUserId()).build(); sendApiMessage(response, inputDestroyUser.getUserId(), IMTopic.DestroyUserTopic, idBuf.toByteArray(), result -> { ErrorCode errorCode1 = ErrorCode.fromCode(result[0]); return new Result(errorCode1); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/DismissGroupAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import cn.wildfirechat.pojos.InputDismissGroup; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Route(APIPath.Group_Dismiss) @HttpMethod("POST") public class DismissGroupAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputDismissGroup inputDismissGroup = getRequestBody(request.getNettyRequest(), InputDismissGroup.class); if (inputDismissGroup.isValide()) { sendApiMessage(response, inputDismissGroup.getOperator(), IMTopic.DismissGroupTopic, inputDismissGroup.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/FriendExtraPutAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputUpdateFriendExtra; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import win.liyufan.im.IMTopic; @Route(APIPath.Friend_Set_Extra) @HttpMethod("POST") public class FriendExtraPutAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputUpdateFriendExtra input = getRequestBody(request.getNettyRequest(), InputUpdateFriendExtra.class); if (input != null && !StringUtil.isNullOrEmpty(input.getOperator()) && !StringUtil.isNullOrEmpty(input.getTargetId())) { sendApiMessage(response, input.getOperator(), IMTopic.SetFriendExtraTopic, WFCMessage.StringPair.newBuilder().setKey(input.getTargetId()).setValue(input.getExtra()==null?"":input.getExtra()).build().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/FriendRelationAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import cn.wildfirechat.pojos.InputUpdateFriendStatusRequest; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Route(APIPath.Friend_Update_Status) @HttpMethod("POST") public class FriendRelationAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputUpdateFriendStatusRequest friendAdd = getRequestBody(request.getNettyRequest(), InputUpdateFriendStatusRequest.class); if (friendAdd != null && !StringUtil.isNullOrEmpty(friendAdd.getUserId()) && !StringUtil.isNullOrEmpty(friendAdd.getFriendUid()) ) { WFCMessage.HandleFriendRequest.Builder friendRequestBuilder = WFCMessage.HandleFriendRequest.newBuilder().setTargetUid(friendAdd.getFriendUid()).setStatus(friendAdd.getStatus()); if (!StringUtil.isNullOrEmpty(friendAdd.getExtra())) { friendRequestBuilder = friendRequestBuilder.setExtra(friendAdd.getExtra()); } sendApiMessage(response, friendAdd.getUserId(), IMTopic.HandleFriendRequestTopic, friendRequestBuilder.build().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/FriendRelationGetAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.InputUserId; import cn.wildfirechat.pojos.OutputStringList; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import com.xiaoleilu.loServer.model.FriendData; import cn.wildfirechat.pojos.InputGetFriendList; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @Route(APIPath.Friend_Get_List) @HttpMethod("POST") public class FriendRelationGetAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputUserId inputGetFriendList = getRequestBody(request.getNettyRequest(), InputUserId.class); List dataList = messagesStore.getFriendList(inputGetFriendList.getUserId(), null, 0); List list = new ArrayList<>(); dataList.sort(Comparator.comparingLong(FriendData::getTimestamp)); for (FriendData data : dataList) { if (data.getState() == 0) { list.add(data.getFriendUid()); } } setResponseContent(RestResult.ok(new OutputStringList(list)), response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetAllUserAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.InputGetUserList; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.OutputGetUserList; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.List; @Route(APIPath.User_Get_All) @HttpMethod("POST") public class GetAllUserAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetUserList input = getRequestBody(request.getNettyRequest(), InputGetUserList.class); if (input != null && input.count > 0 && input.offset >= 0) { List users = messagesStore.getUserInfoList(input.count, input.offset); OutputGetUserList outputGetUserList = new OutputGetUserList(); outputGetUserList.userInfoList = new ArrayList<>(); for (WFCMessage.User user : users) { outputGetUserList.userInfoList.add(InputOutputUserInfo.fromPbUser(user)); } RestResult result = RestResult.ok(outputGetUserList); setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetBatchUserAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.*; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.Collection; import java.util.List; @Route(APIPath.User_Batch_Get_Infos) @HttpMethod("POST") public class GetBatchUserAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputStringList inputUserId = getRequestBody(request.getNettyRequest(), InputStringList.class); if (inputUserId != null && inputUserId.getList() != null && !inputUserId.getList().isEmpty()) { OutputUserInfoList res = new OutputUserInfoList(); res.userInfos = new ArrayList<>(); for (String userId : inputUserId.getList()) { WFCMessage.User user = messagesStore.getUserInfo(userId); if(user == null || StringUtil.isNullOrEmpty(user.getName())) { continue; } InputOutputUserInfo inputOutputUserInfo = InputOutputUserInfo.fromPbUser(user); res.userInfos.add(inputOutputUserInfo); } RestResult result = RestResult.ok(res); setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetChannelAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputChannelId; import cn.wildfirechat.pojos.OutputGetChannelInfo; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; @Route(APIPath.Get_Channel_Info) @HttpMethod("POST") public class GetChannelAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputChannelId inputCreateChannel = getRequestBody(request.getNettyRequest(), InputChannelId.class); if (inputCreateChannel != null && !StringUtil.isNullOrEmpty(inputCreateChannel.channelId)) { WFCMessage.ChannelInfo channelInfo = messagesStore.getChannelInfo(inputCreateChannel.channelId); if (channelInfo == null) { setResponseContent(RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST), response); } else { setResponseContent(RestResult.ok(OutputGetChannelInfo.fromPbInfo(channelInfo)), response); } } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetChatroomInfoAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.*; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import cn.wildfirechat.common.ErrorCode; @Route(APIPath.Chatroom_Info) @HttpMethod("POST") public class GetChatroomInfoAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetChatroomInfo getChatroomInfo = getRequestBody(request.getNettyRequest(), InputGetChatroomInfo.class); String chatroomid = getChatroomInfo.getChatroomId(); if (!StringUtil.isNullOrEmpty(chatroomid)) { WFCMessage.ChatroomInfo info = messagesStore.getChatroomInfo(chatroomid); RestResult result; if (info != null) { result = RestResult.ok(new OutputGetChatroomInfo(chatroomid, messagesStore.getChatroomMemberCount(chatroomid), info)); } else { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetChatroomMembersAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetChatroomInfo; import cn.wildfirechat.pojos.OutputGetChatroomInfo; import cn.wildfirechat.pojos.OutputStringList; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.UserClientEntry; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.Collection; import java.util.List; @Route(APIPath.Chatroom_GetMembers) @HttpMethod("POST") public class GetChatroomMembersAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetChatroomInfo getChatroomInfo = getRequestBody(request.getNettyRequest(), InputGetChatroomInfo.class); String chatroomid = getChatroomInfo.getChatroomId(); if (!StringUtil.isNullOrEmpty(chatroomid)) { Collection members = messagesStore.getChatroomMembers(chatroomid); List list = new ArrayList<>(); for (UserClientEntry entry : members) { list.add(entry.userId); } RestResult result; if (!list.isEmpty()) { result = RestResult.ok(new OutputStringList(list)); } else { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetCommonGroupsAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputUserId; import cn.wildfirechat.pojos.OutputGroupIds; import cn.wildfirechat.pojos.StringPairPojo; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.Set; @Route(APIPath.Get_Common_Groups) @HttpMethod("POST") public class GetCommonGroupsAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { StringPairPojo input = getRequestBody(request.getNettyRequest(), StringPairPojo.class); if (input != null && (!StringUtil.isNullOrEmpty(input.getFirst())) && (!StringUtil.isNullOrEmpty(input.getSecond()))) { Set groupIds = messagesStore.getCommonGroupIds(input.getFirst(), input.getSecond()); OutputGroupIds outputGroupIds = new OutputGroupIds(); outputGroupIds.setGroupIds(new ArrayList<>(groupIds)); RestResult result = RestResult.ok(outputGroupIds); setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetGroupInfoAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetGroup; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.PojoGroupInfo; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; @Route(APIPath.Group_Get_Info) @HttpMethod("POST") public class GetGroupInfoAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetGroup inputGetGroup = getRequestBody(request.getNettyRequest(), InputGetGroup.class); if (inputGetGroup != null && (!StringUtil.isNullOrEmpty(inputGetGroup.getGroupId()))) { WFCMessage.GroupInfo groupInfo = messagesStore.getGroupInfo(inputGetGroup.getGroupId()); RestResult result; if (groupInfo == null) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } else { PojoGroupInfo pojoGroupInfo = new PojoGroupInfo(); pojoGroupInfo.setExtra(groupInfo.getExtra()); pojoGroupInfo.setName(groupInfo.getName()); pojoGroupInfo.setOwner(groupInfo.getOwner()); pojoGroupInfo.setPortrait(groupInfo.getPortrait()); pojoGroupInfo.setTarget_id(groupInfo.getTargetId()); pojoGroupInfo.setType(groupInfo.getType()); pojoGroupInfo.setMember_count(groupInfo.getMemberCount()); pojoGroupInfo.setMute(groupInfo.getMute()); pojoGroupInfo.setJoin_type(groupInfo.getJoinType()); pojoGroupInfo.setPrivate_chat(groupInfo.getPrivateChat()); pojoGroupInfo.setSearchable(groupInfo.getSearchable()); pojoGroupInfo.setMax_member_count(groupInfo.getMemberCount()); pojoGroupInfo.setHistory_message(groupInfo.getHistoryMessage()); pojoGroupInfo.setSuper_group(groupInfo.getSuperGroup()>0); pojoGroupInfo.setDeleted(groupInfo.getDeleted()>0); pojoGroupInfo.setUpdate_dt(groupInfo.getUpdateDt()); pojoGroupInfo.setMember_update_dt(groupInfo.getMemberUpdateDt()); result = RestResult.ok(pojoGroupInfo); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetGroupMemberAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetGroup; import cn.wildfirechat.pojos.InputGetGroupMember; import cn.wildfirechat.pojos.OutputGroupMemberList; import cn.wildfirechat.pojos.PojoGroupMember; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.List; @Route(APIPath.Group_Member_Get) @HttpMethod("POST") public class GetGroupMemberAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetGroupMember input = getRequestBody(request.getNettyRequest(), InputGetGroupMember.class); if (input != null && (!StringUtil.isNullOrEmpty(input.getGroupId())) && (!StringUtil.isNullOrEmpty(input.getMemberId()))) { WFCMessage.GroupMember groupMember = messagesStore.getGroupMember(input.getGroupId(), input.getMemberId()); RestResult result; if (groupMember == null || StringUtil.isNullOrEmpty(groupMember.getMemberId()) || groupMember.getType() == ProtoConstants.GroupMemberType.GroupMemberType_Removed) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } else { PojoGroupMember pm = new PojoGroupMember(); pm.setMember_id(groupMember.getMemberId()); pm.setAlias(groupMember.getAlias()); pm.setType(groupMember.getType()); pm.setExtra(groupMember.getExtra()); pm.setCreateDt(groupMember.getCreateDt()); result = RestResult.ok(pm); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetGroupMembersAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetGroup; import cn.wildfirechat.pojos.OutputGroupMemberList; import cn.wildfirechat.pojos.PojoGroupInfo; import cn.wildfirechat.pojos.PojoGroupMember; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.List; @Route(APIPath.Group_Member_List) @HttpMethod("POST") public class GetGroupMembersAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetGroup inputGetGroup = getRequestBody(request.getNettyRequest(), InputGetGroup.class); if (inputGetGroup != null && (!StringUtil.isNullOrEmpty(inputGetGroup.getGroupId()))) { List members = new ArrayList<>(); ErrorCode errorCode = messagesStore.getGroupMembers(null, inputGetGroup.getGroupId(), 0, members); RestResult result; if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { result = RestResult.resultOf(errorCode); } else { OutputGroupMemberList out = new OutputGroupMemberList(); out.setMembers(new ArrayList<>()); for (WFCMessage.GroupMember member : members) { if (member.getType() == ProtoConstants.GroupMemberType.GroupMemberType_Removed) { continue; } PojoGroupMember pm = new PojoGroupMember(); pm.setMember_id(member.getMemberId()); pm.setAlias(member.getAlias()); pm.setType(member.getType()); pm.setExtra(member.getExtra()); pm.setCreateDt(member.getCreateDt()); out.getMembers().add(pm); } result = RestResult.ok(out); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetIMTokenAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import cn.wildfirechat.pojos.InputGetToken; import cn.wildfirechat.pojos.OutputGetIMTokenData; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import cn.wildfirechat.common.ErrorCode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.GitRepositoryState; import win.liyufan.im.IMTopic; import java.util.Base64; @Route(APIPath.User_Get_Token) @HttpMethod("POST") public class GetIMTokenAction extends AdminAction { private static final Logger LOG = LoggerFactory.getLogger(GetIMTokenAction.class); @Override public boolean isTransactionAction() { return false; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetToken input = getRequestBody(request.getNettyRequest(), InputGetToken.class); String userId = input.getUserId(); WFCMessage.GetTokenRequest getTokenRequest = WFCMessage.GetTokenRequest.newBuilder().setUserId(userId).setClientId(input.getClientId()).setPlatform(input.getPlatform() == null ? 0 : input.getPlatform()).build(); sendApiMessage(response, userId, input.getClientId(), IMTopic.GetTokenTopic, getTokenRequest.toByteArray(), result -> { ErrorCode errorCode1 = ErrorCode.fromCode(result[0]); if (errorCode1 == ErrorCode.ERROR_CODE_SUCCESS) { //ba errorcode qudiao byte[] data = new byte[result.length -1]; for (int i = 0; i < data.length; i++) { data[i] = result[i+1]; } String token = Base64.getEncoder().encodeToString(data); LOG.info("get im token success {},{},{}", userId, input.getClientId(), token.substring(0, Math.min(10, token.length()))); return new Result(errorCode1, new OutputGetIMTokenData(userId, token, GitRepositoryState.globalLabel)); } else { return new Result(errorCode1); } }, false); return false; } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetMessageAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputMessageUid; import cn.wildfirechat.pojos.OutputMessageData; import cn.wildfirechat.pojos.RecallMessageData; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import win.liyufan.im.IMTopic; @Route(APIPath.Msg_GetOne) @HttpMethod("POST") public class GetMessageAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputMessageUid inputMessageUid = getRequestBody(request.getNettyRequest(), InputMessageUid.class); if (inputMessageUid != null && inputMessageUid.messageUid > 0) { RestResult result; WFCMessage.Message msg = messagesStore.getMessage(inputMessageUid.messageUid); if(msg == null) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } else { result = RestResult.ok(OutputMessageData.fromProtoMessage(msg)); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetOnlineUserAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.*; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.MemorySessionStore; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import java.util.Collection; @Route(APIPath.User_Online_List) @HttpMethod("POST") public class GetOnlineUserAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { GetOnlineUserRequest getOnlineUserRequest = getRequestBody(request.getNettyRequest(), GetOnlineUserRequest.class); if (getOnlineUserRequest.nodeId == 1) { GetOnlineUserResult result = messagesStore.getOnlineUsers(getOnlineUserRequest.offset, getOnlineUserRequest.count); setResponseContent(RestResult.ok(result), response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetRobotAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.InputRobotId; import cn.wildfirechat.pojos.OutputRobot; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; @Route(APIPath.User_Get_Robot_Info) @HttpMethod("POST") public class GetRobotAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputRobotId inputUserId = getRequestBody(request.getNettyRequest(), InputRobotId.class); if (inputUserId != null && (!StringUtil.isNullOrEmpty(inputUserId.getRobotId()))) { WFCMessage.User user = messagesStore.getUserInfo(inputUserId.getRobotId()); WFCMessage.Robot robot = messagesStore.getRobot(inputUserId.getRobotId()); RestResult result; if (user == null || robot == null) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } else { OutputRobot outputRobot = new OutputRobot(); outputRobot.fromUser(user); outputRobot.fromRobot(robot, true); result = RestResult.ok(outputRobot); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetSystemSettingAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.SystemSettingPojo; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; @Route(APIPath.Get_System_Setting) @HttpMethod("POST") public class GetSystemSettingAction extends AdminAction { @Override public boolean isTransactionAction() { return false; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { SystemSettingPojo inputUserId = getRequestBody(request.getNettyRequest(), SystemSettingPojo.class); if (inputUserId != null) { SystemSettingPojo output = messagesStore.getSystemSetting(inputUserId.id); RestResult result; if (output == null) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } else { result = RestResult.ok(output); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUploadUrlAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetPresignedUploadUrl; import cn.wildfirechat.pojos.OutputPresignedUploadUrl; import com.qiniu.util.Auth; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.action.robot.RobotAction; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.server.config.MediaServerConfig; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import java.util.UUID; @Route(APIPath.Get_Presigned_Upload_Url) @HttpMethod("POST") public class GetUploadUrlAction extends AdminAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { if(!MediaServerConfig.USER_QINIU) { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); return true; } InputGetPresignedUploadUrl inputUserId = getRequestBody(request.getNettyRequest(), InputGetPresignedUploadUrl.class); if (StringUtil.isNullOrEmpty(inputUserId.contentType)) { inputUserId.contentType = "application/octet-stream"; } String uuid = UUID.randomUUID().toString().replace("-", ""); inputUserId.fileName = uuid + inputUserId.fileName; int type = inputUserId.mediaType; String bucketName; String bucketDomain; switch (type) { case 0: default: bucketName = MediaServerConfig.QINIU_BUCKET_GENERAL_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_GENERAL_DOMAIN; break; case 1: bucketName = MediaServerConfig.QINIU_BUCKET_IMAGE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_IMAGE_DOMAIN; break; case 2: bucketName = MediaServerConfig.QINIU_BUCKET_VOICE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_VOICE_DOMAIN; break; case 3: bucketName = MediaServerConfig.QINIU_BUCKET_VIDEO_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_VIDEO_DOMAIN; break; case 4: bucketName = MediaServerConfig.QINIU_BUCKET_FILE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_FILE_DOMAIN; break; case 5: bucketName = MediaServerConfig.QINIU_BUCKET_PORTRAIT_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_PORTRAIT_DOMAIN; break; case 6: bucketName = MediaServerConfig.QINIU_BUCKET_FAVORITE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_FAVORITE_DOMAIN; break; case 7: bucketName = MediaServerConfig.QINIU_BUCKET_STICKER_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_STICKER_DOMAIN; break; case 8: bucketName = MediaServerConfig.QINIU_BUCKET_MOMENTS_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_MOMENTS_DOMAIN; break; case 9: bucketName = MediaServerConfig.QINIU_BUCKET_CUSTOM1_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_CUSTOM1_DOMAIN; break; case 10: bucketName = MediaServerConfig.QINIU_BUCKET_CUSTOM2_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_CUSTOM2_DOMAIN; break; case 11: bucketName = MediaServerConfig.QINIU_BUCKET_CUSTOM3_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_CUSTOM3_DOMAIN; break; case 12: bucketName = MediaServerConfig.QINIU_BUCKET_PAN_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_PAN_DOMAIN; break; } if(StringUtil.isNullOrEmpty(bucketName)) { bucketName = MediaServerConfig.QINIU_BUCKET_GENERAL_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_GENERAL_DOMAIN; } String key = inputUserId.fileName; Auth auth = Auth.create(MediaServerConfig.QINIU_ACCESS_KEY, MediaServerConfig.QINIU_SECRET_KEY); String token = auth.uploadToken(bucketName, key); String downloadUrl = bucketDomain + "/" + key; String uploadUrl = "https://" + MediaServerConfig.QINIU_SERVER_URL + "?" + token + "?" + key; OutputPresignedUploadUrl outputPresignedUploadUrl = new OutputPresignedUploadUrl(); outputPresignedUploadUrl.uploadUrl = uploadUrl; outputPresignedUploadUrl.downloadUrl = downloadUrl; outputPresignedUploadUrl.type = 1; setResponseContent(RestResult.ok(outputPresignedUploadUrl), response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.InputGetUserInfo; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import cn.wildfirechat.common.ErrorCode; @Route(APIPath.User_Get_Info) @HttpMethod("POST") public class GetUserAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetUserInfo inputUserId = getRequestBody(request.getNettyRequest(), InputGetUserInfo.class); if (inputUserId != null && (!StringUtil.isNullOrEmpty(inputUserId.getUserId()) || !StringUtil.isNullOrEmpty(inputUserId.getName()) || !StringUtil.isNullOrEmpty(inputUserId.getMobile()))) { WFCMessage.User user = null; if(!StringUtil.isNullOrEmpty(inputUserId.getUserId())) { user = messagesStore.getUserInfo(inputUserId.getUserId()); } else if(!StringUtil.isNullOrEmpty(inputUserId.getName())) { user = messagesStore.getUserInfoByName(inputUserId.getName()); } else if(!StringUtil.isNullOrEmpty(inputUserId.getMobile())) { user = messagesStore.getUserInfoByMobile(inputUserId.getMobile()); } RestResult result; if (user == null || (user.getDeleted() > 0 && !inputUserId.isIncludeDeleted())) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } else { result = RestResult.ok(InputOutputUserInfo.fromPbUser(user)); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserBlockListAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.OutputUserBlockStatusList; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; @Route(APIPath.User_Get_Blocked_List) @HttpMethod("POST") public class GetUserBlockListAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { OutputUserBlockStatusList list = new OutputUserBlockStatusList(); list.setStatusList(messagesStore.getUserStatusList()); RestResult result = RestResult.ok(list); setResponseContent(result, response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserBlockStatusAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.OutputUserStatus; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import cn.wildfirechat.common.ErrorCode; @Route(APIPath.User_Check_Block_Status) @HttpMethod("POST") public class GetUserBlockStatusAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetUserInfo inputUserId = getRequestBody(request.getNettyRequest(), InputGetUserInfo.class); if (inputUserId != null && !StringUtil.isNullOrEmpty(inputUserId.getUserId())) { int status = messagesStore.getUserStatus(inputUserId.getUserId()); setResponseContent(RestResult.ok(new OutputUserStatus(status)), response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserChatroomAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetChatroomInfo; import cn.wildfirechat.pojos.InputUserId; import cn.wildfirechat.pojos.OutputStringList; import cn.wildfirechat.pojos.OutputUserChatroom; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.UserClientEntry; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.Collection; import java.util.List; @Route(APIPath.Chatroom_GetUserChatroom) @HttpMethod("POST") public class GetUserChatroomAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputUserId inputUserId = getRequestBody(request.getNettyRequest(), InputUserId.class); String userId = inputUserId.getUserId(); if (!StringUtil.isNullOrEmpty(userId)) { OutputUserChatroom outputUserChatroom = messagesStore.getUserChatroom(userId); RestResult result; if (outputUserChatroom != null) { result = RestResult.ok(outputUserChatroom); } else { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserGroupsAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetGroup; import cn.wildfirechat.pojos.InputUserId; import cn.wildfirechat.pojos.OutputGroupIds; import cn.wildfirechat.pojos.PojoGroupInfo; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.Set; @Route(APIPath.Get_User_Groups) @HttpMethod("POST") public class GetUserGroupsAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputUserId inputUserId = getRequestBody(request.getNettyRequest(), InputUserId.class); if (inputUserId != null && (!StringUtil.isNullOrEmpty(inputUserId.getUserId()))) { Set groupIds = messagesStore.getUserGroupIds(inputUserId.getUserId()); OutputGroupIds outputGroupIds = new OutputGroupIds(); outputGroupIds.setGroupIds(new ArrayList<>(groupIds)); RestResult result = RestResult.ok(outputGroupIds); setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserGroupsByTypeAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetUserGroupByType; import cn.wildfirechat.pojos.InputUserId; import cn.wildfirechat.pojos.OutputGroupIds; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.Set; @Route(APIPath.Get_User_Groups_By_Type) @HttpMethod("POST") public class GetUserGroupsByTypeAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetUserGroupByType input = getRequestBody(request.getNettyRequest(), InputGetUserGroupByType.class); if (input != null && (!StringUtil.isNullOrEmpty(input.getUserId()))) { Set groupIds = messagesStore.getUserGroupIds(input.getUserId(), input.getGroupMemberTypes()); OutputGroupIds outputGroupIds = new OutputGroupIds(); outputGroupIds.setGroupIds(new ArrayList<>(groupIds)); RestResult result = RestResult.ok(outputGroupIds); setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserOnlineCountAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.GetOnlineUserCountResult; import cn.wildfirechat.pojos.GetUserSessionResult; import cn.wildfirechat.pojos.InputUserId; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.MemorySessionStore; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import java.util.Collection; @Route(APIPath.User_Online_Count) @HttpMethod("POST") public class GetUserOnlineCountAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { int count = messagesStore.getOnlineUserCount(); GetOnlineUserCountResult result = new GetOnlineUserCountResult(); GetOnlineUserCountResult.Node node = new GetOnlineUserCountResult.Node(); node.node = 1; node.count = count; result.add(node); setResponseContent(RestResult.ok(result), response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserRobotsAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputRobotId; import cn.wildfirechat.pojos.InputUserId; import cn.wildfirechat.pojos.OutputRobot; import cn.wildfirechat.pojos.OutputStringList; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; @Route(APIPath.User_Get_User_Robots) @HttpMethod("POST") public class GetUserRobotsAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputUserId inputUserId = getRequestBody(request.getNettyRequest(), InputUserId.class); if (inputUserId != null && (!StringUtil.isNullOrEmpty(inputUserId.getUserId()))) { RestResult result = RestResult.ok(new OutputStringList(messagesStore.getUserRobotIds(inputUserId.getUserId()))); setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUserSessionsAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.GetUserSessionResult; import cn.wildfirechat.pojos.InputGetChatroomInfo; import cn.wildfirechat.pojos.InputUserId; import cn.wildfirechat.pojos.OutputStringList; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.MemorySessionStore; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import java.util.Collection; @Route(APIPath.User_Session_List) @HttpMethod("POST") public class GetUserSessionsAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputUserId inputUserId = getRequestBody(request.getNettyRequest(), InputUserId.class); String userId = inputUserId.getUserId(); if (!StringUtil.isNullOrEmpty(userId)) { Collection sessions = sessionsStore.sessionForUser(userId); GetUserSessionResult result = new GetUserSessionResult(); for (MemorySessionStore.Session session : sessions) { boolean isOnline = sessionsStore.isClientOnline(session.getClientID()); result.userSessions.add(new GetUserSessionResult.UserSession(session.getUsername(), session.getClientID(), session.getPlatform(), session.getPushType(), session.getDeviceToken(), session.getVoipDeviceToken(), isOnline)); } setResponseContent(RestResult.ok(result), response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/GetUsersByEmailAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.OutputUserInfoList; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.List; @Route(APIPath.User_Get_Email_Info) @HttpMethod("POST") public class GetUsersByEmailAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { String email = getRequestBody(request.getNettyRequest(), String.class); if (!StringUtil.isNullOrEmpty(email)) { List users = messagesStore.getUserInfosByEmail(email); List list = new ArrayList<>(); for (WFCMessage.User user : users) { list.add(InputOutputUserInfo.fromPbUser(user)); } RestResult result; if (list.isEmpty()) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } else { OutputUserInfoList outputUserInfoList = new OutputUserInfoList(); outputUserInfoList.userInfos = list; result = RestResult.ok(outputUserInfoList); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/HealthAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.OutputUserBlockStatusList; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import java.io.File; import java.lang.management.OperatingSystemMXBean; import static java.lang.management.ManagementFactory.getOperatingSystemMXBean; @Route(APIPath.Health) public class HealthAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { JSONObject jsonObject = new JSONObject(); jsonObject.put("node", "1"); JSONObject cpuObject = new JSONObject(); jsonObject.put("cpu", cpuObject); JSONObject memoryObject = new JSONObject(); jsonObject.put("memory", memoryObject); JSONObject fileObject = new JSONObject(); jsonObject.put("disk", fileObject); if (getOperatingSystemMXBean() instanceof OperatingSystemMXBean) { double load = getOperatingSystemMXBean().getSystemLoadAverage(); cpuObject.put("load", load); } cpuObject.put("cores", Runtime.getRuntime().availableProcessors()); memoryObject.put("free", Runtime.getRuntime().freeMemory()); memoryObject.put("max", Runtime.getRuntime().maxMemory()); memoryObject.put("avail", Runtime.getRuntime().totalMemory()); File root = new File("/"); fileObject.put("space", root.getTotalSpace()); fileObject.put("free", root.getFreeSpace()); fileObject.put("usable", root.getUsableSpace()); JSONArray out = new JSONArray(); out.add(jsonObject); RestResult result = RestResult.ok(out); setResponseContent(result, response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/KickoffGroupMemberAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import cn.wildfirechat.pojos.InputKickoffGroupMember; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Route(APIPath.Group_Member_Kickoff) @HttpMethod("POST") public class KickoffGroupMemberAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputKickoffGroupMember inputKickoffGroupMember = getRequestBody(request.getNettyRequest(), InputKickoffGroupMember.class); if (inputKickoffGroupMember.isValide()) { sendApiMessage(response, inputKickoffGroupMember.getOperator(), IMTopic.KickoffGroupMemberTopic, inputKickoffGroupMember.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/KickoffUserClientAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.StringPairPojo; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; @Route(APIPath.User_Kickoff_Client) @HttpMethod("POST") public class KickoffUserClientAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { StringPairPojo pojo = getRequestBody(request.getNettyRequest(), StringPairPojo.class); if (pojo != null && !StringUtil.isNullOrEmpty(pojo.getFirst())) { sessionsStore.kickoffUserClient(pojo.getFirst(), pojo.getSecond()); sendResponse(response, ErrorCode.ERROR_CODE_SUCCESS, null); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/ModifyGroupInfoAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputModifyGroupInfo; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Group_Modify_Info) @HttpMethod("POST") public class ModifyGroupInfoAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputModifyGroupInfo inputAddGroupMember = getRequestBody(request.getNettyRequest(), InputModifyGroupInfo.class); if (inputAddGroupMember.isValide()) { sendApiMessage(response, inputAddGroupMember.getOperator(), IMTopic.ModifyGroupInfoTopic, inputAddGroupMember.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/ModifyGroupMemberAliasAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputSetGroupMemberAlias; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Group_Set_Member_Alias) @HttpMethod("POST") public class ModifyGroupMemberAliasAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputSetGroupMemberAlias inputSetGroupMemberAlias = getRequestBody(request.getNettyRequest(), InputSetGroupMemberAlias.class); if (inputSetGroupMemberAlias.isValide()) { sendApiMessage(response, inputSetGroupMemberAlias.getOperator(), IMTopic.ModifyGroupMemberAliasTopic, inputSetGroupMemberAlias.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/ModifyGroupMemberExtraAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputSetGroupMemberExtra; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; import java.util.concurrent.Executor; @Route(APIPath.Group_Set_Member_Extra) @HttpMethod("POST") public class ModifyGroupMemberExtraAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputSetGroupMemberExtra inputSetGroupMemberExtra = getRequestBody(request.getNettyRequest(), InputSetGroupMemberExtra.class); if (inputSetGroupMemberExtra.isValide()) { sendApiMessage(response, inputSetGroupMemberExtra.getOperator(), IMTopic.ModifyGroupMemberExtraTopic, inputSetGroupMemberExtra.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { response.setStatus(HttpResponseStatus.OK); RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER); response.setContent(gson.toJson(result)); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/MulticastMessageAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.MultiMessageResult; import cn.wildfirechat.pojos.MulticastMessageData; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Msg_Multicast) @HttpMethod("POST") public class MulticastMessageAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { MulticastMessageData sendMessageData = getRequestBody(request.getNettyRequest(), MulticastMessageData.class); if (MulticastMessageData.isValide(sendMessageData)) { sendApiMessage(response, sendMessageData.getSender(), IMTopic.MultiCastMessageTopic, sendMessageData.toProtoMessage().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { long messageId = byteBuf.readLong(); long timestamp = byteBuf.readLong(); return new Result(errorCode, new MultiMessageResult(messageId, timestamp)); } else { return new Result(errorCode); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/PutSystemSettingAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.SystemSettingPojo; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; @Route(APIPath.Put_System_Setting) @HttpMethod("POST") public class PutSystemSettingAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { SystemSettingPojo inputUserId = getRequestBody(request.getNettyRequest(), SystemSettingPojo.class); if (inputUserId != null && (!StringUtil.isNullOrEmpty(inputUserId.value) || !StringUtil.isNullOrEmpty(inputUserId.desc))) { boolean success = messagesStore.updateSystemSetting(inputUserId.id, inputUserId.value, inputUserId.desc); RestResult result; if (!success) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_SERVER_ERROR); } else { result = RestResult.ok(); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/QuitGroupMemberAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputQuitGroup; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Group_Member_Quit) @HttpMethod("POST") public class QuitGroupMemberAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputQuitGroup inputQuitGroup = getRequestBody(request.getNettyRequest(), InputQuitGroup.class); if (inputQuitGroup.isValide()) { sendApiMessage(response, inputQuitGroup.getOperator(), IMTopic.QuitGroupTopic, inputQuitGroup.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/RecallMessageAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import cn.wildfirechat.pojos.RecallMessageData; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import java.nio.charset.StandardCharsets; import java.util.Arrays; @Route(APIPath.Msg_Recall) @HttpMethod("POST") public class RecallMessageAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { RecallMessageData recallMessageData = getRequestBody(request.getNettyRequest(), RecallMessageData.class); if (recallMessageData != null && !StringUtil.isNullOrEmpty(recallMessageData.getOperator())) { WFCMessage.INT64Buf idBuf = WFCMessage.INT64Buf.newBuilder().setId(recallMessageData.getMessageUid()).build(); sendApiMessage(response, recallMessageData.getOperator(), IMTopic.RecallMessageTopic, idBuf.toByteArray(), result -> { ErrorCode errorCode = ErrorCode.fromCode(result[0]); byte[] data = Arrays.copyOfRange(result,1, result.length); return new Result(errorCode, new String(data, StandardCharsets.UTF_8)); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/RecallMultiCastMessageAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.RecallMultiCastMessageData; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import win.liyufan.im.IMTopic; @Route(APIPath.Msg_RecallMultiCast) @HttpMethod("POST") public class RecallMultiCastMessageAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { RecallMultiCastMessageData recallMessageData = getRequestBody(request.getNettyRequest(), RecallMultiCastMessageData.class); if (recallMessageData != null && !StringUtil.isNullOrEmpty(recallMessageData.operator)) { WFCMessage.RecallMultiCastMessageRequest recallRequest = WFCMessage.RecallMultiCastMessageRequest.newBuilder().setMessageId(recallMessageData.messageUid).addAllReceiver(recallMessageData.receivers).build(); sendApiMessage(response, recallMessageData.operator, IMTopic.RecallMultiCastMessageTopic, recallRequest.toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/RelationGetAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.InputUserId; import cn.wildfirechat.pojos.OutputStringList; import cn.wildfirechat.pojos.RelationPojo; import cn.wildfirechat.pojos.StringPairPojo; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import com.xiaoleilu.loServer.model.FriendData; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import java.util.ArrayList; import java.util.Comparator; import java.util.List; @Route(APIPath.Relation_Get) @HttpMethod("POST") public class RelationGetAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { StringPairPojo input = getRequestBody(request.getNettyRequest(), StringPairPojo.class); FriendData data = messagesStore.getFriendData(input.getFirst(), input.getSecond()); RelationPojo out = new RelationPojo(); out.userId = input.getFirst(); out.targetId = input.getSecond(); if(data != null ) { out.isFriend = data.getState() == 0; out.isBlacked = data.getBlacked() == 1; out.alias = data.getAlias(); out.extra = data.getExtra(); } setResponseContent(RestResult.ok(out), response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/SendMessageAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import com.google.gson.Gson; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import cn.wildfirechat.pojos.SendMessageData; import cn.wildfirechat.pojos.SendMessageResult; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Route(APIPath.Msg_Send) @HttpMethod("POST") public class SendMessageAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { SendMessageData sendMessageData = getRequestBody(request.getNettyRequest(), SendMessageData.class); if (SendMessageData.isValide(sendMessageData) && !StringUtil.isNullOrEmpty(sendMessageData.getSender())) { sendApiMessage(response, sendMessageData.getSender(), IMTopic.SendMessageTopic, sendMessageData.toProtoMessage().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { long messageId = byteBuf.readLong(); long timestamp = byteBuf.readLong(); return new Result(errorCode, new SendMessageResult(messageId, timestamp)); } else { return new Result(errorCode); } }, sendMessageData.isUserMessage()); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/SensitiveWordAddAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.InputOutputSensitiveWords; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import cn.wildfirechat.common.ErrorCode; @Route(APIPath.Sensitive_Add) @HttpMethod("POST") public class SensitiveWordAddAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputOutputSensitiveWords input = getRequestBody(request.getNettyRequest(), InputOutputSensitiveWords.class); if (input != null && input.getWords() != null && !input.getWords().isEmpty()) { ErrorCode errorCode = messagesStore.addSensitiveWords(input.getWords()) ? ErrorCode.ERROR_CODE_SUCCESS : ErrorCode.ERROR_CODE_SERVER_ERROR; response.setStatus(HttpResponseStatus.OK); sendResponse(response, errorCode, null); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/SensitiveWordDeleteAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.InputOutputSensitiveWords; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import cn.wildfirechat.common.ErrorCode; @Route(APIPath.Sensitive_Del) @HttpMethod("POST") public class SensitiveWordDeleteAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputOutputSensitiveWords input = getRequestBody(request.getNettyRequest(), InputOutputSensitiveWords.class); if (input != null && input.getWords() != null && !input.getWords().isEmpty()) { ErrorCode errorCode = messagesStore.removeSensitiveWords(input.getWords()) ? ErrorCode.ERROR_CODE_SUCCESS : ErrorCode.ERROR_CODE_SERVER_ERROR; response.setStatus(HttpResponseStatus.OK); sendResponse(response, errorCode, null); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/SensitiveWordQueryAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.InputOutputSensitiveWords; import io.netty.handler.codec.http.FullHttpRequest; import cn.wildfirechat.common.ErrorCode; import java.util.List; @Route(APIPath.Sensitive_Query) @HttpMethod("POST") public class SensitiveWordQueryAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { List words = messagesStore.getAllSensitiveWords(); InputOutputSensitiveWords out = new InputOutputSensitiveWords(); out.setWords(words); sendResponse(response, ErrorCode.ERROR_CODE_SUCCESS, out); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/SetGroupManagerAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputSetGroupManager; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Group_Set_Manager) @HttpMethod("POST") public class SetGroupManagerAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputSetGroupManager inputAddGroupMember = getRequestBody(request.getNettyRequest(), InputSetGroupManager.class); if (inputAddGroupMember.isValide()) { sendApiMessage(response, inputAddGroupMember.getOperator(), IMTopic.SetGroupManagerTopic, inputAddGroupMember.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/TransferGroupAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import cn.wildfirechat.pojos.InputTransferGroup; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Route(APIPath.Group_Transfer) @HttpMethod("POST") public class TransferGroupAction extends AdminAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputTransferGroup inputDismissGroup = getRequestBody(request.getNettyRequest(), InputTransferGroup.class); if (inputDismissGroup.isValide()) { sendApiMessage(response, inputDismissGroup.getOperator(), IMTopic.TransferGroupTopic, inputDismissGroup.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); return new Result(errorCode); }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/admin/UpdateUserAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.admin; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.common.IMExceptionEvent; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.InputUpdateUserInfo; import cn.wildfirechat.pojos.OutputCreateUser; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.UUIDGenerator; import win.liyufan.im.Utility; @Route(APIPath.Update_User) @HttpMethod("POST") public class UpdateUserAction extends AdminAction { private static final Logger LOG = LoggerFactory.getLogger(UpdateUserAction.class); @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputUpdateUserInfo inputCreateUser = getRequestBody(request.getNettyRequest(), InputUpdateUserInfo.class); if (inputCreateUser != null && inputCreateUser.userInfo != null && !StringUtil.isNullOrEmpty(inputCreateUser.userInfo.getUserId()) && inputCreateUser.flag > 0) { ErrorCode errorCode = messagesStore.updateUserInfo(inputCreateUser.userInfo, inputCreateUser.flag); setResponseContent(RestResult.resultOf(errorCode), response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/channel/ApplicationGetUserInfoAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.channel; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputApplicationGetUserInfo; import cn.wildfirechat.pojos.OutputApplicationUserInfo; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; @Route(APIPath.Channel_Application_Get_UserInfo) @HttpMethod("POST") public class ApplicationGetUserInfoAction extends ChannelAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputApplicationGetUserInfo inputUserToken = getRequestBody(request.getNettyRequest(), InputApplicationGetUserInfo.class); RestResult result; if (inputUserToken == null || StringUtil.isNullOrEmpty(inputUserToken.getAuthCode())) { result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER); } else { String userId = messagesStore.verifyApplicationAuthCode(inputUserToken.getAuthCode(), channelInfo.getTargetId(), ProtoConstants.ApplicationType.ApplicationType_Channel); if(userId != null) { OutputApplicationUserInfo outputVerifyApplicationUser = new OutputApplicationUserInfo(); outputVerifyApplicationUser.setUserId(userId); WFCMessage.User user = messagesStore.getUserInfo(userId); if(user != null) { outputVerifyApplicationUser.setDisplayName(user.getDisplayName()); outputVerifyApplicationUser.setPortraitUrl(user.getPortrait()); } result = RestResult.ok(outputVerifyApplicationUser); } else { result = RestResult.resultOf(ErrorCode.ERROR_CODE_APPLICATION_TOKEN_ERROR_OR_TIMEOUT); } } response.setStatus(HttpResponseStatus.OK); response.setContent(gson.toJson(result)); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/channel/ChannelAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.channel; import cn.wildfirechat.common.IMExceptionEvent; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.action.Action; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.ServerAPIHelper; import io.moquette.spi.impl.Utils; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import org.apache.commons.codec.digest.DigestUtils; import cn.wildfirechat.common.ErrorCode; import org.slf4j.LoggerFactory; import win.liyufan.im.RateLimiter; import win.liyufan.im.Utility; import java.nio.charset.StandardCharsets; import java.util.concurrent.Executor; abstract public class ChannelAction extends Action { private static final org.slf4j.Logger LOG = LoggerFactory.getLogger(ChannelAction.class); protected WFCMessage.ChannelInfo channelInfo; protected interface Callback { void onSuccess(byte[] response); } @Override public ErrorCode preAction(Request request, Response response) { String nonce = request.getHeader("nonce"); if (StringUtil.isNullOrEmpty(nonce)) { nonce = request.getHeader("Nonce"); } String timestamp = request.getHeader("timestamp"); if (StringUtil.isNullOrEmpty(timestamp)) { timestamp = request.getHeader("Timestamp"); } String sign = request.getHeader("sign"); if (StringUtil.isNullOrEmpty(sign)) { sign = request.getHeader("Sign"); } String cid = request.getHeader("cid"); if (StringUtil.isNullOrEmpty(cid)) { cid = request.getHeader("Cid"); } if (StringUtil.isNullOrEmpty(nonce) || StringUtil.isNullOrEmpty(timestamp) || StringUtil.isNullOrEmpty(sign) || StringUtil.isNullOrEmpty(cid)) { return ErrorCode.ERROR_CODE_API_NOT_SIGNED; } if (!channelLimiter.isGranted(cid)) { return ErrorCode.ERROR_CODE_OVER_FREQUENCY; } Long ts; try { ts = Long.parseLong(timestamp); } catch (Exception e) { LOG.error("Channel timestamp:{} invalid", timestamp); e.printStackTrace(); Utility.printExecption(LOG, e, IMExceptionEvent.EventType.CHANNEL_API_Exception); return ErrorCode.ERROR_CODE_API_NOT_SIGNED; } if (System.currentTimeMillis() - ts > 2 * 60 * 60 * 1000) { return ErrorCode.ERROR_CODE_SIGN_EXPIRED; } channelInfo = messagesStore.getChannelInfo(cid); if (channelInfo == null) { return ErrorCode.ERROR_CODE_CHANNEL_NO_EXIST; } if (StringUtil.isNullOrEmpty(channelInfo.getSecret())) { return ErrorCode.ERROR_CODE_CHANNEL_NO_SECRET; } String str = nonce + "|" + channelInfo.getSecret() + "|" + timestamp; String localSign = DigestUtils.sha1Hex(str); return localSign.equals(sign) ? ErrorCode.ERROR_CODE_SUCCESS : ErrorCode.ERROR_CODE_AUTH_FAILURE; } protected void sendResponse(Response response, ErrorCode errorCode, Object data) { response.setStatus(HttpResponseStatus.OK); if (errorCode == null) { errorCode = ErrorCode.ERROR_CODE_SUCCESS; } RestResult result = RestResult.resultOf(errorCode, errorCode.getMsg(), data); response.setContent(gson.toJson(result)); response.send(); } protected void sendApiMessage(Response response, String topic, byte[] message, Callback callback) { sendApiMessage(response, channelInfo.getOwner(), topic, message, callback); } protected void sendApiMessage(Response response, String user, String topic, byte[] message, Callback callback) { ServerAPIHelper.sendRequest(user, null, topic, message, new ServerAPIHelper.Callback() { @Override public void onSuccess(byte[] response) { callback.onSuccess(response); } @Override public void onError(ErrorCode errorCode) { sendResponse(response, errorCode, null); } @Override public void onTimeout() { sendResponse(response, ErrorCode.ERROR_CODE_TIMEOUT, null); } @Override public Executor getResponseExecutor() { return command -> { ctx.executor().execute(command); }; } }, ProtoConstants.RequestSourceType.Request_From_Channel); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/channel/GetChannelAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.channel; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.OutputGetChannelInfo; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; @Route(APIPath.Channel_Get_Profile) @HttpMethod("POST") public class GetChannelAction extends ChannelAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { setResponseContent(RestResult.ok(OutputGetChannelInfo.fromPbInfo(channelInfo)), response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/channel/GetChannelSubscribersAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.channel; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.OutputStringList; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import java.util.ArrayList; @Route(APIPath.Channel_Subscriber_List) @HttpMethod("POST") public class GetChannelSubscribersAction extends ChannelAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { OutputStringList outputStringList = new OutputStringList(); outputStringList.setList(new ArrayList<>()); outputStringList.getList().addAll(messagesStore.getChannelSubscriber(channelInfo.getTargetId())); setResponseContent(RestResult.ok(outputStringList), response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/channel/GetIsChannelSubscriberAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.channel; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.InputChannelSubscribe; import cn.wildfirechat.pojos.InputUserId; import cn.wildfirechat.pojos.OutputStringList; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import java.util.ArrayList; @Route(APIPath.Channel_Is_Subscriber) @HttpMethod("POST") public class GetIsChannelSubscriberAction extends ChannelAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputUserId input = getRequestBody(request.getNettyRequest(), InputUserId.class); boolean isSubscriber = messagesStore.checkUserInChannel(input.getUserId(), channelInfo.getTargetId()); setResponseContent(RestResult.ok(isSubscriber), response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/channel/GetUserAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.channel; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; @Route(APIPath.Channel_User_Info) @HttpMethod("POST") public class GetUserAction extends ChannelAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetUserInfo inputUserId = getRequestBody(request.getNettyRequest(), InputGetUserInfo.class); if (inputUserId != null && (!StringUtil.isNullOrEmpty(inputUserId.getUserId()) || !StringUtil.isNullOrEmpty(inputUserId.getName()) || !StringUtil.isNullOrEmpty(inputUserId.getMobile()))) { WFCMessage.User user = null; if(!StringUtil.isNullOrEmpty(inputUserId.getUserId())) { user = messagesStore.getUserInfo(inputUserId.getUserId()); } else if(!StringUtil.isNullOrEmpty(inputUserId.getName())) { user = messagesStore.getUserInfoByName(inputUserId.getName()); } else if(!StringUtil.isNullOrEmpty(inputUserId.getMobile())) { user = messagesStore.getUserInfoByMobile(inputUserId.getMobile()); } RestResult result; if (user == null || StringUtil.isNullOrEmpty(user.getName()) || user.getDeleted() > 0) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } else { if (channelInfo.getOwner().equals(inputUserId.getUserId()) || messagesStore.checkUserInChannel(user.getUid(), channelInfo.getTargetId())) { if((channelInfo.getStatus() & ProtoConstants.ChannelState.Channel_State_Mask_FullInfo) > 0) { result = RestResult.ok(InputOutputUserInfo.fromPbUser(user)); } else { WFCMessage.User outUser = WFCMessage.User.newBuilder().setUid(user.getUid()).setName(user.getName()).setPortrait(user.getPortrait()).setDisplayName(user.getDisplayName()).build(); result = RestResult.ok(InputOutputUserInfo.fromPbUser(outUser)); } } else { if((channelInfo.getStatus() & ProtoConstants.ChannelState.Channel_State_Mask_Unsubscribed_User_Access) > 0) { WFCMessage.User outUser = WFCMessage.User.newBuilder().setUid(user.getUid()).setName(user.getName()).setPortrait(user.getPortrait()).setDisplayName(user.getDisplayName()).build(); result = RestResult.ok(InputOutputUserInfo.fromPbUser(outUser)); } else { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_RIGHT); } } } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/channel/ModifyChannelProfileAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.channel; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputModifyChannelInfo; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Channel_Update_Profile) @HttpMethod("POST") public class ModifyChannelProfileAction extends ChannelAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputModifyChannelInfo input = getRequestBody(request.getNettyRequest(), InputModifyChannelInfo.class); if (input != null) { WFCMessage.ModifyChannelInfo modifyChannelInfo = WFCMessage.ModifyChannelInfo.newBuilder().setChannelId(channelInfo.getTargetId()).setType(input.getType()).setValue(input.getValue()).build(); sendApiMessage(response, IMTopic.ModifyChannelInfoTopic, modifyChannelInfo.toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { sendResponse(response, null, null); } else { sendResponse(response, errorCode, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/channel/SendMessageAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.channel; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.SendChannelMessageData; import cn.wildfirechat.proto.ProtoConstants; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.Conversation; import cn.wildfirechat.pojos.SendMessageData; import cn.wildfirechat.pojos.SendMessageResult; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import static cn.wildfirechat.proto.ProtoConstants.ConversationType.ConversationType_Channel; @Route(APIPath.Channel_Message_Send) @HttpMethod("POST") public class SendMessageAction extends ChannelAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { SendChannelMessageData sendChannelMessageData = getRequestBody(request.getNettyRequest(), SendChannelMessageData.class); if(sendChannelMessageData.getTargets() != null && !sendChannelMessageData.getTargets().isEmpty()) { if((channelInfo.getStatus() & ProtoConstants.ChannelState.Channel_State_Mask_Message_Unsubscribed) == 0 && (channelInfo.getStatus() & ProtoConstants.ChannelState.Channel_State_Mask_Global) == 0) { for (String target:sendChannelMessageData.getTargets()) { if(!messagesStore.checkUserInChannel(target, channelInfo.getTargetId())) { setResponseContent(RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_RIGHT, "User " + target + " not in channel"), response); return true; } } } } SendMessageData sendMessageData = new SendMessageData(); sendMessageData.setConv(new Conversation()); sendMessageData.getConv().setType(ConversationType_Channel); sendMessageData.getConv().setTarget(channelInfo.getTargetId()); sendMessageData.getConv().setLine(sendChannelMessageData.getLine()); sendMessageData.setSender(channelInfo.getOwner()); sendMessageData.setPayload(sendChannelMessageData.getPayload()); sendMessageData.setToUsers(sendChannelMessageData.getTargets()); if (SendMessageData.isValide(sendMessageData)) { sendApiMessage(response, IMTopic.SendMessageTopic, sendMessageData.toProtoMessage().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { long messageId = byteBuf.readLong(); long timestamp = byteBuf.readLong(); sendResponse(response, null, new SendMessageResult(messageId, timestamp)); } else { sendResponse(response, errorCode, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/channel/SubscriberChannelAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.channel; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputChannelSubscribe; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Channel_Subscribe) @HttpMethod("POST") public class SubscriberChannelAction extends ChannelAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputChannelSubscribe input = getRequestBody(request.getNettyRequest(), InputChannelSubscribe.class); if (input != null && !StringUtil.isNullOrEmpty(input.getTarget())) { if(input.getSubscribe() > 0 && (channelInfo.getStatus() & ProtoConstants.ChannelState.Channel_State_Mask_Active_Subscribe) == 0) { response.setStatus(HttpResponseStatus.OK); RestResult result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_RIGHT); response.setContent(gson.toJson(result)); return true; } WFCMessage.ListenChannel listenChannel = WFCMessage.ListenChannel.newBuilder().setChannelId(channelInfo.getTargetId()).setListen(input.getSubscribe()).build(); sendApiMessage(response, input.getTarget(), IMTopic.ChannelListenTopic, listenChannel.toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { sendResponse(response, null, null); } else { sendResponse(response, errorCode, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/AddGroupMemberAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputAddGroupMember; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Robot_Group_Member_Add) @HttpMethod("POST") public class AddGroupMemberAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputAddGroupMember inputAddGroupMember = getRequestBody(request.getNettyRequest(), InputAddGroupMember.class); inputAddGroupMember.setOperator(robot.getUid()); if (inputAddGroupMember.isValide()) { sendApiRequest(response, IMTopic.AddGroupMemberTopic, inputAddGroupMember.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { sendResponse(response, null, null); } else { sendResponse(response, errorCode, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/ApplicationGetUserInfoAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputApplicationGetUserInfo; import cn.wildfirechat.pojos.OutputApplicationUserInfo; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; @Route(APIPath.Robot_Application_Get_UserInfo) @HttpMethod("POST") public class ApplicationGetUserInfoAction extends RobotAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputApplicationGetUserInfo inputUserToken = getRequestBody(request.getNettyRequest(), InputApplicationGetUserInfo.class); RestResult result; if (inputUserToken == null || StringUtil.isNullOrEmpty(inputUserToken.getAuthCode())) { result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER); } else { String userId = messagesStore.verifyApplicationAuthCode(inputUserToken.getAuthCode(), robot.getUid(), ProtoConstants.ApplicationType.ApplicationType_Robot); if(userId != null) { OutputApplicationUserInfo outputVerifyApplicationUser = new OutputApplicationUserInfo(); outputVerifyApplicationUser.setUserId(userId); WFCMessage.User user = messagesStore.getUserInfo(userId); if(user != null) { outputVerifyApplicationUser.setDisplayName(user.getDisplayName()); outputVerifyApplicationUser.setPortraitUrl(user.getPortrait()); } result = RestResult.ok(outputVerifyApplicationUser); } else { result = RestResult.resultOf(ErrorCode.ERROR_CODE_APPLICATION_TOKEN_ERROR_OR_TIMEOUT); } } response.setStatus(HttpResponseStatus.OK); response.setContent(gson.toJson(result)); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/CreateGroupAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputCreateGroup; import cn.wildfirechat.pojos.OutputCreateGroupResult; import cn.wildfirechat.pojos.PojoGroupInfo; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Robot_Create_Group) @HttpMethod("POST") public class CreateGroupAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputCreateGroup inputCreateGroup = getRequestBody(request.getNettyRequest(), InputCreateGroup.class); inputCreateGroup.setOperator(robot.getUid()); inputCreateGroup.getGroup().getGroup_info().setOwner(robot.getUid()); if (inputCreateGroup.isValide()) { PojoGroupInfo group_info = inputCreateGroup.getGroup().getGroup_info(); WFCMessage.CreateGroupRequest createGroupRequest = inputCreateGroup.toProtoGroupRequest(); sendApiRequest(response, IMTopic.CreateGroupTopic, createGroupRequest.toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { byte[] data = new byte[byteBuf.readableBytes()]; byteBuf.readBytes(data); String groupId = new String(data); sendResponse(response, null, new OutputCreateGroupResult(groupId)); } else { sendResponse(response, errorCode, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/DeleteCallbackAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.RobotCallbackPojo; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; @Route(APIPath.Robot_Delete_Callback) @HttpMethod("POST") public class DeleteCallbackAction extends RobotAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { if(!StringUtil.isNullOrEmpty(robot.getCallback())) { robot = robot.toBuilder().clearCallback().setState(0).build(); messagesStore.addRobot(robot); } setResponseContent(RestResult.ok(), response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/DismissGroupAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputDismissGroup; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Robot_Group_Dismiss) @HttpMethod("POST") public class DismissGroupAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputDismissGroup inputDismissGroup = getRequestBody(request.getNettyRequest(), InputDismissGroup.class); inputDismissGroup.setOperator(robot.getUid()); if (inputDismissGroup.isValide()) { sendApiRequest(response, IMTopic.DismissGroupTopic, inputDismissGroup.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { sendResponse(response, null, null); } else { sendResponse(response, errorCode, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/GetCallbackAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.RobotCallbackPojo; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; @Route(APIPath.Robot_Get_Callback) @HttpMethod("POST") public class GetCallbackAction extends RobotAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { RobotCallbackPojo out = new RobotCallbackPojo(); out.setUrl(robot.getCallback()); setResponseContent(RestResult.ok(out), response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/GetGroupInfoAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetGroup; import cn.wildfirechat.pojos.PojoGroupInfo; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.action.admin.AdminAction; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; @Route(APIPath.Robot_Group_Get_Info) @HttpMethod("POST") public class GetGroupInfoAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetGroup inputGetGroup = getRequestBody(request.getNettyRequest(), InputGetGroup.class); if (inputGetGroup != null && (!StringUtil.isNullOrEmpty(inputGetGroup.getGroupId()))) { WFCMessage.GroupInfo groupInfo = messagesStore.getGroupInfo(inputGetGroup.getGroupId()); RestResult result; if (groupInfo == null) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } else { PojoGroupInfo pojoGroupInfo = new PojoGroupInfo(); pojoGroupInfo.setExtra(groupInfo.getExtra()); pojoGroupInfo.setName(groupInfo.getName()); pojoGroupInfo.setOwner(groupInfo.getOwner()); pojoGroupInfo.setPortrait(groupInfo.getPortrait()); pojoGroupInfo.setTarget_id(groupInfo.getTargetId()); pojoGroupInfo.setType(groupInfo.getType()); pojoGroupInfo.setMember_count(groupInfo.getMemberCount()); pojoGroupInfo.setMute(groupInfo.getMute()); pojoGroupInfo.setJoin_type(groupInfo.getJoinType()); pojoGroupInfo.setPrivate_chat(groupInfo.getPrivateChat()); pojoGroupInfo.setSearchable(groupInfo.getSearchable()); pojoGroupInfo.setMax_member_count(groupInfo.getMemberCount()); pojoGroupInfo.setHistory_message(groupInfo.getHistoryMessage()); pojoGroupInfo.setSuper_group(groupInfo.getSuperGroup()>0); pojoGroupInfo.setDeleted(groupInfo.getDeleted()>0); pojoGroupInfo.setUpdate_dt(groupInfo.getUpdateDt()); pojoGroupInfo.setMember_update_dt(groupInfo.getMemberUpdateDt()); result = RestResult.ok(pojoGroupInfo); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/GetGroupMemberAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetGroup; import cn.wildfirechat.pojos.InputGetGroupMember; import cn.wildfirechat.pojos.OutputGroupMemberList; import cn.wildfirechat.pojos.PojoGroupMember; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.List; @Route(APIPath.Robot_Group_Member_Get) @HttpMethod("POST") public class GetGroupMemberAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetGroupMember input = getRequestBody(request.getNettyRequest(), InputGetGroupMember.class); String robotId = robot.getUid(); if (input != null && (!StringUtil.isNullOrEmpty(input.getGroupId())) && (!StringUtil.isNullOrEmpty(input.getMemberId()))) { List members = new ArrayList<>(); ErrorCode errorCode = messagesStore.getGroupMembers(null, input.getGroupId(), 0, members); RestResult result; if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { result = RestResult.resultOf(errorCode); } else { WFCMessage.GroupMember groupMember = null; boolean isInGroup = false; for (WFCMessage.GroupMember member : members) { if (member.getType() == ProtoConstants.GroupMemberType.GroupMemberType_Removed) { continue; } if(member.getMemberId().equals(robotId)) { isInGroup = true; if(groupMember != null) { break; } } if(member.getMemberId().equals(input.getMemberId())) { groupMember = member; if(isInGroup) { break; } } } if(!isInGroup) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_IN_GROUP); } else { if(groupMember == null) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } else { PojoGroupMember pm = new PojoGroupMember(); pm.setMember_id(groupMember.getMemberId()); pm.setAlias(groupMember.getAlias()); pm.setType(groupMember.getType()); pm.setExtra(groupMember.getExtra()); pm.setCreateDt(groupMember.getCreateDt()); result = RestResult.ok(pm); } } } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/GetGroupMembersAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetGroup; import cn.wildfirechat.pojos.OutputGroupMemberList; import cn.wildfirechat.pojos.PojoGroupMember; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.action.admin.AdminAction; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.List; @Route(APIPath.Robot_Group_Member_List) @HttpMethod("POST") public class GetGroupMembersAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetGroup inputGetGroup = getRequestBody(request.getNettyRequest(), InputGetGroup.class); String robotId = robot.getUid(); if (inputGetGroup != null && (!StringUtil.isNullOrEmpty(inputGetGroup.getGroupId()))) { List members = new ArrayList<>(); ErrorCode errorCode = messagesStore.getGroupMembers(null, inputGetGroup.getGroupId(), 0, members); RestResult result; if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { result = RestResult.resultOf(errorCode); } else { OutputGroupMemberList out = new OutputGroupMemberList(); out.setMembers(new ArrayList<>()); boolean isInGroup = false; for (WFCMessage.GroupMember member : members) { if (member.getType() == ProtoConstants.GroupMemberType.GroupMemberType_Removed) { continue; } if(member.getMemberId().equals(robotId)) { isInGroup = true; } PojoGroupMember pm = new PojoGroupMember(); pm.setMember_id(member.getMemberId()); pm.setAlias(member.getAlias()); pm.setType(member.getType()); pm.setExtra(member.getExtra()); pm.setCreateDt(member.getCreateDt()); out.getMembers().add(pm); } if(!isInGroup) { out.getMembers().clear(); } result = RestResult.ok(out); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/GetProfileAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.OutputRobot; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; @Route(APIPath.Robot_Get_Profile) @HttpMethod("POST") public class GetProfileAction extends RobotAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { WFCMessage.User user = messagesStore.getUserInfo(robot.getUid()); RestResult result; if (user == null) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } else { OutputRobot outputRobot = new OutputRobot(); outputRobot.fromUser(user); outputRobot.fromRobot(robot, false); result = RestResult.ok(outputRobot); } setResponseContent(result, response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/GetUploadUrlAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetPresignedUploadUrl; import cn.wildfirechat.pojos.InputGetUserInfo; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.OutputPresignedUploadUrl; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.qiniu.util.Auth; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.MemorySessionStore; import io.moquette.server.config.MediaServerConfig; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import java.io.IOException; import java.net.URL; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.time.ZonedDateTime; import java.util.*; @Route(APIPath.Robot_Get_Presigned_Upload_Url) @HttpMethod("POST") public class GetUploadUrlAction extends RobotAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { if(!MediaServerConfig.USER_QINIU) { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); return true; } InputGetPresignedUploadUrl inputUserId = getRequestBody(request.getNettyRequest(), InputGetPresignedUploadUrl.class); if (StringUtil.isNullOrEmpty(inputUserId.contentType)) { inputUserId.contentType = "application/octet-stream"; } String uuid = UUID.randomUUID().toString().replace("-", ""); inputUserId.fileName = uuid + inputUserId.fileName; int type = inputUserId.mediaType; String bucketName; String bucketDomain; switch (type) { case 0: default: bucketName = MediaServerConfig.QINIU_BUCKET_GENERAL_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_GENERAL_DOMAIN; break; case 1: bucketName = MediaServerConfig.QINIU_BUCKET_IMAGE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_IMAGE_DOMAIN; break; case 2: bucketName = MediaServerConfig.QINIU_BUCKET_VOICE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_VOICE_DOMAIN; break; case 3: bucketName = MediaServerConfig.QINIU_BUCKET_VIDEO_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_VIDEO_DOMAIN; break; case 4: bucketName = MediaServerConfig.QINIU_BUCKET_FILE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_FILE_DOMAIN; break; case 5: bucketName = MediaServerConfig.QINIU_BUCKET_PORTRAIT_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_PORTRAIT_DOMAIN; break; case 6: bucketName = MediaServerConfig.QINIU_BUCKET_FAVORITE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_FAVORITE_DOMAIN; break; case 7: bucketName = MediaServerConfig.QINIU_BUCKET_STICKER_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_STICKER_DOMAIN; break; case 8: bucketName = MediaServerConfig.QINIU_BUCKET_MOMENTS_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_MOMENTS_DOMAIN; break; case 9: bucketName = MediaServerConfig.QINIU_BUCKET_CUSTOM1_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_CUSTOM1_DOMAIN; break; case 10: bucketName = MediaServerConfig.QINIU_BUCKET_CUSTOM2_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_CUSTOM2_DOMAIN; break; case 11: bucketName = MediaServerConfig.QINIU_BUCKET_CUSTOM3_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_CUSTOM3_DOMAIN; break; case 12: bucketName = MediaServerConfig.QINIU_BUCKET_PAN_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_PAN_DOMAIN; break; } if(StringUtil.isNullOrEmpty(bucketName)) { bucketName = MediaServerConfig.QINIU_BUCKET_GENERAL_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_GENERAL_DOMAIN; } String key = inputUserId.fileName; Auth auth = Auth.create(MediaServerConfig.QINIU_ACCESS_KEY, MediaServerConfig.QINIU_SECRET_KEY); String token = auth.uploadToken(bucketName, key); String downloadUrl = bucketDomain + "/" + key; String uploadUrl = "https://" + MediaServerConfig.QINIU_SERVER_URL + "?" + token + "?" + key; OutputPresignedUploadUrl outputPresignedUploadUrl = new OutputPresignedUploadUrl(); outputPresignedUploadUrl.uploadUrl = uploadUrl; outputPresignedUploadUrl.downloadUrl = downloadUrl; outputPresignedUploadUrl.type = 1; setResponseContent(RestResult.ok(outputPresignedUploadUrl), response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/GetUserAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.InputGetUserInfo; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import cn.wildfirechat.common.ErrorCode; @Route(APIPath.Robot_User_Info) @HttpMethod("POST") public class GetUserAction extends RobotAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputGetUserInfo inputUserId = getRequestBody(request.getNettyRequest(), InputGetUserInfo.class); if (inputUserId != null && (!StringUtil.isNullOrEmpty(inputUserId.getUserId()) || !StringUtil.isNullOrEmpty(inputUserId.getName()) || !StringUtil.isNullOrEmpty(inputUserId.getMobile()))) { WFCMessage.User user = null; if(!StringUtil.isNullOrEmpty(inputUserId.getUserId())) { user = messagesStore.getUserInfo(inputUserId.getUserId()); } else if(!StringUtil.isNullOrEmpty(inputUserId.getName())) { user = messagesStore.getUserInfoByName(inputUserId.getName()); } else if(!StringUtil.isNullOrEmpty(inputUserId.getMobile())) { user = messagesStore.getUserInfoByMobile(inputUserId.getMobile()); } RestResult result; if (user == null || user.getDeleted() > 0) { result = RestResult.resultOf(ErrorCode.ERROR_CODE_NOT_EXIST); } else { InputOutputUserInfo outputUserInfo = InputOutputUserInfo.fromPbUser(user); int mask = messagesStore.getRobotGetUserInfoMask(); if((mask & 1) == 0) { outputUserInfo.setName(null); } if((mask & 2) == 0) { outputUserInfo.setMobile(null); } if((mask & 4) == 0) { outputUserInfo.setEmail(null); } if((mask & 8) == 0) { outputUserInfo.setAddress(null); } if((mask & 16) == 0) { outputUserInfo.setCompany(null); } if((mask & 32) == 0) { outputUserInfo.setExtra(null); } if((mask & 64) == 0) { outputUserInfo.setUpdateDt(0); } if((mask & 128) == 0) { outputUserInfo.setGender(0); } if((mask & 256) == 0) { outputUserInfo.setSocial(null); } if((mask & 512) == 0) { outputUserInfo.setType(0); } result = RestResult.ok(outputUserInfo); } setResponseContent(result, response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/KickoffGroupMemberAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputKickoffGroupMember; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Robot_Group_Member_Kickoff) @HttpMethod("POST") public class KickoffGroupMemberAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputKickoffGroupMember inputKickoffGroupMember = getRequestBody(request.getNettyRequest(), InputKickoffGroupMember.class); inputKickoffGroupMember.setOperator(robot.getUid()); if (inputKickoffGroupMember.isValide()) { sendApiRequest(response, IMTopic.KickoffGroupMemberTopic, inputKickoffGroupMember.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { sendResponse(response, null, null); } else { sendResponse(response, errorCode, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/ModifyGroupInfoAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputModifyGroupInfo; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Robot_Group_Modify_Info) @HttpMethod("POST") public class ModifyGroupInfoAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputModifyGroupInfo inputAddGroupMember = getRequestBody(request.getNettyRequest(), InputModifyGroupInfo.class); inputAddGroupMember.setOperator(robot.getUid()); if (inputAddGroupMember.isValide()) { sendApiRequest(response, IMTopic.ModifyGroupInfoTopic, inputAddGroupMember.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { sendResponse(response, null, null); } else { sendResponse(response, errorCode, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/ModifyGroupMemberAliasAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputSetGroupMemberAlias; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Robot_Group_Set_Member_Alias) @HttpMethod("POST") public class ModifyGroupMemberAliasAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputSetGroupMemberAlias inputSetGroupMemberAlias = getRequestBody(request.getNettyRequest(), InputSetGroupMemberAlias.class); inputSetGroupMemberAlias.setOperator(robot.getUid()); if (inputSetGroupMemberAlias.isValide()) { sendApiRequest(response, IMTopic.ModifyGroupMemberAliasTopic, inputSetGroupMemberAlias.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { sendResponse(response, null, null); } else { sendResponse(response, errorCode, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/ModifyGroupMemberExtraAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputSetGroupMemberExtra; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Robot_Group_Set_Member_Extra) @HttpMethod("POST") public class ModifyGroupMemberExtraAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputSetGroupMemberExtra inputSetGroupMemberExtra = getRequestBody(request.getNettyRequest(), InputSetGroupMemberExtra.class); inputSetGroupMemberExtra.setOperator(robot.getUid()); if (inputSetGroupMemberExtra.isValide()) { sendApiRequest(response, IMTopic.ModifyGroupMemberExtraTopic, inputSetGroupMemberExtra.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { sendResponse(response, null, null); } else { sendResponse(response, errorCode, null); } }); return false; } else { response.setStatus(HttpResponseStatus.OK); RestResult result = RestResult.resultOf(ErrorCode.INVALID_PARAMETER); response.setContent(gson.toJson(result)); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/QuitGroupMemberAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputQuitGroup; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Robot_Group_Member_Quit) @HttpMethod("POST") public class QuitGroupMemberAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputQuitGroup inputQuitGroup = getRequestBody(request.getNettyRequest(), InputQuitGroup.class); inputQuitGroup.setOperator(robot.getUid()); if (inputQuitGroup.isValide()) { sendApiRequest(response, IMTopic.QuitGroupTopic, inputQuitGroup.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { sendResponse(response, null, null); } else { sendResponse(response, errorCode, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/ReplyMessageAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.Conversation; import cn.wildfirechat.pojos.ReplyMessageData; import cn.wildfirechat.pojos.SendMessageData; import cn.wildfirechat.pojos.SendMessageResult; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import org.jetbrains.annotations.NotNull; import win.liyufan.im.IMTopic; import java.util.Arrays; @Route(APIPath.Robot_Message_Reply) @HttpMethod("POST") public class ReplyMessageAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { ReplyMessageData replyMessageData = getRequestBody(request.getNettyRequest(), ReplyMessageData.class); if (ReplyMessageData.isValide(replyMessageData)) { WFCMessage.Message message = messagesStore.getMessage(replyMessageData.getMessageUid()); ErrorCode errorCode = null; if(message == null) { errorCode = ErrorCode.ERROR_CODE_NOT_EXIST; } else if(!message.getContent().getMentionedTargetList().contains(robot.getUid())) { errorCode = ErrorCode.ERROR_CODE_INVALID_MESSAGE; } else if(message.getConversation().getType() != ProtoConstants.ConversationType.ConversationType_Private && message.getConversation().getType() != ProtoConstants.ConversationType.ConversationType_Group) { errorCode = ErrorCode.ERROR_CODE_NOT_IMPLEMENT; } else if(System.currentTimeMillis() - message.getServerTimestamp() > 15*60*1000) { errorCode = ErrorCode.ERROR_CODE_RECALL_TIME_EXPIRED; } else if(!messagesStore.isRobotMentionExternalRobot()) { if(message.getConversation().getType() != ProtoConstants.ConversationType.ConversationType_Group) { errorCode = ErrorCode.ERROR_CODE_NOT_IMPLEMENT; } else { WFCMessage.GroupMember member = messagesStore.getGroupMember(message.getConversation().getTarget(), robot.getUid()); if(member == null || member.getType() == ProtoConstants.GroupMemberType.GroupMemberType_Removed) { errorCode = ErrorCode.ERROR_CODE_NOT_IMPLEMENT; } } } if(errorCode != null) { response.setStatus(HttpResponseStatus.OK); RestResult result = RestResult.resultOf(errorCode); response.setContent(gson.toJson(result)); return true; } SendMessageData sendMessageData = getSendMessageData(message, replyMessageData); WFCMessage.Message newMsg = sendMessageData.toProtoMessage().toBuilder().setMessageId(message.getMessageId()).build(); sendApiRequest(response, IMTopic.RobotReplyMessageTopic, newMsg.toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode ec = ErrorCode.fromCode(byteBuf.readByte()); if (ec == ErrorCode.ERROR_CODE_SUCCESS) { long messageId = byteBuf.readLong(); long timestamp = byteBuf.readLong(); sendResponse(response, null, new SendMessageResult(messageId, timestamp)); } else { sendResponse(response, ec, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } private @NotNull SendMessageData getSendMessageData(WFCMessage.Message message, ReplyMessageData replyMessageData) { SendMessageData sendMessageData = new SendMessageData(); sendMessageData.setSender(robot.getUid()); Conversation conversation = new Conversation(); conversation.setType(message.getConversation().getType()); conversation.setLine(message.getConversation().getLine()); conversation.setTarget(message.getConversation().getTarget()); sendMessageData.setConv(conversation); sendMessageData.setPayload(replyMessageData.getPayload()); if(replyMessageData.isOnly2Sender()) { sendMessageData.setToUsers(Arrays.asList(message.getFromUser())); } return sendMessageData; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/RobotAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.IMExceptionEvent; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.action.Action; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.moquette.persistence.ServerAPIHelper; import io.moquette.spi.impl.Utils; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import org.apache.commons.codec.digest.DigestUtils; import cn.wildfirechat.common.ErrorCode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.RateLimiter; import win.liyufan.im.Utility; import java.io.UnsupportedEncodingException; import java.util.concurrent.Executor; abstract public class RobotAction extends Action { protected static final Logger LOG = LoggerFactory.getLogger(RobotAction.class); protected WFCMessage.Robot robot; protected interface Callback { void onSuccess(byte[] response); } @Override public ErrorCode preAction(Request request, Response response) { String nonce = request.getHeader("nonce"); if (StringUtil.isNullOrEmpty(nonce)) { nonce = request.getHeader("Nonce"); } String timestamp = request.getHeader("timestamp"); if (StringUtil.isNullOrEmpty(timestamp)) { timestamp = request.getHeader("Timestamp"); } String sign = request.getHeader("sign"); if (StringUtil.isNullOrEmpty(sign)) { sign = request.getHeader("Sign"); } String rid = request.getHeader("rid"); if (StringUtil.isNullOrEmpty(rid)) { rid = request.getHeader("Rid"); } if (StringUtil.isNullOrEmpty(nonce) || StringUtil.isNullOrEmpty(timestamp) || StringUtil.isNullOrEmpty(sign) || StringUtil.isNullOrEmpty(rid)) { return ErrorCode.ERROR_CODE_API_NOT_SIGNED; } if (!robotLimiter.isGranted(rid)) { return ErrorCode.ERROR_CODE_OVER_FREQUENCY; } Long ts; try { ts = Long.parseLong(timestamp); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, IMExceptionEvent.EventType.ROBOT_API_Exception); return ErrorCode.ERROR_CODE_API_NOT_SIGNED; } if (System.currentTimeMillis() - ts > 2 * 60 * 60 * 1000) { return ErrorCode.ERROR_CODE_SIGN_EXPIRED; } robot = messagesStore.getRobot(rid); if (robot == null) { return ErrorCode.ERROR_CODE_NOT_EXIST; } if (StringUtil.isNullOrEmpty(robot.getSecret())) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } String str = nonce + "|" + robot.getSecret() + "|" + timestamp; String localSign = DigestUtils.sha1Hex(str); return localSign.equals(sign) ? ErrorCode.ERROR_CODE_SUCCESS : ErrorCode.ERROR_CODE_AUTH_FAILURE; } protected void sendResponse(Response response, ErrorCode errorCode, Object data) { response.setStatus(HttpResponseStatus.OK); if (errorCode == null) { errorCode = ErrorCode.ERROR_CODE_SUCCESS; } RestResult result = RestResult.resultOf(errorCode, errorCode.getMsg(), data); response.setContent(gson.toJson(result)); response.send(); } protected void sendApiRequest(Response response, String topic, byte[] message, Callback callback) { ServerAPIHelper.sendRequest(robot.getUid(), null, topic, message, new ServerAPIHelper.Callback() { @Override public void onSuccess(byte[] response) { callback.onSuccess(response); } @Override public void onError(ErrorCode errorCode) { sendResponse(response, errorCode, null); } @Override public void onTimeout() { sendResponse(response, ErrorCode.ERROR_CODE_TIMEOUT, null); } @Override public Executor getResponseExecutor() { return command -> { ctx.executor().execute(command); }; } }, ProtoConstants.RequestSourceType.Request_From_Robot); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/SendMessageAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import cn.wildfirechat.pojos.SendMessageData; import cn.wildfirechat.pojos.SendMessageResult; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Route(APIPath.Robot_Message_Send) @HttpMethod("POST") public class SendMessageAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { SendMessageData sendMessageData = getRequestBody(request.getNettyRequest(), SendMessageData.class); sendMessageData.setSender(robot.getUid()); if (SendMessageData.isValide(sendMessageData)) { sendApiRequest(response, IMTopic.SendMessageTopic, sendMessageData.toProtoMessage().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { long messageId = byteBuf.readLong(); long timestamp = byteBuf.readLong(); sendResponse(response, null, new SendMessageResult(messageId, timestamp)); } else { sendResponse(response, errorCode, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/SetCallbackAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputGetGroup; import cn.wildfirechat.pojos.RobotCallbackPojo; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; @Route(APIPath.Robot_Set_Callback) @HttpMethod("POST") public class SetCallbackAction extends RobotAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { RobotCallbackPojo input = getRequestBody(request.getNettyRequest(), RobotCallbackPojo.class); if(!StringUtil.isNullOrEmpty(input.getUrl())) { if(!input.getUrl().equals(robot.getCallback()) && robot.getState() != 1) { robot = robot.toBuilder().setCallback(input.getUrl()).setState(1).build(); messagesStore.addRobot(robot); } setResponseContent(RestResult.ok(), response); } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/TransferGroupAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.InputTransferGroup; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import win.liyufan.im.IMTopic; @Route(APIPath.Robot_Group_Transfer) @HttpMethod("POST") public class TransferGroupAction extends RobotAction { @Override public boolean isTransactionAction() { return true; } @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { InputTransferGroup inputDismissGroup = getRequestBody(request.getNettyRequest(), InputTransferGroup.class); inputDismissGroup.setOperator(robot.getUid()); if (inputDismissGroup.isValide()) { sendApiRequest(response, IMTopic.TransferGroupTopic, inputDismissGroup.toProtoGroupRequest().toByteArray(), result -> { ByteBuf byteBuf = Unpooled.buffer(); byteBuf.writeBytes(result); ErrorCode errorCode = ErrorCode.fromCode(byteBuf.readByte()); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { sendResponse(response, null, null); } else { sendResponse(response, errorCode, null); } }); return false; } else { setResponseContent(RestResult.resultOf(ErrorCode.INVALID_PARAMETER), response); } } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/action/robot/UpdateProfileAction.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.action.robot; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.IntStringPairPojo; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.annotation.HttpMethod; import com.xiaoleilu.loServer.annotation.Route; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import static cn.wildfirechat.pojos.MyInfoType.*; @Route(APIPath.Robot_Update_Profile) @HttpMethod("POST") public class UpdateProfileAction extends RobotAction { @Override public boolean action(Request request, Response response) { if (request.getNettyRequest() instanceof FullHttpRequest) { IntStringPairPojo input = getRequestBody(request.getNettyRequest(), IntStringPairPojo.class); WFCMessage.User.Builder builder = messagesStore.getUserInfo(robot.getUid()).toBuilder(); boolean modified = false; String value = input.getStrValue() == null ? "" : input.getStrValue(); switch (input.getIntValue()) { case Modify_DisplayName: builder.setDisplayName(value); modified = true; break; case Modify_Gender: builder.setGender(Integer.parseInt(value)); modified = true; break; case Modify_Portrait: builder.setPortrait(value); modified = true; break; //不允许修改电话号码,如果修改电话号码必须通过admin进行修改 // case Modify_Mobile: // builder.setMobile(value); // modified = true; // break; case Modify_Email: builder.setEmail(value); modified = true; break; case Modify_Address: builder.setAddress(value); modified = true; break; case Modify_Company: builder.setCompany(value); modified = true; break; case Modify_Social: builder.setSocial(value); modified = true; break; case Modify_Extra: builder.setExtra(value); modified = true; break; default: break; } RestResult result = RestResult.ok(); if(modified) { try { builder.setUpdateDt(System.currentTimeMillis()); messagesStore.updateUserInfo(builder.build()); } catch (Exception e) { e.printStackTrace(); result.setErrorCode(ErrorCode.ERROR_CODE_SERVER_ERROR); } } setResponseContent(result, response); } return true; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/annotation/HttpMethod.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.annotation; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME)/*保留的时间长短*/ @Inherited/*只用于class,可被子类继承*/ public @interface HttpMethod { String value() default "GET"; } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/annotation/RequireAuthentication.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.annotation; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME)/*保留的时间长短*/ @Inherited/*只用于class,可被子类继承*/ public @interface RequireAuthentication { } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/annotation/Route.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.annotation; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * 注解,用于自定义访问的URL路径
* 值可以是一个请求路径,如果需要指定HTTP方法,在前面加方法名用":"分隔既可
* @author loolly * */ @Retention(RetentionPolicy.RUNTIME)/*保留的时间长短*/ @Inherited/*只用于class,可被子类继承*/ public @interface Route { String value(); } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/exception/ServerSettingException.java ================================================ package com.xiaoleilu.loServer.exception; import cn.hutool.core.util.StrUtil; /** * 设置异常 * @author xiaoleilu */ public class ServerSettingException extends RuntimeException{ private static final long serialVersionUID = -4134588858314744501L; public ServerSettingException(Throwable e) { super(e); } public ServerSettingException(String message) { super(message); } public ServerSettingException(String messageTemplate, Object... params) { super(StrUtil.format(messageTemplate, params)); } public ServerSettingException(String message, Throwable throwable) { super(message, throwable); } public ServerSettingException(Throwable throwable, String messageTemplate, Object... params) { super(StrUtil.format(messageTemplate, params), throwable); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/filter/Filter.java ================================================ package com.xiaoleilu.loServer.filter; import com.xiaoleilu.loServer.handler.Request; import com.xiaoleilu.loServer.handler.Response; /** * 过滤器接口
* @author Looly * */ public interface Filter { /** * 执行过滤 * @param request 请求对象 * @param response 响应对象 * @return 如果返回true,则继续执行下一步内容,否则中断 */ public boolean doFilter(Request request, Response response); } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/handler/ActionHandler.java ================================================ package com.xiaoleilu.loServer.handler; import cn.hutool.core.lang.Singleton; import cn.wildfirechat.common.IMExceptionEvent; import com.xiaoleilu.loServer.ServerSetting; import com.xiaoleilu.loServer.action.Action; import com.xiaoleilu.loServer.action.UnknownErrorAction; import com.xiaoleilu.loServer.action.FileAction; import com.xiaoleilu.loServer.filter.Filter; import io.moquette.spi.IMessagesStore; import io.moquette.spi.ISessionsStore; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.util.internal.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.Utility; /** * Action处理单元 * * @author Looly */ abstract public class ActionHandler extends SimpleChannelInboundHandler { private static final Logger Logger = LoggerFactory.getLogger(ActionHandler.class); public ActionHandler(IMessagesStore messagesStore, ISessionsStore sessionsStore) { Action.messagesStore = messagesStore; Action.sessionsStore = sessionsStore; } @Override protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest fullHttpRequest) throws Exception { final Request request = Request.build(ctx, fullHttpRequest); final Response response = Response.build(ctx, request); response.setContentType("application/json"); try { //do filter boolean isPass = this.doFilter(request, response); if(isPass){ //do action this.doAction(ctx, request, response); } } catch (Exception e) { e.printStackTrace(); Utility.printExecption(Logger, e, IMExceptionEvent.EventType.SHORT_LINK_Exception); Action errorAction = ServerSetting.getErrorAction(ServerSetting.MAPPING_ERROR); request.putParam(UnknownErrorAction.ERROR_PARAM_NAME, e); response.setContent(e.toString()); errorAction.doAction(request, response); //如果发送请求未被触发,则触发之,否则跳过。 if(!response.isSent()){ response.send(); } ctx.fireExceptionCaught(e); ctx.close(); } } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { super.exceptionCaught(ctx, cause); Logger.warn("{}", cause.getMessage()); Channel channel = ctx.channel(); if(channel.isActive())ctx.close(); } //---------------------------------------------------------------------------------------- Private method start /** * 执行过滤 * @param request 请求 * @param response 响应 * @@return 是否继续 */ private boolean doFilter(Request request, Response response) { //全局过滤器 Filter filter = ServerSetting.getFilter(ServerSetting.MAPPING_ALL); if(null != filter){ if(false == filter.doFilter(request, response)){ return false; } } //自定义Path过滤器 filter = ServerSetting.getFilter(request.getPath()); if(null != filter){ if(false == filter.doFilter(request, response)){ return false; } } return true; } abstract boolean isValidePath(String path); /** * 执行Action * @param request 请求对象 * @param response 响应对象 */ private void doAction(ChannelHandlerContext ctx, Request request, Response response){ if(("/route".equalsIgnoreCase(request.getPath()) || (!StringUtil.isNullOrEmpty(request.getPath()) && request.getPath().startsWith("/fs/"))) && "OPTIONS".equalsIgnoreCase(request.getMethod())){ handleOptions(ctx, request, response); return; } if ("HEAD".equalsIgnoreCase(request.getMethod())) { response.setStatus(HttpResponseStatus.OK); response.send(); return; } Action action; if (isValidePath(request.getPath())) { action = ServerSetting.getAction(request.getPath(), request.getMethod().toUpperCase()); if (action != null) { Logger.info("Http request whit url {}", request.getPath()); } } else { action = ServerSetting.getErrorAction(ServerSetting.MAPPING_ERROR); } if (action == null && (request.getPath().startsWith("/api") || request.getPath().startsWith("/admin"))) { action = ServerSetting.getErrorAction(ServerSetting.MAPPING_ERROR); } if (null == action) { //查找匹配所有路径的Action action = ServerSetting.getAction(ServerSetting.MAPPING_ALL, request.getMethod()); if(null == action){ // 非Action方法,调用静态文件读取 if(request.getPath().startsWith("/fs")) { action = Singleton.get(FileAction.class); } else { action = ServerSetting.getErrorAction(ServerSetting.MAPPING_ERROR); } } } action.ctx = ctx; boolean isSync = action.doAction(request, response); if(isSync) { //如果发送请求未被触发,则触发之,否则跳过。 if(!response.isSent()){ response.send(); } } } //---------------------------------------------------------------------------------------- Private method start private void handleOptions(ChannelHandlerContext ctx, Request request, Response response){ response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Access-Control-Allow-Headers", "*"); response.send(); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/handler/AdminActionHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.handler; import com.xiaoleilu.loServer.ServerSetting; import com.xiaoleilu.loServer.action.Action; import com.xiaoleilu.loServer.action.FileAction; import com.xiaoleilu.loServer.action.UnknownErrorAction; import com.xiaoleilu.loServer.filter.Filter; import io.moquette.spi.IMessagesStore; import io.moquette.spi.ISessionsStore; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.FullHttpRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Action处理单元 * * @author Looly */ public class AdminActionHandler extends ActionHandler { private static final Logger Logger = LoggerFactory.getLogger(AdminActionHandler.class); public AdminActionHandler(IMessagesStore messagesStore, ISessionsStore sessionsStore) { super(messagesStore, sessionsStore); } @Override boolean isValidePath(String path) { if (path.startsWith("/admin")) { return true; } return false; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/handler/HttpChunkContentCompressor.java ================================================ package com.xiaoleilu.loServer.handler; import cn.hutool.log.StaticLog; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; import io.netty.channel.FileRegion; import io.netty.handler.codec.http.DefaultHttpResponse; import io.netty.handler.codec.http.HttpContentCompressor; /** * 解决大文件传输与Gzip压缩冲突问题 * @author Looly * */ public class HttpChunkContentCompressor extends HttpContentCompressor { @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { StaticLog.debug("Write object [{}]", msg); if (msg instanceof FileRegion || msg instanceof DefaultHttpResponse) { //文件传输不经过Gzip压缩 ctx.write(msg, promise); }else{ super.write(ctx, msg, promise); } } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/handler/HttpFileServerController.java ================================================ package com.xiaoleilu.loServer.handler; import io.netty.channel.ChannelHandlerContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.*; import java.util.concurrent.ConcurrentHashMap; public class HttpFileServerController { private static final Logger logger = LoggerFactory.getLogger(HttpFileServerController.class); private Map contextMap = null; // private static class BrokenUploadInfoHandlerHolder { private static HttpFileServerController singleton = new HttpFileServerController(); } /** * constructor */ private HttpFileServerController() { contextMap = new ConcurrentHashMap(); } /** * getInstance */ public static HttpFileServerController getInstance() { return BrokenUploadInfoHandlerHolder.singleton; } /** * mapChannelHandlerContext * * @param requestId * @param ctx */ public synchronized void mapChannelHandlerContext(String requestId, ChannelHandlerContext ctx) { if (contextMap.containsKey(requestId)) { logger.warn("contextMap has already contained the key:" + requestId); } contextMap.put(requestId, ctx); } /** * getContext * * @param requestId * @return */ public ChannelHandlerContext getChannelHandlerContext(String requestId) { if (!contextMap.containsKey(requestId)) { logger.warn("contextMap not contains the key:" + requestId); return null; } return contextMap.get(requestId); } /** * removeContext * * @param requestId */ public void removeChannelHandlerContext(String requestId) { if (!contextMap.containsKey(requestId)) { logger.warn("contextMap not contains the key:" + requestId); return; } contextMap.remove(requestId); // logger.info("contextMap remove done.(" + requestId + ")"); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/handler/HttpFileServerHandler.java ================================================ package com.xiaoleilu.loServer.handler; import io.netty.util.internal.StringUtil; import io.moquette.server.config.MediaServerConfig; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.handler.codec.http.*; import io.netty.handler.codec.http.multipart.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.RandomAccessFile; import java.util.UUID; import static com.xiaoleilu.loServer.handler.HttpResponseHelper.getFileExt; import static io.netty.handler.codec.http.HttpHeaders.Names.*; import static io.netty.handler.codec.http.HttpHeaders.Names.ACCESS_CONTROL_ALLOW_HEADERS; import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; public class HttpFileServerHandler extends ChannelInboundHandlerAdapter { private static final Logger logger = LoggerFactory.getLogger(HttpFileServerHandler.class); private static final HttpDataFactory factory = new DefaultHttpDataFactory(false); @Override public void channelRead(ChannelHandlerContext ctx, Object msg) { try { if (msg instanceof FullHttpRequest) { FullHttpRequest request = (FullHttpRequest) msg; String requestId = UUID.randomUUID().toString().replace("-", ""); logger.info("HttpFileServerHandler received a request: method=" + request.getMethod() + ", uri=" + request.getUri() + ", requestId=" + requestId); if (!request.getDecoderResult().isSuccess()) { logger.warn("http decode failed!"); HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST); return; } if (request.getMethod() == HttpMethod.GET) { download(ctx, request, requestId); } else if (request.getMethod() == HttpMethod.POST) { multipartUpload(ctx, request, requestId); } else if (request.getMethod() == HttpMethod.DELETE) { delete(ctx, request, requestId); } else if (request.getMethod() == HttpMethod.OPTIONS) { doOptions(ctx, request); } else { logger.warn("METHOD_NOT_ALLOWED!(methodName=" + request.getMethod().name() + ")"); HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.METHOD_NOT_ALLOWED); } } else { HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "Not a http request"); } } catch (Exception e) { logger.error("HttpFileServerHandler.channelRead0() process error!", e); HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.INTERNAL_SERVER_ERROR); } } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { try { if (ctx.channel().isActive()) { HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.INTERNAL_SERVER_ERROR); logger.warn("exceptionCaught:" + cause.getMessage()); } } catch (Exception e) { logger.warn("exceptionCaught error!" + e.getMessage()); } } /** * multipart上传 */ private void multipartUpload(ChannelHandlerContext ctx, FullHttpRequest request, String requestId) { HttpPostRequestDecoder decoder = null; try { decoder = new HttpPostRequestDecoder(factory, request); } catch (HttpPostRequestDecoder.ErrorDataDecoderException e1) { logger.error("Failed to decode file data!", e1); HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "Failed to decode file data!"); return; } if (decoder != null) { if (request instanceof HttpContent) { HttpContent chunk = (HttpContent) request; try { decoder.offer(chunk); } catch (HttpPostRequestDecoder.ErrorDataDecoderException e1) { logger.warn("BAD_REQUEST, Failed to decode file data"); HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "Failed to decode file data"); return; } long fileTotalSize = 0; if (request.headers().contains("X-File-Total-Size")) { try { fileTotalSize = Integer.parseInt(request.headers().get("X-File-Total-Size")); } catch (Exception e) { logger.warn("invalid X-File-Total-Size value!"); } } readHttpDataChunkByChunk(ctx, decoder, requestId, HttpHeaders.isKeepAlive(request)); if (chunk instanceof LastHttpContent) { releaseRequest(request, decoder); } } else { logger.warn("BAD_REQUEST, Not a http request"); HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "Not a http request"); } } } /** * readHttpDataChunkByChunk */ private void readHttpDataChunkByChunk(ChannelHandlerContext ctx, HttpPostRequestDecoder decoder, String requestId, boolean isKeepAlive) { try { while (decoder.hasNext()) { InterfaceHttpData data = decoder.next(); if (data != null) { try { writeFileUploadData(data, ctx, requestId, isKeepAlive); } finally { data.release(); } } } } catch (Exception e) { logger.info("chunk end"); } } /** * writeFileUploadData */ private void writeFileUploadData(InterfaceHttpData data, ChannelHandlerContext ctx, String requestId, boolean isKeepAlive) { try { if (data.getHttpDataType() == InterfaceHttpData.HttpDataType.FileUpload) { FileUpload fileUpload = (FileUpload) data; String remoteFileName = fileUpload.getFilename(); long remoteFileSize = fileUpload.length(); if (StringUtil.isNullOrEmpty(remoteFileName)) { logger.warn("remoteFileName is empty!"); HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "file name is empty"); return; } if (StringUtil.isNullOrEmpty(requestId)) { logger.warn("requestId is empty!"); HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "requestId is empty!"); return; } if (remoteFileSize > 10 * 1024 * 1024) { logger.warn("file over limite!(" + remoteFileSize + ")"); HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "file over limite!"); return; } String remoteFileExt = ""; if (remoteFileName.lastIndexOf(".") == -1) { remoteFileExt = "octetstream"; remoteFileName = remoteFileName + "." + remoteFileExt; } else { remoteFileExt = getFileExt(remoteFileName); } if (StringUtil.isNullOrEmpty(remoteFileExt) || remoteFileExt.equals("ing")) { logger.warn("Invalid file extention name"); HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "Invalid file extention name"); return; } int remoteFileTotalSize = (int) remoteFileSize; HttpFileServerController.getInstance().mapChannelHandlerContext(requestId, ctx); ByteBuf byteBuf = null; int savedThunkSize = 0; // 分片接收保存的大小 int offset = 0; // 断点续传开始位置 File tmpFile = new File("./" + MediaServerConfig.FILE_STROAGE_ROOT + "/" + requestId); boolean isError = false; while (true) { byte[] thunkData; try { byteBuf = fileUpload.getChunk(128 * 1024); int readableBytesSize = byteBuf.readableBytes(); thunkData = new byte[readableBytesSize]; byteBuf.readBytes(thunkData); put(tmpFile, offset, thunkData); savedThunkSize += readableBytesSize; offset += readableBytesSize; if (savedThunkSize >= remoteFileSize) { byteBuf.release(); fileUpload.release(); HttpResponseHelper.sendResponse(requestId, ctx, HttpResponseStatus.OK, HttpHeaders.Values.APPLICATION_JSON, "{\"key\":\"" + requestId + "\"}", true, false); break; } } catch (Exception e) { logger.error("save thunckData error!", e); if (fileUpload != null) fileUpload.release(); if (byteBuf != null) byteBuf.release(); HttpResponseHelper.sendResponse(requestId, ctx, HttpResponseStatus.INTERNAL_SERVER_ERROR); isError = true; return; } finally { thunkData = null; if (isError) { tmpFile.delete(); } } } } } catch (Exception e) { logger.error("writeHttpData error!", e); HttpResponseHelper.sendResponse(requestId, ctx, HttpResponseStatus.INTERNAL_SERVER_ERROR); } } public static void put(File file, long pos, byte[] data) throws Exception { RandomAccessFile raf = null; try { raf = new RandomAccessFile(file, "rwd"); raf.seek(pos); raf.write(data); } finally { try { if (raf != null) raf.close(); } catch (Exception e) { logger.warn("release error!", e); } } } /** * 下载 */ private void download(ChannelHandlerContext ctx, FullHttpRequest request, String requestId) { // try { // final String httpUri = request.getUri(); // if (httpUri.toLowerCase().equals("/favicon.ico")) { // logger.warn("invalid httpUri(" + httpUri + ", requestId=" + requestId + ")"); // HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "invalid httpUri"); // return; // } // // String typedDownloadInfo = MetaDataIndexHandler.getTypedDownloadInfo(httpUri); // if (StringUtil.isNullOrEmpty(typedDownloadInfo)) { // logger.warn("invalid httpUri(" + httpUri + ", requestId=" + requestId + ")"); // HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "invalid httpUri"); // return; // } // // MetaDataIndex metadataIndex = MetaDataIndexHandler.parseTypedDownloadInfo(typedDownloadInfo); // if (metadataIndex == null) { // logger.warn("invalid typedDownloadInfo!(" + typedDownloadInfo + ", requestId=" + requestId + ")"); // HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "invalid downloadFileName"); // return; // } // // int fileSize = MetaDataHandler.getDataFieldLength(metadataIndex); // int chunkSize = FileStorageConst.Stroage_Remote_Invoke_Thunk_Size; // int chunkCount = fileSize % chunkSize == 0 ? (int) (fileSize / chunkSize) : (int) (fileSize / chunkSize + 1); // // ClusterNode toNode = StorageClusterRouterManager.getInstance().getDownloadNode(metadataIndex.getClusterNode()); // if(toNode == null) { // logger.warn("toNode is null!(" + typedDownloadInfo + ", requestId=" + requestId + ")"); // HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.NOT_FOUND, "File Not Existed"); // return; // } // // ClusterNode fromNode = StorageClusterRouterManager.getInstance().getSelfNode(); // ActorSystem actorSystem = StorageClusterRouterManager.getInstance().getStorageActorSystem(); // ActorRef toActorRef = actorSystem.actorOf(toNode.getIp(), toNode.getRpcPort(), ActorType.DownloadActor.getName()); // ActorRef fromActorRef = actorSystem.actorOf(fromNode.getIp(),fromNode.getRpcPort(), ActorType.HttpFileServerActor.getName()); // // HttpFileServerController.getInstance().mapChannelHandlerContext(requestId, ctx); // // DownloadMsg downloadMsg = new DownloadMsg(); // downloadMsg.setRequestId(requestId); // downloadMsg.setIsKeepAlive(HttpHeaders.isKeepAlive(request)); // downloadMsg.setClusterNode(metadataIndex.getClusterNode()); // downloadMsg.setFileSize(fileSize); // downloadMsg.setChunkIndex(0); // downloadMsg.setChunkSize(chunkSize); // downloadMsg.setChunkCount(chunkCount); // downloadMsg.setTime(metadataIndex.getTime()); // downloadMsg.setBigFileIndex(metadataIndex.getBigFileIndex()); // downloadMsg.setOffset(metadataIndex.getOffset()); // downloadMsg.setMetaDataTotalLength(metadataIndex.getMetaDataTotalLength()); // downloadMsg.setFileType(metadataIndex.getFileType()); // downloadMsg.setBigFilePath(metadataIndex.getBigFilePath()); // downloadMsg.setStorageEngineVersion(metadataIndex.getStorageEngineVersion()); // toActorRef.tell(downloadMsg, fromActorRef); // } catch (Exception e) { // logger.error("download error!", e); // HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.INTERNAL_SERVER_ERROR); // } finally { // releaseRequest(request, null); // } } /** * 删除 */ private void delete(ChannelHandlerContext ctx, FullHttpRequest request, String requestId) { // try { // final String httpUri = request.getUri(); // String typedDownloadInfo = MetaDataIndexHandler.getTypedDownloadInfo(httpUri); // if (StringUtil.isNullOrEmpty(typedDownloadInfo)) { // logger.warn("invalid httpUri(" + httpUri + ")"); // HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "invalid httpUri"); // return; // } // // MetaDataIndex metadataIndex = MetaDataIndexHandler.parseTypedDownloadInfo(typedDownloadInfo); // if (metadataIndex == null) { // logger.warn("invalid typedDownloadInfo!(" + typedDownloadInfo + ")"); // HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.BAD_REQUEST, "invalid downloadFileName"); // } // // ClusterNode toNode = StorageClusterRouterManager.getInstance().getClusterNode(metadataIndex.getClusterNode()); // ClusterNode fromNode = StorageClusterRouterManager.getInstance().getSelfNode(); // ActorSystem actorSystem = StorageClusterRouterManager.getInstance().getStorageActorSystem(); // ActorRef toActorRef = actorSystem.actorOf(toNode.getIp(), toNode.getRpcPort(), ActorType.DeleteActor.getName()); // ActorRef fromActorRef = actorSystem.actorOf(fromNode.getIp(),fromNode.getRpcPort(), ActorType.HttpFileServerActor.getName()); // // HttpFileServerController.getInstance().mapChannelHandlerContext(requestId, ctx); // // DeleteMsg downloadMsg = new DeleteMsg(); // downloadMsg.setRequestId(requestId); // downloadMsg.setIsKeepAlive(HttpHeaders.isKeepAlive(request)); // downloadMsg.setClusterNode(metadataIndex.getClusterNode()); // downloadMsg.setTime(metadataIndex.getTime()); // downloadMsg.setBigFileIndex(metadataIndex.getBigFileIndex()); // downloadMsg.setOffset(metadataIndex.getOffset()); // downloadMsg.setMetaDataTotalLength(metadataIndex.getMetaDataTotalLength()); // downloadMsg.setFileType(metadataIndex.getFileType()); // downloadMsg.setBigFilePath(metadataIndex.getBigFilePath()); // downloadMsg.setStorageEngineVersion(metadataIndex.getStorageEngineVersion()); // toActorRef.tell(downloadMsg, fromActorRef); // } catch (Exception e) { // logger.error("delete error!", e); // HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.INTERNAL_SERVER_ERROR); // } finally { // releaseRequest(request, null); // } } /** * HTTP能力探测 */ private void doOptions(ChannelHandlerContext ctx, FullHttpRequest request) { try { boolean isKeepAlive = HttpHeaders.isKeepAlive(request); FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, HttpResponseStatus.NO_CONTENT); response.headers().set(CONTENT_TYPE, HttpHeaders.Values.APPLICATION_JSON); response.headers().set(TRANSFER_ENCODING, "chunked"); if (isKeepAlive) response.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE); response.headers().set(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); response.headers().set(ACCESS_CONTROL_ALLOW_METHODS, "GET, POST, DELETE, OPTIONS"); response.headers().set(ACCESS_CONTROL_ALLOW_HEADERS, "DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization"); ChannelFuture future = ctx.channel().writeAndFlush(response); if (!isKeepAlive) { future.addListener(ChannelFutureListener.CLOSE); } } catch (Exception e) { logger.error("doOptions error!", e); HttpResponseHelper.sendResponse("", ctx, HttpResponseStatus.INTERNAL_SERVER_ERROR); } finally { releaseRequest(request, null); } } /** * releaseRequest */ private void releaseRequest(FullHttpRequest request, HttpPostRequestDecoder decoder) { try { if (request != null) request.release(); request = null; if (decoder != null) decoder.destroy(); decoder = null; } catch (Exception e) { logger.error("reset error!", e); } } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/handler/HttpResponseHelper.java ================================================ package com.xiaoleilu.loServer.handler; import io.netty.util.internal.StringUtil; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.http.*; import io.netty.util.CharsetUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static io.netty.handler.codec.http.HttpHeaders.Names.ACCESS_CONTROL_ALLOW_ORIGIN; import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_RANGE; import static io.netty.handler.codec.http.HttpHeaders.Names.CONTENT_TYPE; import static io.netty.handler.codec.http.HttpVersion.HTTP_1_1; public class HttpResponseHelper { private static final Logger logger = LoggerFactory.getLogger(HttpResponseHelper.class); /** * sendResponse * * @param ctx * @param status */ public static void sendResponse(String requestId, ChannelHandlerContext ctx, HttpResponseStatus status) { sendResponse(requestId, ctx, status, "status: " + status.toString() + "\r\n"); } /** * sendResponse * * @param ctx * @param status * @param msg */ public static void sendResponse(String requestId, ChannelHandlerContext ctx, HttpResponseStatus status, String msg) { FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, status, Unpooled.copiedBuffer(msg, CharsetUtil.UTF_8)); response.headers().set(CONTENT_TYPE, "text/plain; charset=UTF-8"); response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes()); response.headers().set(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); removeChannelHandlerContext(requestId, ctx); } /** * sendResponse(成功应答需要注意isKeepAlive和isCloseChannel的值) * * @param requestId * @param ctx * @param status * @param contentType * @param respBodyString * @param isKeepAlive * @param isCloseChannel */ public static void sendResponse(String requestId, ChannelHandlerContext ctx, HttpResponseStatus status, String contentType, String respBodyString, boolean isKeepAlive, boolean isCloseChannel) { FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, status, Unpooled.copiedBuffer(respBodyString, CharsetUtil.UTF_8)); if (!StringUtil.isNullOrEmpty(contentType)) { response.headers().set(CONTENT_TYPE, contentType); } else { response.headers().set(CONTENT_TYPE, "text/plain; charset=UTF-8"); } if (isKeepAlive) { response.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE); } response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes()); response.headers().set(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); ChannelFuture future = ctx.channel().writeAndFlush(response); if (!isKeepAlive) { future.addListener(ChannelFutureListener.CLOSE); } removeChannelHandlerContext(requestId, ctx, isCloseChannel); } /** * sendResponse * * @param ctx * @param statusCode * @param resultDesc */ public static void sendResponse(String requestId, ChannelHandlerContext ctx, int statusCode, String resultDesc) { HttpResponseStatus httpResponseStatus = new HttpResponseStatus(statusCode, resultDesc); FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, httpResponseStatus, Unpooled.copiedBuffer(resultDesc, CharsetUtil.UTF_8)); response.headers().set(CONTENT_TYPE, "text/plain; charset=UTF-8"); response.headers().set(HttpHeaders.Names.CONTENT_LENGTH, response.content().readableBytes()); response.headers().set(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); removeChannelHandlerContext(requestId, ctx); } /** * 断点上传204应答 * * @param ctx * @param contentRange */ public static void sendBrokenUpload204Resonse(String requestId, ChannelHandlerContext ctx, String contentRange, boolean isKeepAlive, boolean isCloseChannel) { FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, HttpResponseStatus.NO_CONTENT, Unpooled.copiedBuffer("", CharsetUtil.UTF_8)); response.headers().set(ACCESS_CONTROL_ALLOW_ORIGIN, "*"); response.headers().set(CONTENT_RANGE, contentRange); ChannelFuture future = ctx.channel().writeAndFlush(response); if (!isKeepAlive) { future.addListener(ChannelFutureListener.CLOSE); } removeChannelHandlerContext(requestId, ctx, isCloseChannel); } public static String getMultipartUploadResponseBody(String remoteFileName, String fileUrl) throws Exception { return "{\"rc_url\":{\"path\":\"" + fileUrl + "\",\"type\":0}}"; } /** * getContentType * * @param fileName * @return */ public static String getFileExt(String fileName) { int index = fileName.lastIndexOf("."); if (index == -1) { return ""; } return fileName.substring(index + 1).toLowerCase(); } public static String getContentType(String fileName) { String fileExtName = getFileExt(fileName); if (fileExtName.equals("png")) { // MimetypesFileTypeMap目前缺少png类型 return "image/png"; } else { return "application/octet-stream"; } } /** * removeChannelHandlerContext * * @param requestId * @param ctx */ private static void removeChannelHandlerContext(String requestId, ChannelHandlerContext ctx) { removeChannelHandlerContext(requestId, ctx, true); } private static void removeChannelHandlerContext(String requestId, ChannelHandlerContext ctx, boolean isCloseChannel) { try { if (!StringUtil.isNullOrEmpty(requestId)) { // HttpFileServerController.getInstance().removeChannelHandlerContext(requestId); } if (isCloseChannel) ctx.channel().close(); } catch (Exception e) { logger.error("close error!", e); } } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/handler/IMActionHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.handler; import com.xiaoleilu.loServer.ServerSetting; import com.xiaoleilu.loServer.action.Action; import com.xiaoleilu.loServer.action.FileAction; import com.xiaoleilu.loServer.action.UnknownErrorAction; import com.xiaoleilu.loServer.filter.Filter; import io.moquette.spi.IMessagesStore; import io.moquette.spi.ISessionsStore; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.util.internal.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Action处理单元 * * @author Looly */ public class IMActionHandler extends ActionHandler { private static final Logger Logger = LoggerFactory.getLogger(IMActionHandler.class); public IMActionHandler(IMessagesStore messagesStore, ISessionsStore sessionsStore) { super(messagesStore, sessionsStore); } @Override boolean isValidePath(String path) { if (!StringUtil.isNullOrEmpty(path) && !path.startsWith("/admin")) { return true; } return false; } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/handler/Request.java ================================================ package com.xiaoleilu.loServer.handler; import java.io.IOException; import java.net.InetSocketAddress; import java.nio.charset.Charset; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import cn.hutool.core.convert.Convert; import cn.hutool.core.date.DateUtil; import cn.hutool.core.net.NetUtil; import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.URLUtil; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpHeaderValues; import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpMethod; import io.netty.handler.codec.http.HttpRequest; import io.netty.handler.codec.http.HttpVersion; import io.netty.handler.codec.http.QueryStringDecoder; import io.netty.handler.codec.http.cookie.Cookie; import io.netty.handler.codec.http.cookie.ServerCookieDecoder; import io.netty.handler.codec.http.multipart.Attribute; import io.netty.handler.codec.http.multipart.DefaultHttpDataFactory; import io.netty.handler.codec.http.multipart.FileUpload; import io.netty.handler.codec.http.multipart.HttpDataFactory; import io.netty.handler.codec.http.multipart.HttpPostRequestDecoder; import io.netty.handler.codec.http.multipart.InterfaceHttpData; import io.netty.handler.codec.http.multipart.InterfaceHttpData.HttpDataType; import org.slf4j.LoggerFactory; /** * Http请求对象 * * @author Looly * */ public class Request { private static final org.slf4j.Logger Logger = LoggerFactory.getLogger(Request.class); public static final String METHOD_DELETE = HttpMethod.DELETE.name(); public static final String METHOD_HEAD = HttpMethod.HEAD.name(); public static final String METHOD_GET = HttpMethod.GET.name(); public static final String METHOD_OPTIONS = HttpMethod.OPTIONS.name(); public static final String METHOD_POST = HttpMethod.POST.name(); public static final String METHOD_PUT = HttpMethod.PUT.name(); public static final String METHOD_TRACE = HttpMethod.TRACE.name(); private static final HttpDataFactory HTTP_DATA_FACTORY = new DefaultHttpDataFactory(DefaultHttpDataFactory.MINSIZE); private FullHttpRequest nettyRequest; private String path; private String ip; private Map headers = new HashMap(); private Map params = new HashMap(); private Map cookies = new HashMap(); /** * 构造 * * @param ctx ChannelHandlerContext * @param nettyRequest HttpRequest */ private Request(ChannelHandlerContext ctx, FullHttpRequest nettyRequest) { this.nettyRequest = nettyRequest; final String uri = nettyRequest.uri(); this.path = URLUtil.getPath(getUri()); this.putHeadersAndCookies(nettyRequest.headers()); // request URI parameters this.putParams(new QueryStringDecoder(uri)); // IP this.putIp(ctx); } /** * @return Netty的HttpRequest */ public HttpRequest getNettyRequest() { return this.nettyRequest; } /** * 获得版本信息 * * @return 版本 */ public String getProtocolVersion() { return nettyRequest.protocolVersion().text(); } /** * 获得URI(带参数的路径) * * @return URI */ public String getUri() { return nettyRequest.uri(); } /** * @return 获得path(不带参数的路径) */ public String getPath() { return path; } /** * 获得Http方法 * * @return Http method */ public String getMethod() { return nettyRequest.method().name(); } /** * 获得IP地址 * * @return IP地址 */ public String getIp() { return ip; } /** * 获得所有头信息 * * @return 头信息Map */ public Map getHeaders() { return headers; } /** * 使用ISO8859_1字符集获得Header内容
* 由于Header中很少有中文,故一般情况下无需转码 * * @param headerKey 头信息的KEY * @return 值 */ public String getHeader(String headerKey) { return headers.get(headerKey); } /** * @return 是否为普通表单(application/x-www-form-urlencoded) */ public boolean isXWwwFormUrlencoded() { return "application/x-www-form-urlencoded".equals(getHeader("Content-Type")); } /** * 获得指定的Cookie * * @param name cookie名 * @return Cookie对象 */ public Cookie getCookie(String name) { return cookies.get(name); } /** * @return 获得所有Cookie信息 */ public Map getCookies() { return this.cookies; } /** * @return 客户浏览器是否为IE */ public boolean isIE() { String userAgent = getHeader("User-Agent"); if (StrUtil.isNotBlank(userAgent)) { userAgent = userAgent.toUpperCase(); if (userAgent.contains("MSIE") || userAgent.contains("TRIDENT")) { return true; } } return false; } /** * @param name 参数名 * @return 获得请求参数 */ public String getParam(String name) { final Object value = params.get(name); if(null == value){ return null; } if(value instanceof String){ return (String)value; } return value.toString(); } /** * @param name 参数名 * @return 获得请求参数 */ public Object getObjParam(String name) { return params.get(name); } /** * 获得GET请求参数
* 会根据浏览器类型自动识别GET请求的编码方式从而解码
* charsetOfServlet为null则默认的ISO_8859_1 * * @param name 参数名 * @param charset 字符集 * @return 获得请求参数 */ public String getParam(String name, Charset charset) { if (null == charset) { charset = Charset.forName(CharsetUtil.ISO_8859_1); } String destCharset = CharsetUtil.UTF_8; if (isIE()) { // IE浏览器GET请求使用GBK编码 destCharset = CharsetUtil.GBK; } String value = getParam(name); if (METHOD_GET.equalsIgnoreCase(getMethod())) { value = CharsetUtil.convert(value, charset.toString(), destCharset); } return value; } /** * @param name 参数名 * @param defaultValue 当客户端未传参的默认值 * @return 获得请求参数 */ public String getParam(String name, String defaultValue) { String param = getParam(name); return StrUtil.isBlank(param) ? defaultValue : param; } /** * @param name 参数名 * @param defaultValue 当客户端未传参的默认值 * @return 获得Integer类型请求参数 */ public Integer getIntParam(String name, Integer defaultValue) { return Convert.toInt(getParam(name), defaultValue); } /** * @param name 参数名 * @param defaultValue 当客户端未传参的默认值 * @return 获得long类型请求参数 */ public Long getLongParam(String name, Long defaultValue) { return Convert.toLong(getParam(name), defaultValue); } /** * @param name 参数名 * @param defaultValue 当客户端未传参的默认值 * @return 获得Double类型请求参数 */ public Double getDoubleParam(String name, Double defaultValue) { return Convert.toDouble(getParam(name), defaultValue); } /** * @param name 参数名 * @param defaultValue 当客户端未传参的默认值 * @return 获得Float类型请求参数 */ public Float getFloatParam(String name, Float defaultValue) { return Convert.toFloat(getParam(name), defaultValue); } /** * @param name 参数名 * @param defaultValue 当客户端未传参的默认值 * @return 获得Boolean类型请求参数 */ public Boolean getBoolParam(String name, Boolean defaultValue) { return Convert.toBool(getParam(name), defaultValue); } /** * 格式:
* 1、yyyy-MM-dd HH:mm:ss
* 2、yyyy-MM-dd
* 3、HH:mm:ss
* * @param name 参数名 * @param defaultValue 当客户端未传参的默认值 * @return 获得Date类型请求参数,默认格式: */ public Date getDateParam(String name, Date defaultValue) { String param = getParam(name); return StrUtil.isBlank(param) ? defaultValue : DateUtil.parse(param); } /** * @param name 参数名 * @param format 格式 * @param defaultValue 当客户端未传参的默认值 * @return 获得Date类型请求参数 */ public Date getDateParam(String name, String format, Date defaultValue) { String param = getParam(name); return StrUtil.isBlank(param) ? defaultValue : DateUtil.parse(param, format); } /** * 获得请求参数
* 列表类型值,常用于表单中的多选框 * * @param name 参数名 * @return 数组 */ @SuppressWarnings("unchecked") public List getArrayParam(String name) { Object value = params.get(name); if(null == value){ return null; } if(value instanceof List){ return (List) value; }else if(value instanceof String){ return StrUtil.split((String)value, ','); }else{ throw new RuntimeException("Value is not a List type!"); } } /** * 获得所有请求参数 * * @return Map */ public Map getParams() { return params; } /** * @return 是否为长连接 */ public boolean isKeepAlive() { final String connectionHeader = getHeader(HttpHeaderNames.CONNECTION.toString()); // 无论任何版本Connection为close时都关闭连接 if (HttpHeaderValues.CLOSE.toString().equalsIgnoreCase(connectionHeader)) { return false; } // HTTP/1.0只有Connection为Keep-Alive时才会保持连接 if (HttpVersion.HTTP_1_0.text().equals(getProtocolVersion())) { if (false == HttpHeaderValues.KEEP_ALIVE.toString().equalsIgnoreCase(connectionHeader)) { return false; } } // HTTP/1.1默认打开Keep-Alive return true; } // --------------------------------------------------------- Protected method start /** * 填充参数(GET请求的参数) * * @param decoder QueryStringDecoder */ protected void putParams(QueryStringDecoder decoder) { if (null != decoder) { List valueList; for (Entry> entry : decoder.parameters().entrySet()) { valueList = entry.getValue(); if(null != valueList){ this.putParam(entry.getKey(), 1 == valueList.size() ? valueList.get(0) : valueList); } } } } /** * 填充参数(POST请求的参数) * * @param decoder QueryStringDecoder */ protected void putParams(HttpPostRequestDecoder decoder) { if (null == decoder) { return; } for (InterfaceHttpData data : decoder.getBodyHttpDatas()) { putParam(data); } } /** * 填充参数 * * @param data InterfaceHttpData */ protected void putParam(InterfaceHttpData data) { final HttpDataType dataType = data.getHttpDataType(); if (dataType == HttpDataType.Attribute) { //普通参数 Attribute attribute = (Attribute) data; try { this.putParam(attribute.getName(), attribute.getValue()); } catch (IOException e) { Logger.error(e.toString()); } }else if(dataType == HttpDataType.FileUpload){ //文件 FileUpload fileUpload = (FileUpload) data; if(fileUpload.isCompleted()){ try { this.putParam(data.getName(), fileUpload.getFile()); } catch (IOException e) { Logger.error(e.toString(), "Get file param [{}] error!", data.getName()); } } } } /** * 填充参数 * * @param key 参数名 * @param value 参数值 */ protected void putParam(String key, Object value) { this.params.put(key, value); } /** * 填充头部信息和Cookie信息 * * @param headers HttpHeaders */ protected void putHeadersAndCookies(HttpHeaders headers) { for (Entry entry : headers) { this.headers.put(entry.getKey(), entry.getValue()); } // Cookie final String cookieString = this.headers.get(HttpHeaderNames.COOKIE); if (StrUtil.isNotBlank(cookieString)) { final Set cookies = ServerCookieDecoder.LAX.decode(cookieString); for (Cookie cookie : cookies) { this.cookies.put(cookie.name(), cookie); } } } /** * 设置客户端IP * * @param ctx ChannelHandlerContext */ protected void putIp(ChannelHandlerContext ctx) { String ip = getHeader("X-Forwarded-For"); if (StrUtil.isNotBlank(ip)) { ip = NetUtil.getMultistageReverseProxyIp(ip); } else { final InetSocketAddress insocket = (InetSocketAddress) ctx.channel().remoteAddress(); ip = insocket.getAddress().getHostAddress(); } this.ip = ip; } // --------------------------------------------------------- Protected method end @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("\r\nprotocolVersion: ").append(getProtocolVersion()).append("\r\n"); sb.append("uri: ").append(getUri()).append("\r\n"); sb.append("path: ").append(path).append("\r\n"); sb.append("method: ").append(getMethod()).append("\r\n"); sb.append("ip: ").append(ip).append("\r\n"); sb.append("headers:\r\n "); for (Entry entry : headers.entrySet()) { sb.append(" ").append(entry.getKey()).append(": ").append(entry.getValue()).append("\r\n"); } sb.append("params: \r\n"); for (Entry entry : params.entrySet()) { sb.append(" ").append(entry.getKey()).append(": ").append(entry.getValue()).append("\r\n"); } return sb.toString(); } /** * 构建Request对象 * * @param ctx ChannelHandlerContext * @param nettyRequest Netty的HttpRequest * @return Request */ protected final static Request build(ChannelHandlerContext ctx, FullHttpRequest nettyRequest) { return new Request(ctx, nettyRequest); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/handler/Response.java ================================================ package com.xiaoleilu.loServer.handler; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.nio.charset.Charset; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.HashSet; import java.util.Locale; import java.util.Map.Entry; import java.util.Set; import java.util.TimeZone; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.StrUtil; import com.xiaoleilu.loServer.ServerSetting; import com.xiaoleilu.loServer.listener.FileProgressiveFutureListener; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.DefaultFileRegion; import io.netty.handler.codec.http.DefaultFullHttpResponse; import io.netty.handler.codec.http.DefaultHttpHeaders; import io.netty.handler.codec.http.DefaultHttpResponse; import io.netty.handler.codec.http.FullHttpResponse; import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpHeaderValues; import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpResponseStatus; import io.netty.handler.codec.http.HttpVersion; import io.netty.handler.codec.http.LastHttpContent; import io.netty.handler.codec.http.cookie.Cookie; import io.netty.handler.codec.http.cookie.DefaultCookie; import io.netty.handler.codec.http.cookie.ServerCookieEncoder; import org.apache.tika.Tika; import org.slf4j.LoggerFactory; import static cn.hutool.core.date.DatePattern.HTTP_DATETIME_PATTERN; /** * 响应对象 * * @author Looly * */ public class Response { private static final org.slf4j.Logger Logger = LoggerFactory.getLogger(Response.class); /** 返回内容类型:普通文本 */ public final static String CONTENT_TYPE_TEXT = "text/plain"; /** 返回内容类型:HTML */ public final static String CONTENT_TYPE_HTML = "text/html"; /** 返回内容类型:XML */ public final static String CONTENT_TYPE_XML = "text/xml"; /** 返回内容类型:JAVASCRIPT */ public final static String CONTENT_TYPE_JAVASCRIPT = "application/javascript"; /** 返回内容类型:JSON */ public final static String CONTENT_TYPE_JSON = "application/json"; public final static String CONTENT_TYPE_JSON_IE = "text/json"; private ChannelHandlerContext ctx; private Request request; private HttpVersion httpVersion = HttpVersion.HTTP_1_1; private HttpResponseStatus status = HttpResponseStatus.OK; private String contentType = CONTENT_TYPE_HTML; private String charset = ServerSetting.getCharset(); private HttpHeaders headers = new DefaultHttpHeaders(); private Set cookies = new HashSet(); private Object content = Unpooled.EMPTY_BUFFER; //发送完成标记 private boolean isSent; public Response(ChannelHandlerContext ctx, Request request) { this.ctx = ctx; this.request = request; } /** * 设置响应的Http版本号 * * @param httpVersion http版本号对象 * @return 自己 */ public Response setHttpVersion(HttpVersion httpVersion) { this.httpVersion = httpVersion; return this; } /** * 响应状态码
* 使用io.netty.handler.codec.http.HttpResponseStatus对象 * * @param status 状态码 * @return 自己 */ public Response setStatus(HttpResponseStatus status) { this.status = status; return this; } /** * 响应状态码 * * @param status 状态码 * @return 自己 */ public Response setStatus(int status) { return setStatus(HttpResponseStatus.valueOf(status)); } /** * 设置Content-Type * * @param contentType Content-Type * @return 自己 */ public Response setContentType(String contentType) { this.contentType = contentType; return this; } /** * 设置返回内容的字符集编码 * * @param charset 编码 * @return 自己 */ public Response setCharset(String charset) { this.charset = charset; return this; } /** * 增加响应的Header
* 重复的Header将被叠加 * * @param name 名 * @param value 值,可以是String,Date, int * @return 自己 */ public Response addHeader(String name, Object value) { headers.add(name, value); return this; } /** * 设置响应的Header
* 重复的Header将被替换 * * @param name 名 * @param value 值,可以是String,Date, int * @return 自己 */ public Response setHeader(String name, Object value) { headers.set(name, value); return this; } /** * 设置响应体长度 * * @param contentLength 响应体长度 * @return 自己 */ public Response setContentLength(long contentLength) { setHeader(HttpHeaderNames.CONTENT_LENGTH.toString(), contentLength); return this; } /** * 设置是否长连接 * * @return 自己 */ public Response setKeepAlive() { setHeader(HttpHeaderNames.CONNECTION.toString(), HttpHeaderValues.KEEP_ALIVE.toString()); return this; } // --------------------------------------------------------- Cookie start /** * 设定返回给客户端的Cookie * * @param cookie * @return 自己 */ public Response addCookie(Cookie cookie) { cookies.add(cookie); return this; } /** * 设定返回给客户端的Cookie * * @param name Cookie名 * @param value Cookie值 * @return 自己 */ public Response addCookie(String name, String value) { return addCookie(new DefaultCookie(name, value)); } /** * 设定返回给客户端的Cookie * * @param name cookie名 * @param value cookie值 * @param maxAgeInSeconds -1: 关闭浏览器清除Cookie. 0: 立即清除Cookie. n>0 : Cookie存在的秒数. * @param path Cookie的有效路径 * @param domain the Cookie可见的域,依据 RFC 2109 标准 * @return 自己 */ public Response addCookie(String name, String value, int maxAgeInSeconds, String path, String domain) { Cookie cookie = new DefaultCookie(name, value); if (domain != null) { cookie.setDomain(domain); } cookie.setMaxAge(maxAgeInSeconds); cookie.setPath(path); return addCookie(cookie); } /** * 设定返回给客户端的Cookie
* Path: "/"
* No Domain * * @param name cookie名 * @param value cookie值 * @param maxAgeInSeconds -1: 关闭浏览器清除Cookie. 0: 立即清除Cookie. n>0 : Cookie存在的秒数. * @return 自己 */ public Response addCookie(String name, String value, int maxAgeInSeconds) { return addCookie(name, value, maxAgeInSeconds, "/", null); } // --------------------------------------------------------- Cookie end /** * 设置响应HTML文本内容 * * @param contentText 响应的文本 * @return 自己 */ public Response setContent(String contentText) { this.content = Unpooled.copiedBuffer(contentText, Charset.forName(charset)); return this; } /** * 设置响应文本内容 * * @param contentText 响应的文本 * @return 自己 */ public Response setTextContent(String contentText) { setContentType(CONTENT_TYPE_TEXT); return setContent(contentText); } /** * 设置响应JSON文本内容 * * @param contentText 响应的JSON文本 * @return 自己 */ public Response setJsonContent(String contentText) { setContentType(request.isIE() ? CONTENT_TYPE_JSON : CONTENT_TYPE_JSON); return setContent(contentText); } /** * 设置响应XML文本内容 * * @param contentText 响应的XML文本 * @return 自己 */ public Response setXmlContent(String contentText) { setContentType(CONTENT_TYPE_XML); return setContent(contentText); } /** * 设置响应文本内容 * * @param contentBytes 响应的字节 * @return 自己 */ public Response setContent(byte[] contentBytes) { return setContent(Unpooled.copiedBuffer(contentBytes)); } /** * 设置响应文本内容 * * @param byteBuf 响应的字节 * @return 自己 */ public Response setContent(ByteBuf byteBuf) { this.content = byteBuf; return this; } /** * 设置响应到客户端的文件 * * @param file 文件 * @return 自己 */ public Response setContent(File file) { this.content = file; return this; } /** * Sets the Date and Cache headers for the HTTP Response * * @param response HTTP response * @param fileToCache file to extract content type */ /** * 设置日期和过期时间 * * @param lastModify 上一次修改时间 * @param httpCacheSeconds 缓存时间,单位秒 */ public void setDateAndCache(long lastModify, int httpCacheSeconds) { SimpleDateFormat formatter = new SimpleDateFormat(HTTP_DATETIME_PATTERN, Locale.US); formatter.setTimeZone(TimeZone.getTimeZone("GMT")); // Date header Calendar time = new GregorianCalendar(); setHeader(HttpHeaderNames.DATE.toString(), formatter.format(time.getTime())); // Add cache headers time.add(Calendar.SECOND, httpCacheSeconds); setHeader(HttpHeaderNames.EXPIRES.toString(), formatter.format(time.getTime())); setHeader(HttpHeaderNames.CACHE_CONTROL.toString(), "private, max-age=" + httpCacheSeconds); setHeader(HttpHeaderNames.LAST_MODIFIED.toString(), formatter.format(DateUtil.date(lastModify))); } // -------------------------------------------------------------------------------------- build HttpResponse start /** * 转换为Netty所用Response
* 不包括content,一般用于返回文件类型的响应 * * @return DefaultHttpResponse */ private DefaultHttpResponse toDefaultHttpResponse() { final DefaultHttpResponse defaultHttpResponse = new DefaultHttpResponse(httpVersion, status); // headers HttpHeaders httpHeaders = defaultHttpResponse.headers().add(headers); httpHeaders.set(HttpHeaderNames.CONTENT_TYPE.toString(), contentType); // Cookies for (Cookie cookie : cookies) { httpHeaders.add(HttpHeaderNames.SET_COOKIE.toString(), ServerCookieEncoder.LAX.encode(cookie)); } return defaultHttpResponse; } /** * 转换为Netty所用Response
* 用于返回一般类型响应(文本) * * @return FullHttpResponse */ private FullHttpResponse toFullHttpResponse() { final ByteBuf byteBuf = (ByteBuf)content; final FullHttpResponse fullHttpResponse = new DefaultFullHttpResponse(httpVersion, status, byteBuf); // headers final HttpHeaders httpHeaders = fullHttpResponse.headers().add(headers); if ("application/octet-stream".equals(contentType)) { httpHeaders.set(HttpHeaderNames.CONTENT_TYPE.toString(), contentType); } else { httpHeaders.set(HttpHeaderNames.CONTENT_TYPE.toString(), StrUtil.format("{};charset={}", contentType, charset)); httpHeaders.set(HttpHeaderNames.CONTENT_ENCODING.toString(), charset); } httpHeaders.set(HttpHeaderNames.CONTENT_LENGTH.toString(), byteBuf.readableBytes()); // Cookies for (Cookie cookie : cookies) { httpHeaders.add(HttpHeaderNames.SET_COOKIE.toString(), ServerCookieEncoder.LAX.encode(cookie)); } return fullHttpResponse; } // -------------------------------------------------------------------------------------- build HttpResponse end // -------------------------------------------------------------------------------------- send start /** * 发送响应到客户端
* * @return ChannelFuture * @throws IOException */ public ChannelFuture send() { ChannelFuture channelFuture; if(content instanceof File){ //文件 File file = (File)content; try { channelFuture = sendFile(file); } catch (IOException e) { Logger.error(StrUtil.format("Send {} error!", file), e.toString()); channelFuture = sendError(HttpResponseStatus.FORBIDDEN, ""); } }else{ //普通文本 channelFuture = sendFull(); } this.isSent = true; return channelFuture; } /** * @return 是否已经出发发送请求,内部使用
*/ protected boolean isSent(){ return this.isSent; } /** * 发送响应到客户端 * * @return ChannelFuture */ private ChannelFuture sendFull() { if (request != null && request.isKeepAlive()) { setKeepAlive(); return ctx.writeAndFlush(this.toFullHttpResponse()); } else { return sendAndCloseFull(); } } /** * 发送给到客户端并关闭ChannelHandlerContext * * @return ChannelFuture */ private ChannelFuture sendAndCloseFull() { return ctx.writeAndFlush(this.toFullHttpResponse()).addListener(ChannelFutureListener.CLOSE); } /** * 发送文件 * * @param file 文件 * @return ChannelFuture * @throws IOException */ private ChannelFuture sendFile(File file) throws IOException { final RandomAccessFile raf = new RandomAccessFile(file, "r"); // 内容长度 long fileLength = raf.length(); this.setContentLength(fileLength); //文件类型 Tika tika = new Tika(); String contentType = tika.detect(file); // String contentType = HttpUtil.getMimeType(file.getName()); if(StrUtil.isBlank(contentType)){ //无法识别默认使用数据流 contentType = "application/octet-stream"; } this.setContentType(contentType); ctx.write(this.toDefaultHttpResponse()); ctx.write(new DefaultFileRegion(raf.getChannel(), 0, fileLength), ctx.newProgressivePromise()) .addListener(FileProgressiveFutureListener.build(raf)); return sendEmptyLast(); } /** * 发送结尾标记,表示发送结束 * @return ChannelFuture */ private ChannelFuture sendEmptyLast(){ final ChannelFuture lastContentFuture = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); if (false == request.isKeepAlive()) { lastContentFuture.addListener(ChannelFutureListener.CLOSE); } return lastContentFuture; } // -------------------------------------------------------------------------------------- send end // ---------------------------------------------------------------------------- special response start /** * 302 重定向 * * @param uri 重定向到的URI * @return ChannelFuture */ public ChannelFuture sendRedirect(String uri) { return this.setStatus(HttpResponseStatus.FOUND).setHeader(HttpHeaderNames.LOCATION.toString(), uri).send(); } /** * 304 文件未修改 * * @return ChannelFuture */ public ChannelFuture sendNotModified() { return this.setStatus(HttpResponseStatus.NOT_MODIFIED).setHeader(HttpHeaderNames.DATE.toString(), DateUtil.formatHttpDate(DateUtil.date())).send(); } /** * 发送错误消息 * * @param status 错误状态码 * @param msg 消息内容 * @return ChannelFuture */ public ChannelFuture sendError(HttpResponseStatus status, String msg) { if (ctx.channel().isActive()) { return this.setStatus(status).setContent(msg).send(); } return null; } /** * 发送404 Not Found * * @param msg 消息内容 * @return ChannelFuture */ public ChannelFuture sendNotFound(String msg) { return sendError(HttpResponseStatus.NOT_FOUND, msg); } /** * 发送500 Internal Server Error * * @param msg 消息内容 * @return ChannelFuture */ public ChannelFuture sendServerError(String msg) { return sendError(HttpResponseStatus.INTERNAL_SERVER_ERROR, msg); } // ---------------------------------------------------------------------------- special response end @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("headers:\r\n "); for ( Entry entry : headers.entries()) { sb.append(" ").append(entry.getKey()).append(": ").append(entry.getValue()).append("\r\n"); } sb.append("content: ").append(StrUtil.str(content, CharsetUtil.UTF_8)); return sb.toString(); } // ---------------------------------------------------------------------------- static method start /** * 构建Response对象 * * @param ctx ChannelHandlerContext * @param request 请求对象 * @return Response对象 */ protected static Response build(ChannelHandlerContext ctx, Request request) { return new Response(ctx, request); } /** * 构建Response对象,Request对象为空,将无法获得某些信息
* 1. 无法使用长连接 * * @param ctx ChannelHandlerContext * @return Response对象 */ protected static Response build(ChannelHandlerContext ctx) { return new Response(ctx, null); } // ---------------------------------------------------------------------------- static method end } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/listener/FileProgressiveFutureListener.java ================================================ package com.xiaoleilu.loServer.listener; import java.io.RandomAccessFile; import cn.hutool.core.io.IoUtil; import io.netty.channel.ChannelProgressiveFuture; import io.netty.channel.ChannelProgressiveFutureListener; import org.slf4j.LoggerFactory; /** * 文件进度指示监听 * @author Looly * */ public class FileProgressiveFutureListener implements ChannelProgressiveFutureListener{ private static final org.slf4j.Logger Logger = LoggerFactory.getLogger(FileProgressiveFutureListener.class); private RandomAccessFile raf; public FileProgressiveFutureListener(RandomAccessFile raf) { this.raf = raf; } @Override public void operationProgressed(ChannelProgressiveFuture future, long progress, long total) { Logger.debug("Transfer progress: {} / {}", progress, total); } @Override public void operationComplete(ChannelProgressiveFuture future) { IoUtil.close(raf); Logger.debug("Transfer complete."); } /** * 构建文件进度指示监听 * @param raf RandomAccessFile * @return 文件进度指示监听 */ public static FileProgressiveFutureListener build(RandomAccessFile raf){ return new FileProgressiveFutureListener(raf); } } ================================================ FILE: broker/src/main/java/com/xiaoleilu/loServer/model/FriendData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package com.xiaoleilu.loServer.model; import java.io.Serializable; public class FriendData implements Serializable { private String userId; private String friendUid; private String alias; private String extra; private int state; private int blacked; private long timestamp; public FriendData(String userId, String friendUid, String alias, String extra, int state, int blacked, long timestamp) { this.userId = userId; this.friendUid = friendUid; this.alias = alias; this.extra = extra; this.state = state; this.blacked = blacked; this.timestamp = timestamp; } public FriendData() { } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getFriendUid() { return friendUid; } public void setFriendUid(String friendUid) { this.friendUid = friendUid; } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public int getState() { return state; } public void setState(int state) { this.state = state; } public int getBlacked() { return blacked; } public void setBlacked(int blacked) { this.blacked = blacked; } public long getTimestamp() { return timestamp; } public void setTimestamp(long timestamp) { this.timestamp = timestamp; } } ================================================ FILE: broker/src/main/java/io/moquette/BrokerConstants.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette; import java.io.File; public final class BrokerConstants { public static final String INTERCEPT_HANDLER_PROPERTY_NAME = "intercept.handler"; public static final String BROKER_INTERCEPTOR_THREAD_POOL_SIZE = "intercept.thread_pool.size"; public static final String PERSISTENT_STORE_PROPERTY_NAME = "persistent_store"; public static final String SERVER_IP_PROPERTY_NAME = "server.ip"; public static final String PORT_PROPERTY_NAME = "port"; public static final String HOST_PROPERTY_NAME = "host"; public static final String HTTP_SERVER_PORT = "http_port"; public static final String HTTP_LOCAL_PORT = "local_port"; public static final String ENCRYPT_AES256 = "encrypt.use_aes256"; public static final String HTTP_ADMIN_PORT = "http.admin.port"; public static final String DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME = "moquette_store.mapdb"; public static final String DEFAULT_PERSISTENT_PATH = System.getProperty("user.dir") + File.separator + DEFAULT_MOQUETTE_STORE_MAP_DB_FILENAME; public static final String WSS_PORT_PROPERTY_NAME = "secure_websocket_port"; public static final String SSL_PORT_PROPERTY_NAME = "ssl_port"; public static final String JKS_PATH_PROPERTY_NAME = "jks_path"; public static final String KEY_STORE_PASSWORD_PROPERTY_NAME = "key_store_password"; public static final String KEY_MANAGER_PASSWORD_PROPERTY_NAME = "key_manager_password"; public static final String AUTHORIZATOR_CLASS_NAME = "authorizator_class"; public static final String DB_AUTHENTICATOR_DRIVER = "authenticator.db.driver"; public static final String DB_AUTHENTICATOR_URL = "authenticator.db.url"; public static final String DB_AUTHENTICATOR_QUERY = "authenticator.db.query"; public static final String DB_AUTHENTICATOR_DIGEST = "authenticator.db.digest"; public static final int PORT = 1883; public static final String DISABLED_PORT_BIND = "disabled"; public static final String HOST = "0.0.0.0"; public static final String NEED_CLIENT_AUTH = "need_client_auth"; public static final String HAZELCAST_CLIENT_IP = "hazelcast.client.ip"; public static final String HAZELCAST_CLIENT_PORT = "hazelcast.client.port"; public static final String NETTY_SO_BACKLOG_PROPERTY_NAME = "netty.so_backlog"; public static final String NETTY_SO_REUSEADDR_PROPERTY_NAME = "netty.so_reuseaddr"; public static final String NETTY_TCP_NODELAY_PROPERTY_NAME = "netty.tcp_nodelay"; public static final String NETTY_SO_KEEPALIVE_PROPERTY_NAME = "netty.so_keepalive"; public static final String NETTY_CHANNEL_TIMEOUT_SECONDS_PROPERTY_NAME = "netty.channel_timeout.seconds"; public static final String NETTY_EPOLL_PROPERTY_NAME = "netty.epoll"; public static final String STORAGE_CLASS_NAME = "storage_class"; public static final String QINIU_SERVER_URL= "qiniu.server_url"; public static final String QINIU_ACCESS_KEY = "qiniu.access_key"; public static final String QINIU_SECRET_KEY = "qiniu.secret_key"; public static final String QINIU_BUCKET_GENERAL_NAME= "qiniu.bucket_general_name"; public static final String QINIU_BUCKET_GENERAL_DOMAIN = "qiniu.bucket_general_domain"; public static final String QINIU_BUCKET_IMAGE_NAME= "qiniu.bucket_image_name"; public static final String QINIU_BUCKET_IMAGE_DOMAIN = "qiniu.bucket_image_domain"; public static final String QINIU_BUCKET_VOICE_NAME= "qiniu.bucket_voice_name"; public static final String QINIU_BUCKET_VOICE_DOMAIN = "qiniu.bucket_voice_domain"; public static final String QINIU_BUCKET_VIDEO_NAME= "qiniu.bucket_video_name"; public static final String QINIU_BUCKET_VIDEO_DOMAIN = "qiniu.bucket_video_domain"; public static final String QINIU_BUCKET_FILE_NAME= "qiniu.bucket_file_name"; public static final String QINIU_BUCKET_FILE_DOMAIN = "qiniu.bucket_file_domain"; public static final String QINIU_BUCKET_STICKER_NAME= "qiniu.bucket_sticker_name"; public static final String QINIU_BUCKET_STICKER_DOMAIN = "qiniu.bucket_sticker_domain"; public static final String QINIU_BUCKET_MOMENTS_NAME= "qiniu.bucket_moments_name"; public static final String QINIU_BUCKET_MOMENTS_DOMAIN = "qiniu.bucket_moments_domain"; public static final String QINIU_BUCKET_PORTRAIT_NAME= "qiniu.bucket_portrait_name"; public static final String QINIU_BUCKET_PORTRAIT_DOMAIN = "qiniu.bucket_portrait_domain"; public static final String QINIU_BUCKET_FAVORITE_NAME= "qiniu.bucket_favorite_name"; public static final String QINIU_BUCKET_FAVORITE_DOMAIN = "qiniu.bucket_favorite_domain"; public static final String QINIU_BUCKET_CUSTOM1_NAME= "qiniu.bucket_custom1_name"; public static final String QINIU_BUCKET_CUSTOM1_DOMAIN = "qiniu.bucket_custom1_domain"; public static final String QINIU_BUCKET_CUSTOM2_NAME= "qiniu.bucket_custom2_name"; public static final String QINIU_BUCKET_CUSTOM2_DOMAIN = "qiniu.bucket_custom2_domain"; public static final String QINIU_BUCKET_CUSTOM3_NAME= "qiniu.bucket_custom3_name"; public static final String QINIU_BUCKET_CUSTOM3_DOMAIN = "qiniu.bucket_custom3_domain"; public static final String QINIU_BUCKET_PAN_NAME= "qiniu.bucket_pan_name"; public static final String QINIU_BUCKET_PAN_DOMAIN = "qiniu.bucket_pan_domain"; public static final String FILE_STORAGE_ROOT = "local.media.storage.root"; public static final String FILE_STORAGE_REMOTE_SERVER_URL = "local.media.storage.remote_server_url"; public static final String USER_QINIU = "media.server.use_qiniu"; public static final String PUSH_ANDROID_SERVER_ADDRESS = "push.android.server.address"; public static final String PUSH_IOS_SERVER_ADDRESS = "push.ios.server.address"; public static final String PUSH_HARMONY_SERVER_ADDRESS = "push.harmony.server.address"; public static final String MONITOR_Exception_Event_Address = "monitor.exception_event_address"; public static final String USER_ONLINE_STATUS_CALLBACK = "user.online_status_callback"; public static final String GROUP_INFO_UPDATE_CALLBACK = "group.group_info_update_callback"; public static final String GROUP_MEMBER_UPDATE_CALLBACK = "group.group_member_update_callback"; public static final String RELATION_UPDATE_CALLBACK = "relation.relation_update_callback"; public static final String USER_INFO_UPDATE_CALLBACK = "user.user_info_update_callback"; public static final String CHANNEL_INFO_UPDATE_CALLBACK = "channel.channel_info_update_callback"; public static final String CHATROOM_INFO_UPDATE_CALLBACK = "chatroom.chatroom_info_update_callback"; public static final String CHATROOM_MEMBER_UPDATE_CALLBACK = "chatroom.chatroom_member_update_callback"; public static final String HTTP_SERVER_SECRET_KEY = "http.admin.secret_key"; public static final String HTTP_SERVER_API_NO_CHECK_TIME = "http.admin.no_check_time"; public static final String TOKEN_SECRET_KEY = "token.key"; public static final String TOKEN_EXPIRE_TIME = "token.expire_time"; public static final String CONNECT_CLIENT_SIGNATURE_LIST = "connect.client_signature_list"; public static final String CONNECT_REJECT_EMPTY_SIGNATURE = "connect.reject_empty_signature"; public static final String ID_USE_UUID = "id.use_uuid"; public static final String EMBED_DB_PROPERTY_NAME = "embed.db"; public static final String DB_AUTO_CLEAN_HISTORY_MESSAGES = "db.auto_clean_history_messages"; public static final String H2DB_PATH = "h2db.path"; public static final String SENSITIVE_Filter_Type = "sensitive.filter.type"; public static final String SENSITIVE_Only_Message = "sensitive.only_message"; public static final String SENSITIVE_Remote_Server_URL = "sensitive.remote_server_url"; public static final String SENSITIVE_Remote_Message_Type = "sensitive.remote_sensitive_message_type"; public static final String SENSITIVE_Remote_Fail_When_Matched = "sensitive.remote_fail_when_matched"; public static final String MESSAGE_Forward_Url = "message.forward.url"; public static final String MESSAGE_Sensitive_Forward_Url = "message.sensitive.forward.url"; public static final String MESSAGE_Forward_Types = "message.forward.types"; public static final String MESSAGE_Forward_Exclude_Types = "message.forward.exclude_types"; public static final String MESSAGE_MentionMsg_Forward_Url = "message.mentionmsg.forward.url"; public static final String MESSAGE_RecallMsg_Forward_Url = "message.recallmsg.forward.url"; public static final String SERVER_MULTI_ENDPOINT = "server.multi_endpoint"; public static final String SERVER_MULTI_PC_ENDPOINT = "server.multi_pc_endpoint"; public static final String SERVER_MULTI_PAD_ENDPOINT = "server.multi_pad_endpoint"; public static final String SERVER_MULTI_WEARABLE_ENDPOINT = "server.multi_wearable_endpoint"; public static final String SERVER_MULTI_TV_ENDPOINT = "server.multi_tv_endpoint"; public static final String SERVER_MULTI_PLATFROM_NOTIFICATION = "server.multi_platform_notification"; public static final String SERVER_MOBILE_DEFAULT_SILENT_WHEN_PC_ONLINE = "server.mobile_default_silent_when_pc_online"; public static final String SERVER_CLIENT_SUPPORT_KICKOFF_EVENT = "server.client_support_kickoff_event"; public static final String MESSAGE_ROAMING = "message.roaming"; public static final String MESSAGE_Compensate_Time_Limit = "message.compensate_time_limit"; public static final String MESSAGE_Remote_History_Message = "message.remote_history_message"; public static final String MESSAGE_Remote_Chatroom_History_Message = "message.chatroom_remote_history_message"; public static final String MESSAGE_Max_Queue = "message.max_queue"; public static final String MESSAGE_Disable_Stranger_Chat = "message.disable_stranger_chat"; public static final String MESSAGE_Allow_Stranger_Chat_List = "message.allow_stranger_chat_list"; public static final String MESSAGE_Allow_Stranger_Line = "message.allow_stranger_line"; public static final String MESSAGE_Blacklist_Strategy = "message.blacklist.strategy"; public static final String MESSAGE_Blacklist_Allow_Send = "message.blacklist.allow_send_to_black"; public static final String MESSAGE_NO_Forward_Admin_Message = "message.no_forward_admin_message"; public static final String MESSAGE_Push_Expired_Days = "message.push_expired_days"; public static final String MESSAGE_Force_Push_Types = "message.force_push_types"; public static final String MESSAGE_Forward_With_Client_Info = "message.forward_with_client_info"; public static final String MESSAGE_Forward_With_Sender_Info = "message.forward_with_sender_info"; public static final String MESSAGE_Forward_With_Target_Info = "message.forward_with_target_info"; public static final String BROADCAST_Target_From_User_Table = "message.broadcast.target_from_user_table"; public static final String MESSAGES_ALLOW_SEND_TO_FORBIDDEN_USER = "message.allow_send_to_forbidden_user"; public static final String ROBOT_Callback_With_Client_Info = "robot.callback_with_client_info"; public static final String ROBOT_Callback_With_Sender_Info = "robot.callback_with_sender_info"; public static final String ROBOT_Callback_With_Target_Info = "robot.callback_with_target_info"; public static final String ROBOT_Mention_External_Robot = "robot.mention_external_robot"; public static final String ROBOT_Get_User_Info_Mask = "robot.get_user_info_mask"; public static final String CHANNEL_Callback_With_Client_Info = "channel.callback_with_client_info"; public static final String CHANNEL_Callback_With_Sender_Info = "channel.callback_with_sender_info"; public static final String CHANNEL_Callback_With_Target_Info = "channel.callback_with_target_info"; public static final String CHANNEL_New_Callback_Feature = "channel.new_callback_feature"; public static final String FRIEND_Disable_Search = "friend.disable_search"; public static final String FRIEND_Disable_NickName_Search = "friend.disable_nick_name_search"; public static final String FRIEND_Disable_UserId_Search = "friend.disable_user_id_search"; public static final String FRIEND_Disable_Friend_Request = "friend.disable_friend_request"; public static final String FRIEND_Repeat_Request_Duration = "friend.repeat_request_duration"; public static final String FRIEND_Reject_Request_Duration = "friend.reject_request_duration"; public static final String FRIEND_Request_Expiration_Duration = "friend.request_expiration_duration"; public static final String FRIEND_Request_Rate_Limit = "friend.request_rate_limit"; public static final String FRIEND_Search_Mobile_Empty_Rate_Limit = "friend.search_mobile_empty_rate_limit"; public static final String FRIEND_Search_Rate_Limit = "friend.search_rate_limit"; public static final String FRIEND_Request_Robot_Auto_Accept = "friend.robot_auto_accept"; public static final String CHATROOM_Participant_Idle_Time = "chatroom.participant_idle_time"; public static final String CHATROOM_Rejoin_When_Active = "chatroom.rejoin_when_active"; public static final String CHATROOM_Create_When_Not_Exist = "chatroom.create_when_not_exist"; public static final String CHATROOM_Kickoff_Other_Platform = "chatroom.kickoff_other_platform"; public static final String GROUP_Allow_Owner_Recall_Self_Msg = "group.allow_owner_recall_self_msg"; public static final String GROUP_Allow_Manager_Recall_Self_Msg = "group.allow_manager_recall_self_msg"; public static final String GROUP_Allow_Client_Custom_Operation_Notification = "group.allow_client_custom_operation_notification"; public static final String GROUP_Allow_Robot_Custom_Operation_Notification = "group.allow_robot_custom_operation_notificatio"; public static final String GROUP_Visible_Quit_Kickoff_Notification = "group.visible_quit_or_kickoff_notification"; public static final String GROUP_Forbidden_Client_Operation = "group.forbidden_client_operation"; public static final String GROUP_Disable_Stranger_Invite = "group.disable_stranger_invite"; public static final String GROUP_ADD_MEMBER_ALLOW_PART_SUCCESS = "group.add_member_allow_part_success"; public static final String GROUP_INFO_MARK_DELETION = "group.enable_mark_deletion"; public static final String USER_HIDE_PROPERTIES = "user.hide_properties"; public static final String USER_KEEP_DISPLAY_NAME_WHEN_DESTROY = "user.keep_display_name_when_destroy"; public static final String USER_KEEP_FULL_INFO_WHEN_DESTROY = "user.keep_full_info_when_destroy"; public static final String USER_KEEP_MOBILE_WHEN_DESTROY = "user.keep_mobile_when_destroy"; public static final String USER_KEEP_MESSAGES_WHEN_DESTROY = "user.keep_messages_when_destroy"; public static final String SYNC_Data_Part_Size = "sync.data_part_size"; public static final String MESSAGES_FORBIDDEN_CLIENT_SEND_TYPES = "message.forbidden_client_send_types"; public static final String MESSAGES_BLACKLIST_EXCEPTION_TYPES = "message.blacklist_exception_types"; public static final String MESSAGES_GROUP_MUTE_EXCEPTION_TYPES = "message.group_mute_exception_types"; public static final String MESSAGES_GLOBAL_MUTE_EXCEPTION_TYPES = "message.global_mute_exception_types"; public static final String MESSAGES_DISABLE_REMOTE_SEARCH = "message.disable_remote_search"; public static final String MESSAGES_ENCRYPT_MESSAGE_CONTENT = "message.encrypt_message_content"; public static final String MESSAGES_RECALL_TIME_LIMIT = "message.recall_time_limit"; public static final String MESSAGES_DISABLE_GROUP_MANAGER_RECALL = "message.disable_group_manager_recall"; public static final String HTTP_ADMIN_RATE_LIMIT = "http.admin.rate_limit"; public static final String HTTP_ROBOT_RATE_LIMIT = "http.robot.rate_limit"; public static final String HTTP_CHANNEL_RATE_LIMIT = "http.channel.rate_limit"; public static final String CLIENT_REQUEST_RATE_LIMIT = "client.request_rate_limit"; public static final String HTTP_CLOSE_API_VERSION = "http.close_api_version"; private BrokerConstants() { } } ================================================ FILE: broker/src/main/java/io/moquette/connections/IConnectionsManager.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.connections; import java.util.Collection; /** * This interface will be used by an external codebase to retrieve and close physical connections. */ public interface IConnectionsManager { /** * Returns the number of physical connections * * @return */ int getActiveConnectionsNo(); /** * Determines wether a MQTT client is connected to the broker. * * @param clientID * @return */ boolean isConnected(String clientID); /** * Returns the identifiers of the MQTT clients that are connected to the broker. * * @return */ Collection getConnectedClientIds(); /** * Closes a physical connection. * * @param clientID * @param closeImmediately * If false, the connection will be flushed before it is closed. * @return */ boolean closeConnection(String clientID, boolean closeImmediately); /** * Returns the state of the session of a given client. * * @param clientID * @return */ MqttSession getSessionStatus(String clientID); /** * Returns the state of all the sessions * * @return */ Collection getSessions(); } ================================================ FILE: broker/src/main/java/io/moquette/connections/MqttConnectionMetrics.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.connections; /** * A class that represents the metrics of a given MQTT connection. */ public class MqttConnectionMetrics { private long readKb; private long writtenKb; private long readMessages; private long writtenMessages; public MqttConnectionMetrics(long readBytes, long writtenBytes, long readMessages, long writtenMessages) { this.readKb = readBytes / 1024; this.writtenKb = writtenBytes / 1024; this.readMessages = readMessages; this.writtenMessages = writtenMessages; } public long getReadKb() { return readKb; } public long getWrittenKb() { return writtenKb; } public long getReadMessages() { return readMessages; } public long getWrittenMessages() { return writtenMessages; } } ================================================ FILE: broker/src/main/java/io/moquette/connections/MqttSession.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.connections; import java.util.Collection; /** * A class that represents the overall connection status of a MQTT session. Its instances will be * used by an external codebase when the broker is configured in embedded mode. */ public class MqttSession { private boolean connectionEstablished; private boolean cleanSession; private int inflightMessages; private int pendingPublishMessagesNo; private int secondPhaseAckPendingMessages; private MqttConnectionMetrics connectionMetrics; public boolean isConnectionEstablished() { return connectionEstablished; } public void setConnectionEstablished(boolean connectionEstablished) { this.connectionEstablished = connectionEstablished; } public boolean isCleanSession() { return cleanSession; } public void setCleanSession(boolean cleanSession) { this.cleanSession = cleanSession; } public int getPendingPublishMessagesNo() { return pendingPublishMessagesNo; } public void setPendingPublishMessagesNo(int pendingPublishMessagesNo) { this.pendingPublishMessagesNo = pendingPublishMessagesNo; } public int getInflightMessages() { return inflightMessages; } public void setInflightMessages(int inflightMessages) { this.inflightMessages = inflightMessages; } public int getSecondPhaseAckPendingMessages() { return secondPhaseAckPendingMessages; } public void setSecondPhaseAckPendingMessages(int secondPhaseAckPendingMessages) { this.secondPhaseAckPendingMessages = secondPhaseAckPendingMessages; } public MqttConnectionMetrics getConnectionMetrics() { return connectionMetrics; } public void setConnectionMetrics(MqttConnectionMetrics connectionMetrics) { this.connectionMetrics = connectionMetrics; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/AddFriendHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; import static win.liyufan.im.IMTopic.HandleFriendRequestTopic; @Handler(IMTopic.AddFriendRequestTopic) public class AddFriendHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.AddFriendRequest request, Qos1PublishHandler.IMCallback callback) { long[] head = new long[1]; boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; boolean isRobot = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Robot; ErrorCode errorCode = m_messagesStore.saveAddFriendRequest(fromUser, request, head, isAdmin, isRobot); if (errorCode == ERROR_CODE_SUCCESS) { WFCMessage.User user = m_messagesStore.getUserInfo(request.getTargetUid()); if (user != null && user.getType() == ProtoConstants.UserType.UserType_Normal) { publisher.publishNotification(IMTopic.NotifyFriendRequestTopic, request.getTargetUid(), head[0], fromUser, request.getReason()); } else if(user != null && user.getType() == ProtoConstants.UserType.UserType_Robot) { if(m_messagesStore.isRobotAutoAcceptFriendRequest()) { WFCMessage.HandleFriendRequest handleFriendRequest = WFCMessage.HandleFriendRequest.newBuilder().setTargetUid(fromUser).setStatus(ProtoConstants.FriendRequestStatus.RequestStatus_Accepted).build(); mServer.onApiMessage(request.getTargetUid(), null, handleFriendRequest.toByteArray(), 0, fromUser, HandleFriendRequestTopic, requestSourceType); } } } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/AddGroupMember.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.pojos.GroupNotificationBinaryContent; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import java.util.HashMap; import java.util.List; import java.util.Map; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(value = IMTopic.AddGroupMemberTopic) public class AddGroupMember extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.AddGroupMemberRequest request, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) { int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation(); if(request.getAddedMemberList().size() == 1 && request.getAddedMember(0).getMemberId().equals(fromUser)) { if ((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Join_Group) > 0) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } else { if ((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Invite_Group_Member) > 0) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } } Map failedMembers = new HashMap<>(); if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) { ErrorCode errorCode = m_messagesStore.canAddGroupMembers(fromUser, request.getAddedMemberList(), failedMembers); if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { return errorCode; } } ErrorCode errorCode = m_messagesStore.addGroupMembers(fromUser, isAdmin, request.getGroupId(), request.getAddedMemberList(), request.getExtra(), failedMembers); if (errorCode == ERROR_CODE_SUCCESS) { if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) { sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), request.getNotifyContent()); } else { List added = getMemberIdList(request.getAddedMemberList()); added.removeAll(failedMembers.keySet()); WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, null, added).setExtra(request.getExtra()).getAddGroupNotifyContent(); sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content); } } if (errorCode == ERROR_CODE_SUCCESS && !failedMembers.isEmpty()) { WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, null, "").setMi(failedMembers).getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_REJECT_JOIN_GROUP); sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content); } if(errorCode == ERROR_CODE_SUCCESS && !failedMembers.isEmpty()) { return ErrorCode.ERROR_CODE_PARTLY_SUCCESS; } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/BlackListRequestHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.BlackListUserTopic) public class BlackListRequestHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.BlackUserRequest request, Qos1PublishHandler.IMCallback callback) { long[] head = new long[1]; ErrorCode errorCode = m_messagesStore.blackUserRequest(fromUser, request.getUid(), request.getStatus(), head); if (errorCode == ERROR_CODE_SUCCESS) { publisher.publishNotification(IMTopic.NotifyFriendTopic, fromUser, head[0]); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/BroadcastMessageHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.util.StringUtil; import io.moquette.BrokerConstants; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; import win.liyufan.im.MessageShardingUtil; import java.util.Set; import static cn.wildfirechat.proto.ProtoConstants.ContentType.Text; @Handler(value = IMTopic.BroadcastMessageTopic) public class BroadcastMessageHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.Message message, Qos1PublishHandler.IMCallback callback) { ErrorCode errorCode = ErrorCode.ERROR_CODE_SUCCESS; boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if (message != null) { if (!isAdmin) { //only admin can broadcast message return ErrorCode.ERROR_CODE_NOT_RIGHT; } long timestamp = System.currentTimeMillis(); long messageId = 0; try { messageId = MessageShardingUtil.generateId(); } catch (Exception e) { e.printStackTrace(); return ErrorCode.ERROR_CODE_SERVER_ERROR; } message = message.toBuilder().setFromUser(fromUser).setMessageId(messageId).setServerTimestamp(timestamp).setConversation(WFCMessage.Conversation.newBuilder().setTarget(fromUser).setLine(message.getConversation().getLine()).setType(ProtoConstants.ConversationType.ConversationType_Private).build()).build(); long count = saveAndBroadcast(fromUser, clientID, message); ackPayload = ackPayload.capacity(20); ackPayload.writeLong(messageId); ackPayload.writeLong(count); } else { errorCode = ErrorCode.ERROR_CODE_INVALID_MESSAGE; } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/ChannelListenMember.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import static win.liyufan.im.IMTopic.PutUserSettingTopic; import static win.liyufan.im.UserSettingScope.kUserSettingListenedChannels; @Handler(value = IMTopic.ChannelListenTopic) public class ChannelListenMember extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.ListenChannel request, Qos1PublishHandler.IMCallback callback) { ErrorCode errorCode = m_messagesStore.listenChannel(fromUser, request.getChannelId(), request.getListen()>0); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { WFCMessage.ModifyUserSettingReq modifyUserSettingReq = WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingListenedChannels).setKey(request.getChannelId()).setValue(request.getListen() > 0 ? "1" : "0").build(); mServer.onApiMessage(fromUser, null, modifyUserSettingReq.toByteArray(), 0, fromUser, PutUserSettingTopic, requestSourceType); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/ChannelListenedListHandler.java ================================================ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; import java.util.List; @Handler(IMTopic.ListenedChannelListTopic) public class ChannelListenedListHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, Void request, Qos1PublishHandler.IMCallback callback) { List channelInfoList = m_messagesStore.getListenedChannels(fromUser); WFCMessage.IDListBuf.Builder builder = WFCMessage.IDListBuf.newBuilder(); builder.addAllId(channelInfoList); byte[] data = builder.build().toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/ChannelSearchHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import java.util.List; @Handler(IMTopic.ChannelSearchTopic) public class ChannelSearchHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.SearchUserRequest request, Qos1PublishHandler.IMCallback callback) { List users = m_messagesStore.searchChannel(request.getKeyword(), request.getFuzzy() > 0, request.getPage()); WFCMessage.SearchChannelResult.Builder builder = WFCMessage.SearchChannelResult.newBuilder(); builder.addAllChannel(users); builder.setKeyword(request.getKeyword()); byte[] data = builder.build().toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/ConfigApplicationHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.ApplicationConfigRequestTopic) public class ConfigApplicationHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.ApplicationConfigRequest request, Qos1PublishHandler.IMCallback callback) { ErrorCode errorCode = m_messagesStore.configApplication(request.getAppId(), request.getAppType(), request.getTimestamp(), request.getNonce(), request.getSignature()); return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/CreateChannelHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.util.StringUtil; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import static cn.wildfirechat.proto.ProtoConstants.RequestSourceType.Request_From_Admin; import static win.liyufan.im.IMTopic.PutUserSettingTopic; import static win.liyufan.im.UserSettingScope.kUserSettingMyChannels; @Handler(value = IMTopic.CreateChannelTopic) public class CreateChannelHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.ChannelInfo request, Qos1PublishHandler.IMCallback callback) { WFCMessage.ChannelInfo.Builder builder = request.toBuilder(); if (StringUtil.isNullOrEmpty(request.getTargetId())) { builder.setTargetId(m_messagesStore.getShortUUID()); } if (StringUtil.isNullOrEmpty(request.getOwner())) { builder.setOwner(fromUser); } if (StringUtil.isNullOrEmpty(request.getSecret())) { builder.setSecret(m_messagesStore.getShortUUID()); } long update = System.currentTimeMillis(); request = builder.setUpdateDt(update).build(); ErrorCode errorCode = m_messagesStore.createChannel(fromUser, request); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { WFCMessage.ModifyUserSettingReq modifyUserSettingReq = WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingMyChannels).setKey(request.getTargetId()).setValue("1").build(); mServer.onApiMessage(fromUser, null, modifyUserSettingReq.toByteArray(), 0, fromUser, PutUserSettingTopic, requestSourceType); byte[] data; if (requestSourceType == Request_From_Admin) { //When server api create channel, need return channelId and secret together. data = (request.getTargetId() + "|" + request.getSecret()).getBytes(); } else { data = request.getTargetId().getBytes(); } ackPayload.ensureWritable(data.length).writeBytes(data); return ErrorCode.ERROR_CODE_SUCCESS; } else { return errorCode; } } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/CreateGroupHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.pojos.GroupNotificationBinaryContent; import com.hazelcast.util.StringUtil; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import java.util.HashMap; import java.util.Map; import java.util.Set; @Handler(value = IMTopic.CreateGroupTopic) public class CreateGroupHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.CreateGroupRequest request, Qos1PublishHandler.IMCallback callback) { if(request.getGroup().getGroupInfo().getType() < 0 || request.getGroup().getGroupInfo().getType() > 3) { return ErrorCode.ERROR_CODE_INVALID_DATA; } if (!StringUtil.isNullOrEmpty(request.getGroup().getGroupInfo().getTargetId())) { WFCMessage.GroupInfo existGroupInfo = m_messagesStore.getGroupInfo(request.getGroup().getGroupInfo().getTargetId()); if (existGroupInfo != null && existGroupInfo.getDeleted() == 0) { return ErrorCode.ERROR_CODE_GROUP_ALREADY_EXIST; } } boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !m_messagesStore.isAllowClientCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_Robot && !m_messagesStore.isAllowRobotCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(!isAdmin && request.getGroup().getGroupInfo().getType() == ProtoConstants.GroupType.GroupType_Organization) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) { int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation(); if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Create_Group) > 0) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } Map failedMembers = new HashMap<>(); if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) { ErrorCode errorCode = m_messagesStore.canAddGroupMembers(fromUser, request.getGroup().getMembersList(), failedMembers); if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { return errorCode; } } if (request.getGroup().getGroupInfo().getTargetId().length() > 64 || request.getGroup().getGroupInfo().getName().length() > 64 || request.getGroup().getGroupInfo().getPortrait().length() > 1024) { return ErrorCode.INVALID_PARAMETER; } if(!isAdmin && !StringUtil.isNullOrEmpty(request.getGroup().getGroupInfo().getName())) { if(!m_messagesStore.isSensitiveOnlyMessage()) { Set matched = m_messagesStore.handleSensitiveWord(request.getGroup().getGroupInfo().getName()); if (matched != null && !matched.isEmpty()) { return ErrorCode.ERROR_CODE_SENSITIVE_MATCHED; } } if(!m_messagesStore.isAllowName(request.getGroup().getGroupInfo().getName())) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } WFCMessage.GroupInfo groupInfo = m_messagesStore.createGroup(fromUser, request.getGroup().getGroupInfo(), request.getGroup().getMembersList(), request.getMemberExtra(), isAdmin, failedMembers); if (groupInfo != null && groupInfo.getDeleted() == 0) { if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0) { sendGroupNotification(fromUser, groupInfo.getTargetId(), request.getToLineList(), request.getNotifyContent()); } else { WFCMessage.MessageContent content = new GroupNotificationBinaryContent(groupInfo.getTargetId(), fromUser, groupInfo.getName(), "").setExtra(request.getMemberExtra()).getCreateGroupNotifyContent(); sendGroupNotification(fromUser, groupInfo.getTargetId(), request.getToLineList(), content); } if(!failedMembers.isEmpty()) { WFCMessage.MessageContent content = new GroupNotificationBinaryContent(groupInfo.getTargetId(), fromUser, null, "").setMi(failedMembers).getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_REJECT_JOIN_GROUP); sendGroupNotification(fromUser, groupInfo.getTargetId(), request.getToLineList(), content); } } byte[] data = groupInfo.getTargetId().getBytes(); ackPayload.ensureWritable(data.length).writeBytes(data); if(failedMembers.isEmpty()) { return ErrorCode.ERROR_CODE_SUCCESS; } else { return ErrorCode.ERROR_CODE_PARTLY_SUCCESS; } } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/DeleteFriendHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.DeleteFriendTopic) public class DeleteFriendHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.IDBuf request, Qos1PublishHandler.IMCallback callback) { long[] head = new long[2]; ErrorCode errorCode = m_messagesStore.deleteFriend(fromUser, request.getId(), head); if (errorCode == ERROR_CODE_SUCCESS) { publisher.publishNotification(IMTopic.NotifyFriendTopic, fromUser, head[0]); publisher.publishNotification(IMTopic.NotifyFriendTopic, request.getId(), head[1]); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/DestroyChannelHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import static win.liyufan.im.IMTopic.PutUserSettingTopic; import static win.liyufan.im.UserSettingScope.kUserSettingMyChannels; @Handler(value = IMTopic.DestroyChannelInfoTopic) public class DestroyChannelHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.IDBuf request, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; ErrorCode errorCode = m_messagesStore.destroyChannel(fromUser, request.getId(), isAdmin); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { WFCMessage.ModifyUserSettingReq modifyUserSettingReq = WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingMyChannels).setKey(request.getId()).setValue("0").build(); mServer.onApiMessage(fromUser, null, modifyUserSettingReq.toByteArray(), 0, fromUser, PutUserSettingTopic, requestSourceType); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/DestroyUserHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; @Handler(IMTopic.DestroyUserTopic) public class DestroyUserHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.IDBuf request, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if (isAdmin) { mServer.getImBusinessScheduler().execute(()-> { m_sessionsStore.clearUserSession(fromUser); m_messagesStore.clearUserMessages(fromUser); m_messagesStore.clearUserSettings(fromUser); m_messagesStore.clearUserFriend(fromUser); m_messagesStore.clearUserGroups(fromUser); m_messagesStore.clearUserChannels(fromUser); m_messagesStore.destroyUser(fromUser); m_messagesStore.destroyRobot(fromUser); }); return ErrorCode.ERROR_CODE_SUCCESS; } else { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/DisconnectHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.model.FriendData; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; import java.util.List; @Handler(value = IMTopic.ClearSessionTopic) public class DisconnectHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, Byte request, Qos1PublishHandler.IMCallback callback) { if (request == 8) { m_sessionsStore.cleanSession(fromUser, clientID); } else if(request == 1) { m_sessionsStore.disableSession(fromUser, clientID); } return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/DismissGroupHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.pojos.GroupNotificationBinaryContent; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import static win.liyufan.im.IMTopic.DismissGroupTopic; @Handler(value = DismissGroupTopic) public class DismissGroupHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.DismissGroupRequest request, Qos1PublishHandler.IMCallback callback) { WFCMessage.GroupInfo groupInfo = m_messagesStore.getGroupInfo(request.getGroupId()); boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; ErrorCode errorCode; if (groupInfo == null) { errorCode = m_messagesStore.dismissGroup(fromUser, request.getGroupId(), isAdmin); } else if (isAdmin || (groupInfo.getType() == ProtoConstants.GroupType.GroupType_Normal || groupInfo.getType() == ProtoConstants.GroupType.GroupType_Restricted) && groupInfo.getOwner() != null && groupInfo.getOwner().equals(fromUser)) { if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !m_messagesStore.isAllowClientCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_Robot && !m_messagesStore.isAllowRobotCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) { int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation(); if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Dismiss_Group) > 0) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } //send notify message first, then dismiss group if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) { sendGroupNotification(fromUser, groupInfo.getTargetId(), request.getToLineList(), request.getNotifyContent()); } else { WFCMessage.MessageContent content = new GroupNotificationBinaryContent(groupInfo.getTargetId(), fromUser, null, "").getDismissGroupNotifyContent(); sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content); } errorCode = m_messagesStore.dismissGroup(fromUser, request.getGroupId(), isAdmin); } else { errorCode = ErrorCode.ERROR_CODE_NOT_RIGHT; } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/FriendPullHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.model.FriendData; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import java.util.List; @Handler(IMTopic.FriendPullTopic) public class FriendPullHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.Version request, Qos1PublishHandler.IMCallback callback) { List friendDatas = m_messagesStore.getFriendList(fromUser, clientID, request.getVersion()); WFCMessage.GetFriendsResult.Builder builder = WFCMessage.GetFriendsResult.newBuilder(); for (FriendData data : friendDatas ) { WFCMessage.Friend.Builder builder1 = WFCMessage.Friend.newBuilder().setState(data.getState()).setBlacked(data.getBlacked()).setUid(data.getFriendUid()).setUpdateDt(data.getTimestamp()); if (!StringUtil.isNullOrEmpty(data.getAlias())) { builder1.setAlias(data.getAlias()); } if (!StringUtil.isNullOrEmpty(data.getExtra())) { builder1.setExtra(data.getExtra()); } builder.addEntry(builder1.build()); } byte[] data = builder.build().toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/FriendRequestPullHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import java.util.List; @Handler(IMTopic.FriendRequestPullTopic) public class FriendRequestPullHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.Version request, Qos1PublishHandler.IMCallback callback) { List friendDatas = m_messagesStore.getFriendRequestList(fromUser, request.getVersion()); WFCMessage.GetFriendRequestResult.Builder builder = WFCMessage.GetFriendRequestResult.newBuilder(); builder.addAllEntry(friendDatas); byte[] data = builder.build().toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetApplicationTokenHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.GetApplicationTokenRequestTopic) public class GetApplicationTokenHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.AuthCodeRequest request, Qos1PublishHandler.IMCallback callback) { String authCode = m_messagesStore.getApplicationAuthCode(fromUser, request.getTargetId(), request.getType(), request.getHost()); if(authCode != null) { byte[] data = WFCMessage.IDBuf.newBuilder().setId(authCode).build().toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); return ERROR_CODE_SUCCESS; } return ErrorCode.INVALID_PARAMETER; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetChannelInfoHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Handler(IMTopic.ChannelPullTopic) public class GetChannelInfoHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.PullChannelInfo request, Qos1PublishHandler.IMCallback callback) { ErrorCode errorCode = ErrorCode.ERROR_CODE_SUCCESS; WFCMessage.ChannelInfo info = m_messagesStore.getChannelInfo(request.getChannelId()); if (info == null) { errorCode = ErrorCode.ERROR_CODE_NOT_EXIST; } else if(info.getUpdateDt() <= request.getHead()) { errorCode = ErrorCode.ERROR_CODE_NOT_MODIFIED; } else { if (!info.getOwner().equals(fromUser)) { info = info.toBuilder().clearCallback().clearSecret().build(); } byte[] data = info.toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetChatroomInfoHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Handler(IMTopic.GetChatroomInfoTopic) public class GetChatroomInfoHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.GetChatroomInfoRequest request, Qos1PublishHandler.IMCallback callback) { ErrorCode errorCode = ErrorCode.ERROR_CODE_SUCCESS; WFCMessage.ChatroomInfo info = m_messagesStore.getChatroomInfo(request.getChatroomId()); if (info == null) { errorCode = ErrorCode.ERROR_CODE_NOT_EXIST; } else if(info.getUpdateDt() <= request.getUpdateDt()) { errorCode = ErrorCode.ERROR_CODE_NOT_MODIFIED; } else { int memberCount = m_messagesStore.getChatroomMemberCount(request.getChatroomId()); byte[] data = info.toBuilder().setMemberCount(memberCount).build().toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetChatroomMemberHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Handler(IMTopic.GetChatroomMemberTopic) public class GetChatroomMemberHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.GetChatroomMemberInfoRequest request, Qos1PublishHandler.IMCallback callback) { ErrorCode errorCode = ErrorCode.ERROR_CODE_SUCCESS; WFCMessage.ChatroomMemberInfo info = m_messagesStore.getChatroomMemberInfo(request.getChatroomId(), request.getMaxCount()); if (info != null) { byte[] data = info.toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); } else { errorCode = ErrorCode.ERROR_CODE_NOT_EXIST; } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetCommonGroupsHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; import java.util.Set; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.GetCommonGroupsTopic) public class GetCommonGroupsHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.IDBuf request, Qos1PublishHandler.IMCallback callback) { WFCMessage.PullUserResult.Builder resultBuilder = WFCMessage.PullUserResult.newBuilder(); Set strings = m_messagesStore.getCommonGroupIds(fromUser, request.getId()); WFCMessage.IDListBuf idListBuf = WFCMessage.IDListBuf.newBuilder().addAllId(strings).build(); byte[] data = idListBuf.toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); return ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetGroupInfoHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import java.util.List; @Handler(IMTopic.GetGroupInfoTopic) public class GetGroupInfoHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.PullUserRequest request, Qos1PublishHandler.IMCallback callback) { List infos = m_messagesStore.getGroupInfos(request.getRequestList(), fromUser, requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin); WFCMessage.PullGroupInfoResult result = WFCMessage.PullGroupInfoResult.newBuilder().addAllInfo(infos).build(); byte[] data = result.toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetGroupMemberHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import java.util.ArrayList; import java.util.List; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.GetGroupMemberTopic) public class GetGroupMemberHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.PullGroupMemberRequest request, Qos1PublishHandler.IMCallback callback) { List members = new ArrayList<>(); ErrorCode errorCode = m_messagesStore.getGroupMembers(fromUser, request.getTarget(), request.getHead(), members); if (errorCode == ERROR_CODE_SUCCESS) { WFCMessage.PullGroupMemberResult result = WFCMessage.PullGroupMemberResult.newBuilder().addAllMember(members).build(); byte[] data = result.toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetMediaUploadTokenHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.util.StringUtil; import com.qiniu.util.Auth; import com.xiaoleilu.loServer.action.UploadFileAction; import io.moquette.server.config.MediaServerConfig; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import static io.moquette.server.config.MediaServerConfig.FILE_STROAGE_REMOTE_SERVER_URL; @Handler("GMUT") public class GetMediaUploadTokenHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.GetUploadTokenRequest request, Qos1PublishHandler.IMCallback callback) { int type = request.getMediaType(); String token; WFCMessage.GetUploadTokenResult.Builder resultBuilder = WFCMessage.GetUploadTokenResult.newBuilder(); if (MediaServerConfig.USER_QINIU) { Auth auth = Auth.create(MediaServerConfig.QINIU_ACCESS_KEY, MediaServerConfig.QINIU_SECRET_KEY); String bucketName; String bucketDomain; switch (type) { case 0: bucketName = MediaServerConfig.QINIU_BUCKET_GENERAL_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_GENERAL_DOMAIN; break; case 1: bucketName = MediaServerConfig.QINIU_BUCKET_IMAGE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_IMAGE_DOMAIN; break; case 2: bucketName = MediaServerConfig.QINIU_BUCKET_VOICE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_VOICE_DOMAIN; break; case 3: bucketName = MediaServerConfig.QINIU_BUCKET_VIDEO_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_VIDEO_DOMAIN; break; case 4: bucketName = MediaServerConfig.QINIU_BUCKET_FILE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_FILE_DOMAIN; break; case 5: bucketName = MediaServerConfig.QINIU_BUCKET_PORTRAIT_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_PORTRAIT_DOMAIN; break; case 6: bucketName = MediaServerConfig.QINIU_BUCKET_FAVORITE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_FAVORITE_DOMAIN; break; case 7: bucketName = MediaServerConfig.QINIU_BUCKET_STICKER_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_STICKER_DOMAIN; break; case 8: bucketName = MediaServerConfig.QINIU_BUCKET_MOMENTS_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_MOMENTS_DOMAIN; break; case 9: bucketName = MediaServerConfig.QINIU_BUCKET_CUSTOM1_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_CUSTOM1_DOMAIN; break; case 10: bucketName = MediaServerConfig.QINIU_BUCKET_CUSTOM2_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_CUSTOM2_DOMAIN; break; case 11: bucketName = MediaServerConfig.QINIU_BUCKET_CUSTOM3_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_CUSTOM3_DOMAIN; break; case 12: bucketName = MediaServerConfig.QINIU_BUCKET_PAN_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_PAN_DOMAIN; break; default: bucketName = MediaServerConfig.QINIU_BUCKET_GENERAL_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_GENERAL_DOMAIN; break; } token = auth.uploadToken(bucketName); resultBuilder.setDomain(bucketDomain) .setServer(MediaServerConfig.QINIU_SERVER_URL); resultBuilder.setPort(80); } else { token = UploadFileAction.getToken(type); if(StringUtil.isNullOrEmpty(MediaServerConfig.FILE_STROAGE_REMOTE_SERVER_URL)) { resultBuilder.setDomain("http://" + MediaServerConfig.SERVER_IP + ":" + MediaServerConfig.HTTP_SERVER_PORT); } else { resultBuilder.setDomain(MediaServerConfig.FILE_STROAGE_REMOTE_SERVER_URL); } resultBuilder.setServer(MediaServerConfig.SERVER_IP); resultBuilder.setPort(MediaServerConfig.HTTP_SERVER_PORT); } resultBuilder.setToken(token); byte[] data = resultBuilder.buildPartial().toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetMyGroupsHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; import java.util.Set; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.GetMyGroupsTopic) public class GetMyGroupsHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, Void request, Qos1PublishHandler.IMCallback callback) { WFCMessage.PullUserResult.Builder resultBuilder = WFCMessage.PullUserResult.newBuilder(); Set strings = m_messagesStore.getUserGroupIds(fromUser); WFCMessage.IDListBuf idListBuf = WFCMessage.IDListBuf.newBuilder().addAllId(strings).build(); byte[] data = idListBuf.toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); return ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetQiniuUploadTokenHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.qiniu.util.Auth; import com.xiaoleilu.loServer.action.UploadFileAction; import io.moquette.server.config.MediaServerConfig; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Handler(IMTopic.GetQiniuUploadTokenTopic) public class GetQiniuUploadTokenHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, Byte request, Qos1PublishHandler.IMCallback callback) { int type = request; String token; WFCMessage.GetUploadTokenResult.Builder resultBuilder = WFCMessage.GetUploadTokenResult.newBuilder(); if (MediaServerConfig.USER_QINIU) { Auth auth = Auth.create(MediaServerConfig.QINIU_ACCESS_KEY, MediaServerConfig.QINIU_SECRET_KEY); //#Media_Type_GENERAL = 0, //#Media_Type_IMAGE = 1, //#Media_Type_VOICE = 2, //#Media_Type_VIDEO = 3, //#Media_Type_FILE = 4, //#Media_Type_PORTRAIT = 5, //#Media_Type_FAVORITE = 6 String bucketName; String bucketDomain; switch (type) { case 0: bucketName = MediaServerConfig.QINIU_BUCKET_GENERAL_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_GENERAL_DOMAIN; break; case 1: bucketName = MediaServerConfig.QINIU_BUCKET_IMAGE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_IMAGE_DOMAIN; break; case 2: bucketName = MediaServerConfig.QINIU_BUCKET_VOICE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_VOICE_DOMAIN; break; case 3: bucketName = MediaServerConfig.QINIU_BUCKET_VIDEO_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_VIDEO_DOMAIN; break; case 4: bucketName = MediaServerConfig.QINIU_BUCKET_FILE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_FILE_DOMAIN; break; case 5: bucketName = MediaServerConfig.QINIU_BUCKET_PORTRAIT_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_PORTRAIT_DOMAIN; break; case 6: bucketName = MediaServerConfig.QINIU_BUCKET_FAVORITE_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_FAVORITE_DOMAIN; break; case 7: bucketName = MediaServerConfig.QINIU_BUCKET_STICKER_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_STICKER_DOMAIN; break; case 8: bucketName = MediaServerConfig.QINIU_BUCKET_MOMENTS_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_MOMENTS_DOMAIN; break; case 9: bucketName = MediaServerConfig.QINIU_BUCKET_CUSTOM1_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_CUSTOM1_DOMAIN; break; case 10: bucketName = MediaServerConfig.QINIU_BUCKET_CUSTOM2_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_CUSTOM2_DOMAIN; break; case 11: bucketName = MediaServerConfig.QINIU_BUCKET_CUSTOM3_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_CUSTOM3_DOMAIN; break; case 12: bucketName = MediaServerConfig.QINIU_BUCKET_PAN_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_PAN_DOMAIN; break; default: bucketName = MediaServerConfig.QINIU_BUCKET_GENERAL_NAME; bucketDomain = MediaServerConfig.QINIU_BUCKET_GENERAL_DOMAIN; break; } token = auth.uploadToken(bucketName); resultBuilder.setDomain(bucketDomain) .setServer(MediaServerConfig.QINIU_SERVER_URL); resultBuilder.setPort(80); } else { token = UploadFileAction.getToken(type); resultBuilder.setDomain("http://" + MediaServerConfig.SERVER_IP + ":" + MediaServerConfig.HTTP_SERVER_PORT) .setServer(MediaServerConfig.SERVER_IP); resultBuilder.setPort(MediaServerConfig.HTTP_SERVER_PORT); } resultBuilder.setToken(token); byte[] data = resultBuilder.buildPartial().toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetTokenHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.persistence.MemorySessionStore; import io.moquette.spi.impl.Qos1PublishHandler; import io.moquette.spi.impl.security.TokenAuthenticator; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import win.liyufan.im.UserSettingScope; @Handler(IMTopic.GetTokenTopic) public class GetTokenHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.GetTokenRequest request, Qos1PublishHandler.IMCallback callback) { MemorySessionStore.Session session = m_sessionsStore.updateOrCreateUserSession(fromUser, clientID, request.getPlatform()); WFCMessage.User userInfo = m_messagesStore.getUserInfo(fromUser); if(userInfo != null && userInfo.getType() == 1) { return ErrorCode.ERROR_CODE_ROBOT_NO_TOKEN; } if(session.isPcClient() || session.isPadClient() || session.isTVClient()) { if(m_messagesStore.isLocked(session.getUsername(), session.getClientID())) { m_messagesStore.updateUserSettings(session.getUsername(), WFCMessage.ModifyUserSettingReq.newBuilder().setScope(UserSettingScope.UserSettingScopeLockPC).setKey(session.getClientID()).setValue("0").build(), null); } } TokenAuthenticator authenticator = new TokenAuthenticator(); String strToken = authenticator.generateToken(fromUser); String result = strToken + "|" + session.getSecret() + "|" + session.getDbSecret(); byte[] data = result.getBytes(); ackPayload.ensureWritable(data.length).writeBytes(data); return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetUserInfoHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.GetUserInfoTopic) public class GetUserInfoHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.PullUserRequest request, Qos1PublishHandler.IMCallback callback) { WFCMessage.PullUserResult.Builder resultBuilder = WFCMessage.PullUserResult.newBuilder(); ErrorCode errorCode = m_messagesStore.getUserInfo(fromUser, request.getRequestList(), resultBuilder); if (errorCode == ERROR_CODE_SUCCESS) { byte[] data = resultBuilder.build().toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GetUserSettingHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.GetUserSettingTopic) public class GetUserSettingHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.Version request, Qos1PublishHandler.IMCallback callback) { WFCMessage.GetUserSettingResult.Builder builder = WFCMessage.GetUserSettingResult.newBuilder(); ErrorCode errorCode = m_messagesStore.getUserSettings(fromUser, request.getVersion(), builder); if (errorCode == ERROR_CODE_SUCCESS) { byte[] data = builder.build().toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/GroupHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import win.liyufan.im.MessageShardingUtil; import java.util.ArrayList; import java.util.Collection; import java.util.List; abstract public class GroupHandler extends IMHandler { protected void sendGroupNotification(String fromUser, String targetId, List lines, WFCMessage.MessageContent content) { sendGroupNotification(fromUser, targetId, lines, content, null); } protected void sendGroupNotification(String fromUser, String targetId, List lines, WFCMessage.MessageContent content, Collection toUsers) { if (lines == null) { lines = new ArrayList<>(); } else { lines = new ArrayList<>(lines); } if (lines.isEmpty()) { lines.add(0); } for (int line : lines) { long timestamp = System.currentTimeMillis(); WFCMessage.Message.Builder builder = WFCMessage.Message.newBuilder().setContent(content).setServerTimestamp(timestamp); builder.setConversation(builder.getConversationBuilder().setType(ProtoConstants.ConversationType.ConversationType_Group).setTarget(targetId).setLine(line)); builder.setFromUser(fromUser); if(toUsers != null && !toUsers.isEmpty()) { builder.addAllTo(toUsers); } try { long messageId = MessageShardingUtil.generateId(); builder.setMessageId(messageId); saveAndPublish(fromUser, null, builder.build(), ProtoConstants.RequestSourceType.Request_From_User); } catch (Exception e) { e.printStackTrace(); } } } protected List getMemberIdList(List groupMembers) { List out = new ArrayList<>(); if (groupMembers != null) { for (WFCMessage.GroupMember gm : groupMembers ) { out.add(gm.getMemberId()); } } return out; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/HandleFriendRequestHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import io.netty.util.internal.StringUtil; import win.liyufan.im.IMTopic; import win.liyufan.im.MessageShardingUtil; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_ALREADY_FRIENDS; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.HandleFriendRequestTopic) public class HandleFriendRequestHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.HandleFriendRequest request, Qos1PublishHandler.IMCallback callback) { WFCMessage.Message.Builder builder = WFCMessage.Message.newBuilder(); builder.setFromUser(request.getTargetUid()); long[] heads = new long[4]; boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; ErrorCode errorCode = m_messagesStore.handleFriendRequest(fromUser, request, builder, heads, isAdmin); if (errorCode == ERROR_CODE_SUCCESS) { if (!isAdmin && builder.getConversation() != null && request.getStatus() == ProtoConstants.FriendRequestStatus.RequestStatus_Accepted) { try { long messageId = MessageShardingUtil.generateId(); long timestamp = System.currentTimeMillis(); builder.setMessageId(messageId); builder.setServerTimestamp(timestamp); if(!StringUtil.isNullOrEmpty(builder.getContent().getSearchableContent())) { saveAndPublish(request.getTargetUid(), null, builder.build(), requestSourceType); } WFCMessage.MessageContent.Builder contentBuilder = WFCMessage.MessageContent.newBuilder(); contentBuilder.setType(92); builder = WFCMessage.Message.newBuilder(); builder.setFromUser(fromUser); builder.setConversation(WFCMessage.Conversation.newBuilder().setTarget(request.getTargetUid()).setLine(0).setType(ProtoConstants.ConversationType.ConversationType_Private).build()); builder.setContent(contentBuilder); builder.setServerTimestamp(++timestamp); messageId = MessageShardingUtil.generateId(); builder.setMessageId(messageId); saveAndPublish(fromUser, null, builder.build(), requestSourceType); contentBuilder.setType(93); builder.setContent(contentBuilder); messageId = MessageShardingUtil.generateId(); builder.setMessageId(messageId); builder.setServerTimestamp(++timestamp); saveAndPublish(fromUser, null, builder.build(), requestSourceType); } catch (Exception e) { e.printStackTrace(); } } if (request.getStatus() == ProtoConstants.FriendRequestStatus.RequestStatus_Accepted || isAdmin) { publisher.publishNotification(IMTopic.NotifyFriendTopic, request.getTargetUid(), heads[0]); publisher.publishNotification(IMTopic.NotifyFriendTopic, fromUser, heads[1]); } if(!isAdmin) { if(heads[2] > 0) { publisher.publishNotification(IMTopic.NotifyFriendRequestTopic, request.getTargetUid(), heads[2], fromUser, null); } if(heads[3] > 0) { publisher.publishNotification(IMTopic.NotifyFriendRequestTopic, fromUser, heads[3], fromUser, null); } } } if(errorCode == ERROR_CODE_ALREADY_FRIENDS) { errorCode = ERROR_CODE_SUCCESS; } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/Handler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import java.lang.annotation.Inherited; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * 注解,用于自定义访问的URL路径
* 值可以是一个请求路径,如果需要指定HTTP方法,在前面加方法名用":"分隔既可
* @author loolly * */ @Retention(RetentionPolicy.RUNTIME)/*保留的时间长短*/ @Inherited/*只用于class,可被子类继承*/ public @interface Handler { String value(); } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/IMHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.server.ThreadPoolExecutorWrapper; import com.google.gson.Gson; import com.google.protobuf.GeneratedMessage; import com.google.protobuf.InvalidProtocolBufferException; import io.moquette.server.Server; import io.moquette.spi.IMessagesStore; import io.moquette.spi.ISessionsStore; import io.moquette.spi.impl.MessagesPublisher; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.util.internal.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.GsonUtil; import win.liyufan.im.RateLimiter; import win.liyufan.im.Utility; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.util.*; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_OVER_FREQUENCY; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; import static io.moquette.BrokerConstants.CLIENT_REQUEST_RATE_LIMIT; import static win.liyufan.im.IMTopic.GetUserSettingTopic; import static win.liyufan.im.IMTopic.PullMessageTopic; /** * 请求处理接口
* 当用户请求某个Topic,则调用相应Handler的handle方法 * */ abstract public class IMHandler { protected static final Logger LOG = LoggerFactory.getLogger(IMHandler.class); protected static IMessagesStore m_messagesStore = null; protected static ISessionsStore m_sessionsStore = null; protected static Server mServer = null; protected static MessagesPublisher publisher; private static ThreadPoolExecutorWrapper m_imBusinessExecutor; private static RateLimiter mLimitCounter; private Method parseDataMethod; private Class dataCls; @Retention(RetentionPolicy.RUNTIME) public @interface ActionMethod { } protected static String actionName; public static MessagesPublisher getPublisher() { return publisher; } public IMHandler() { try { if (StringUtil.isNullOrEmpty(actionName)) { Class cls = getClass(); while (cls.getSuperclass() != null) { for (Method method : cls.getSuperclass().getDeclaredMethods()) { if (method.getAnnotation(ActionMethod.class) != null) { actionName = method.getName(); break; } } if (StringUtil.isNullOrEmpty(actionName)) { cls = cls.getSuperclass(); } else { break; } } } Type t = getClass().getGenericSuperclass(); ParameterizedType p = (ParameterizedType) t ; Class c = (Class) p.getActualTypeArguments()[0]; dataCls = c; if (dataCls.getSuperclass().equals(GeneratedMessage.class)) { parseDataMethod = dataCls.getMethod("parseFrom", byte[].class); } else if (dataCls.isPrimitive()) { } else { } } catch (NoSuchMethodException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } private T getDataObject(byte[] bytes) throws IllegalAccessException, InvocationTargetException { if (parseDataMethod != null) { T object = (T) parseDataMethod.invoke(dataCls, bytes); return object; } if (dataCls == String.class) { String str = new String(bytes); return (T)str; } if (dataCls == Byte.class) { Byte b = bytes[0]; return (T)b; } if (dataCls == Void.class) { return null; } //目前还没有需求传int的参数,这里先注释掉 //在需要使用时,需要注意大小端的问题。 //这里使用的示例代码是小端的,注意一定要与协议中保持一直!!! // if (dataCls == Integer.class) { // int i = bytes[0]; // for(int index = 0; index <8; index++) { // i <<= 1; // i += bytes[index]; // } // Integer object = i; // return (T)object; // } //json ? return (T)(GsonUtil.gson.fromJson(new String(bytes), dataCls)); } public static void init(IMessagesStore ms, ISessionsStore ss, MessagesPublisher p, ThreadPoolExecutorWrapper businessExecutor, Server server) { m_messagesStore = ms; m_sessionsStore = ss; publisher = p; m_imBusinessExecutor = businessExecutor; mServer = server; int clientRateLimit = 100; try { clientRateLimit = Integer.parseInt(server.getConfig().getProperty(CLIENT_REQUEST_RATE_LIMIT, "100")); } catch (Exception e) { } if(clientRateLimit == 0) { clientRateLimit = 100; } mLimitCounter = new RateLimiter(5, clientRateLimit); } boolean isNotLimitTopic(String topic) { if (PullMessageTopic.equals(topic) || GetUserSettingTopic.equals(topic)) { return true; } return false; } public ErrorCode preAction(String clientID, String fromUser, String topic, Qos1PublishHandler.IMCallback callback, ProtoConstants.RequestSourceType requestSourceType) { LOG.info("imHandler fromUser={}, clientId={}, topic={}", fromUser, clientID, topic); if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !isNotLimitTopic(topic) && !mLimitCounter.isGranted(clientID + fromUser + topic)) { return ErrorCode.ERROR_CODE_OVER_FREQUENCY; } return ErrorCode.ERROR_CODE_SUCCESS; } public void doHandler(String clientID, String fromUser, String topic, byte[] payloadContent, Qos1PublishHandler.IMCallback callback, ProtoConstants.RequestSourceType requestSourceType) { m_imBusinessExecutor.execute(() -> { Qos1PublishHandler.IMCallback callbackWrapper = new Qos1PublishHandler.IMCallback() { @Override public void onIMHandled(ErrorCode errorCode, ByteBuf ackPayload) { LOG.debug("execute handler {} with result {}", this.getClass().getName(), errorCode); callback.onIMHandled(errorCode, ackPayload); afterAction(clientID, fromUser, topic, callback); } }; ErrorCode preActionCode = preAction(clientID, fromUser, topic, callbackWrapper, requestSourceType); if (preActionCode == ErrorCode.ERROR_CODE_SUCCESS) { ByteBuf ackPayload = Unpooled.buffer(1); ErrorCode errorCode = ERROR_CODE_SUCCESS; ackPayload.ensureWritable(1).writeByte(errorCode.getCode()); try { LOG.debug("execute handler for topic {}", topic); errorCode = action(ackPayload, clientID, fromUser, requestSourceType, getDataObject(payloadContent), callbackWrapper); } catch (IllegalAccessException e) { e.printStackTrace(); Utility.printExecption(LOG, e); errorCode = ErrorCode.ERROR_CODE_INVALID_DATA; } catch (InvocationTargetException e) { e.printStackTrace(); Utility.printExecption(LOG, e); errorCode = ErrorCode.ERROR_CODE_INVALID_DATA; } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); if (e instanceof InvalidProtocolBufferException) { errorCode = ErrorCode.ERROR_CODE_INVALID_DATA; } else { errorCode = ErrorCode.ERROR_CODE_SERVER_ERROR; } } if(errorCode != ErrorCode.INVALID_ASYNC_HANDLING) { response(ackPayload, errorCode, callback); } } else { LOG.error("Handler {} preAction failure", this.getClass().getName()); ByteBuf ackPayload = Unpooled.buffer(1); ackPayload.ensureWritable(1).writeByte(preActionCode.getCode()); response(ackPayload, preActionCode, callback); } }); } private void response(ByteBuf ackPayload, ErrorCode errorCode, Qos1PublishHandler.IMCallback callback) { ackPayload.setByte(0, errorCode.getCode()); try { callback.onIMHandled(errorCode, ackPayload); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } @ActionMethod abstract public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, T request, Qos1PublishHandler.IMCallback callback) ; public void afterAction(String clientID, String fromUser, String topic, Qos1PublishHandler.IMCallback callback) { } protected long publish(String username, String clientID, WFCMessage.Message message, ProtoConstants.RequestSourceType requestSourceType) { Set notifyReceivers = new LinkedHashSet<>(); WFCMessage.Message.Builder messageBuilder = message.toBuilder(); int pullType = m_messagesStore.getNotifyReceivers(username, messageBuilder, notifyReceivers, requestSourceType); mServer.getImBusinessScheduler().execute(() -> this.publisher.publish2Receivers(messageBuilder.build(), notifyReceivers, clientID, pullType)); return notifyReceivers.size(); } protected long saveAndPublish(String username, String clientID, WFCMessage.Message message, ProtoConstants.RequestSourceType requestSourceType) { Set notifyReceivers = new LinkedHashSet<>(); message = m_messagesStore.storeMessage(username, clientID, message); WFCMessage.Message.Builder messageBuilder = message.toBuilder(); int pullType = m_messagesStore.getNotifyReceivers(username, messageBuilder, notifyReceivers, requestSourceType); mServer.getImBusinessScheduler().execute(() -> this.publisher.publish2Receivers(messageBuilder.build(), notifyReceivers, clientID, pullType)); return notifyReceivers.size(); } protected long saveAndBroadcast(String username, String clientID, WFCMessage.Message message) { Set notifyReceivers = m_messagesStore.getAllEnds(); WFCMessage.Message updatedMessage = m_messagesStore.storeMessage(username, clientID, message); mServer.getImBusinessScheduler().execute(() -> publisher.publish2Receivers(updatedMessage, notifyReceivers, clientID, ProtoConstants.PullType.Pull_Normal)); return notifyReceivers.size(); } protected long saveAndMulticast(String username, String clientID, WFCMessage.Message message, Collection targets) { Set notifyReceivers = new HashSet<>(); notifyReceivers.addAll(targets); WFCMessage.Message updatedMessage = m_messagesStore.storeMessage(username, clientID, message); mServer.getImBusinessScheduler().execute(() -> publisher.publish2Receivers(updatedMessage, notifyReceivers, clientID, ProtoConstants.PullType.Pull_Normal)); return notifyReceivers.size(); } protected long publishRecallMultiCastMsg(long messageUid, List receivers) { WFCMessage.Message updatedMessage = m_messagesStore.getMessage(messageUid); Set notifyReceivers = new HashSet<>(receivers); LOG.info("Multicast recall receiver count: {}", notifyReceivers.size()); mServer.getImBusinessScheduler().execute(() -> publisher.publish2Receivers(updatedMessage, notifyReceivers, null, ProtoConstants.PullType.Pull_Normal)); return notifyReceivers.size(); } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/JoinChatroomHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Handler(IMTopic.JoinChatroomTopic) public class JoinChatroomHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.IDBuf request, Qos1PublishHandler.IMCallback callback) { return m_messagesStore.handleJoinChatroom(fromUser, clientID, request.getId()); } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/KickoffGroupMember.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.pojos.GroupNotificationBinaryContent; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import java.util.Set; import static win.liyufan.im.IMTopic.KickoffGroupMemberTopic; @Handler(value = KickoffGroupMemberTopic) public class KickoffGroupMember extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.RemoveGroupMemberRequest request, Qos1PublishHandler.IMCallback callback) { ErrorCode errorCode; WFCMessage.GroupInfo groupInfo = m_messagesStore.getGroupInfo(request.getGroupId()); if (groupInfo == null) { errorCode = ErrorCode.ERROR_CODE_NOT_EXIST; } else { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if (!isAdmin && groupInfo.getType() == ProtoConstants.GroupType.GroupType_Organization) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } boolean isAllow = isAdmin; if (!isAllow) { if (groupInfo.getOwner() != null) { if (request.getRemovedMemberList().contains(groupInfo.getOwner())) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } if (groupInfo.getOwner() != null && groupInfo.getOwner().equals(fromUser)) { isAllow = true; } } if (!isAllow) { WFCMessage.GroupMember gm = m_messagesStore.getGroupMember(request.getGroupId(), fromUser); if (gm != null && gm.getType() == ProtoConstants.GroupMemberType.GroupMemberType_Manager) { isAllow = true; } } if (!isAllow && (groupInfo.getType() == ProtoConstants.GroupType.GroupType_Normal || groupInfo.getType() == ProtoConstants.GroupType.GroupType_Restricted)) { errorCode = ErrorCode.ERROR_CODE_NOT_RIGHT; } else { if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !m_messagesStore.isAllowClientCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_Robot && !m_messagesStore.isAllowRobotCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) { int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation(); if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Kickoff_Group_Member) > 0) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } //send notify message first, then kickoff the member if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) { sendGroupNotification(fromUser, groupInfo.getTargetId(), request.getToLineList(), request.getNotifyContent()); } else { WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, null, request.getRemovedMemberList()).getKickokfMemberGroupNotifyContent(); sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content); } if((m_messagesStore.getVisibleQuitKickoffNotification() & 0x02) > 0) { Set toUsers = m_messagesStore.getGroupManagers(request.getGroupId(), true); toUsers.addAll(request.getRemovedMemberList()); WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, null, request.getRemovedMemberList()).getKickokfMemberVisibleGroupNotifyContent(); sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content, toUsers); } errorCode = m_messagesStore.kickoffGroupMembers(fromUser, isAdmin, request.getGroupId(), request.getRemovedMemberList()); } } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/KickoffPCClientHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.GroupNotificationBinaryContent; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.util.StringUtil; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import static win.liyufan.im.IMTopic.KickoffGroupMemberTopic; import static win.liyufan.im.IMTopic.KickoffPCClientTopic; @Handler(value = KickoffPCClientTopic) public class KickoffPCClientHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.IDBuf request, Qos1PublishHandler.IMCallback callback) { String pcClientId = request.getId(); if (StringUtil.isNullOrEmpty(pcClientId)) { return ErrorCode.INVALID_PARAMETER; } return m_sessionsStore.kickoffPCClient(fromUser, pcClientId); } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/LoadRemoteMessagesHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Handler(value = IMTopic.LoadRemoteMessagesTopic) public class LoadRemoteMessagesHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.LoadRemoteMessages request, Qos1PublishHandler.IMCallback callback) { ErrorCode errorCode = ErrorCode.ERROR_CODE_SUCCESS; long beforeUid = request.getBeforeUid(); if (beforeUid == 0) { beforeUid = Long.MAX_VALUE; } if (request.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Group) { if (!m_messagesStore.isMemberInGroup(fromUser, request.getConversation().getTarget())) { return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } } if (request.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Channel) { if (!m_messagesStore.canSendMessageInChannel(fromUser, request.getConversation().getTarget())) { return ErrorCode.ERROR_CODE_NOT_IN_CHANNEL; } } WFCMessage.PullMessageResult result = m_messagesStore.loadRemoteMessages(fromUser, request.getConversation(), beforeUid, request.getCount(), request.getContentTypeList()); byte[] data = result.toByteArray(); LOG.info("User {} load message with count({}), payload size({})", fromUser, result.getMessageCount(), data.length); ackPayload.ensureWritable(data.length).writeBytes(data); return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/ModifyChannelInfoHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import static win.liyufan.im.IMTopic.ModifyChannelInfoTopic; @Handler(value = ModifyChannelInfoTopic) public class ModifyChannelInfoHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.ModifyChannelInfo request, Qos1PublishHandler.IMCallback callback) { ErrorCode errorCode= m_messagesStore.modifyChannelInfo(fromUser, request.getChannelId(), request.getType(), request.getValue()); return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/ModifyGroupAliasHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.pojos.GroupNotificationBinaryContent; import com.hazelcast.util.StringUtil; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import java.util.Set; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.ModifyGroupAliasTopic) public class ModifyGroupAliasHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.ModifyGroupMemberAlias request, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !m_messagesStore.isAllowClientCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_Robot && !m_messagesStore.isAllowRobotCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if (!isAdmin && !StringUtil.isNullOrEmpty(request.getAlias())) { if(!m_messagesStore.isSensitiveOnlyMessage()) { Set matched = m_messagesStore.handleSensitiveWord(request.getAlias()); if (matched != null && !matched.isEmpty()) { return ErrorCode.ERROR_CODE_SENSITIVE_MATCHED; } } if(!m_messagesStore.isAllowName(request.getAlias())) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } ErrorCode errorCode = m_messagesStore.modifyGroupMemberAlias(fromUser, request.getGroupId(), request.getAlias(), null, isAdmin); if (errorCode == ERROR_CODE_SUCCESS) { if (request.hasNotifyContent()&& request.getNotifyContent().getType() > 0) { sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), request.getNotifyContent()); } else { WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getAlias(), "").getModifyGroupMemberAliasNotifyContent(); sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content); } } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/ModifyGroupInfoHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.pojos.GroupNotificationBinaryContent; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; import static cn.wildfirechat.proto.ProtoConstants.ModifyGroupInfoType.*; import static win.liyufan.im.IMTopic.ModifyGroupInfoTopic; @Handler(value = ModifyGroupInfoTopic) public class ModifyGroupInfoHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.ModifyGroupInfoRequest request, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !m_messagesStore.isAllowClientCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_Robot && !m_messagesStore.isAllowRobotCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) { int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation(); if(request.getType() == Modify_Group_Mute) { if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Mute_Group) > 0) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } else { if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Modify_Group_Info) > 0) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } } ErrorCode errorCode= m_messagesStore.modifyGroupInfo(fromUser, request.getGroupId(), request.getType(), request.getValue(), isAdmin); if (errorCode == ERROR_CODE_SUCCESS) { if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0) { sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), request.getNotifyContent()); } else { WFCMessage.MessageContent content = null; if (request.getType() == Modify_Group_Name) { content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getValue(), "").getChangeGroupNameNotifyContent(); } else if(request.getType() == Modify_Group_Portrait) { content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getValue(), "").getChangeGroupPortraitNotifyContent(); } else if(request.getType() == Modify_Group_Mute) { content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getValue(), "").getChangeGroupMuteNotifyContent(); } else if(request.getType() == Modify_Group_JoinType) { content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getValue(), "").getChangeGroupJointypeNotifyContent(); } else if(request.getType() == Modify_Group_PrivateChat) { content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getValue(), "").getChangeGroupPrivatechatNotifyContent(); } else if(request.getType() == Modify_Group_Searchable) { content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getValue(), "").getChangeGroupSearchableNotifyContent(); } else if(request.getType() == Modify_Group_Extra) { content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getValue(), "").getChangeGroupExtraNotifyContent(); } if (content != null) { sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content); } } } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/ModifyGroupMemberAliasHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.GroupNotificationBinaryContent; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.util.StringUtil; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; import java.util.Set; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.ModifyGroupMemberAliasTopic) public class ModifyGroupMemberAliasHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.ModifyGroupMemberAlias request, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !m_messagesStore.isAllowClientCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_Robot && !m_messagesStore.isAllowRobotCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if (!isAdmin && !StringUtil.isNullOrEmpty(request.getAlias())) { if(!m_messagesStore.isSensitiveOnlyMessage()) { Set matched = m_messagesStore.handleSensitiveWord(request.getAlias()); if (matched != null && !matched.isEmpty()) { return ErrorCode.ERROR_CODE_SENSITIVE_MATCHED; } } if(!m_messagesStore.isAllowName(request.getAlias())) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } ErrorCode errorCode = m_messagesStore.modifyGroupMemberAlias(fromUser, request.getGroupId(), request.getAlias(), request.getMemberId(), isAdmin); if (errorCode == ERROR_CODE_SUCCESS) { if (request.hasNotifyContent()&& request.getNotifyContent().getType() > 0) { sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), request.getNotifyContent()); } else { WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getAlias(), request.getMemberId()).getModifyGroupMemberAliasNotifyContent(); sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content); } } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/ModifyGroupMemberExtraHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.GroupNotificationBinaryContent; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.ModifyGroupMemberExtraTopic) public class ModifyGroupMemberExtraHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.ModifyGroupMemberExtra request, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !m_messagesStore.isAllowClientCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_Robot && !m_messagesStore.isAllowRobotCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } ErrorCode errorCode = m_messagesStore.modifyGroupMemberExtra(fromUser, request.getGroupId(), request.getExtra(), request.getMemberId(), isAdmin); if (errorCode == ERROR_CODE_SUCCESS) { if (request.hasNotifyContent()&& request.getNotifyContent().getType() > 0) { sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), request.getNotifyContent()); } else { WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getExtra(), request.getMemberId()).getModifyGroupMemberExtraNotifyContent(); sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content); } } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/ModifyMyInfoHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import win.liyufan.im.Utility; @Handler(IMTopic.ModifyMyInfoTopic) public class ModifyMyInfoHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.ModifyMyInfoRequest request, Qos1PublishHandler.IMCallback callback) { try { return m_messagesStore.modifyUserInfo(fromUser, request); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); return ErrorCode.ERROR_CODE_SERVER_ERROR; } } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/MultiCastMessageHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.util.StringUtil; import io.moquette.BrokerConstants; import io.moquette.server.Server; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; import win.liyufan.im.MessageShardingUtil; import java.util.Set; import static cn.wildfirechat.proto.ProtoConstants.ContentType.Text; import static cn.wildfirechat.proto.ProtoConstants.ConversationType.ConversationType_Private; @Handler(value = IMTopic.MultiCastMessageTopic) public class MultiCastMessageHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.MultiCastMessage multiCastMessage, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; ErrorCode errorCode = ErrorCode.ERROR_CODE_SUCCESS; if (!isAdmin) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } long timestamp = System.currentTimeMillis(); long messageId = 0; try { messageId = MessageShardingUtil.generateId(); } catch (Exception e) { e.printStackTrace(); return ErrorCode.ERROR_CODE_SERVER_ERROR; } WFCMessage.Message message = WFCMessage.Message.newBuilder() .setContent(multiCastMessage.getContent()) .setConversation(WFCMessage.Conversation.newBuilder().setTarget(fromUser).setType(ConversationType_Private).setLine(multiCastMessage.getLine()).build()) .setFromUser(fromUser) .setMessageId(messageId) .setServerTimestamp(timestamp) .build(); saveAndMulticast(fromUser, clientID, message, multiCastMessage.getToList()); ackPayload = ackPayload.capacity(20); ackPayload.writeLong(messageId); ackPayload.writeLong(timestamp); return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/PullMessageHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Handler(value = IMTopic.PullMessageTopic) public class PullMessageHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.PullMessageRequest request, Qos1PublishHandler.IMCallback callback) { ErrorCode errorCode = ErrorCode.ERROR_CODE_SUCCESS; if (request.getType() == ProtoConstants.PullType.Pull_ChatRoom && !m_messagesStore.checkUserClientInChatroom(fromUser, clientID, null)) { errorCode = ErrorCode.ERROR_CODE_NOT_IN_CHATROOM; } else { WFCMessage.PullMessageResult result = m_messagesStore.fetchMessage(fromUser, clientID, request.getId(), request.getType()); byte[] data = result.toByteArray(); LOG.info("User {} pull message with count({}), payload size({})", fromUser, result.getMessageCount(), data.length); ackPayload.ensureWritable(data.length).writeBytes(data); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/PutUserSettingHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Handler(IMTopic.PutUserSettingTopic) public class PutUserSettingHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.ModifyUserSettingReq request, Qos1PublishHandler.IMCallback callback) { m_messagesStore.updateUserSettings(fromUser, request, clientID); return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/QuitChatroomHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Handler(IMTopic.QuitChatroomTopic) public class QuitChatroomHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.IDBuf request, Qos1PublishHandler.IMCallback callback) { m_messagesStore.handleQuitChatroom(fromUser, clientID, request.getId()); return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/QuitGroupHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.pojos.GroupNotificationBinaryContent; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import java.util.Set; import static win.liyufan.im.IMTopic.QuitGroupTopic; @Handler(value = QuitGroupTopic) public class QuitGroupHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.QuitGroupRequest request, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !m_messagesStore.isAllowClientCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_Robot && !m_messagesStore.isAllowRobotCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) { int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation(); if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Quit_Group) > 0) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } ErrorCode errorCode = m_messagesStore.quitGroup(fromUser, request.getGroupId(), isAdmin); if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) { sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), request.getNotifyContent()); } else { WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getKeepMsg()>0?"1":"0", "").getQuitGroupNotifyContent(); sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content); } if((m_messagesStore.getVisibleQuitKickoffNotification() & 0x01) > 0) { Set toUsers = m_messagesStore.getGroupManagers(request.getGroupId(), true); WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getKeepMsg()>0?"1":"0", "").getQuitVisibleGroupNotifyContent(); sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content, toUsers); } } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/RecallMessageHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import java.util.LinkedHashSet; import java.util.Set; @Handler(value = IMTopic.RecallMessageTopic) public class RecallMessageHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.INT64Buf int64Buf, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; ErrorCode errorCode = m_messagesStore.recallMessage(int64Buf.getId(), fromUser, clientID, isAdmin, ackPayload); if(errorCode != ErrorCode.ERROR_CODE_SUCCESS) { return errorCode; } WFCMessage.Message message = m_messagesStore.getMessage(int64Buf.getId()); if (message == null) { return ErrorCode.ERROR_CODE_NOT_EXIST; } publish(message.getFromUser(), clientID, message, requestSourceType); return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/RecallMultiCastMessageHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; @Handler(value = IMTopic.RecallMultiCastMessageTopic) public class RecallMultiCastMessageHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.RecallMultiCastMessageRequest request, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if (!isAdmin) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } ErrorCode errorCode = m_messagesStore.recallCastMessage(request.getMessageId(), fromUser); if(errorCode != ErrorCode.ERROR_CODE_SUCCESS) { return errorCode; } publishRecallMultiCastMsg(request.getMessageId(), request.getReceiverList()); return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/ReplyMessageHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.util.StringUtil; import io.moquette.BrokerConstants; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import win.liyufan.im.*; import java.util.Collection; import java.util.HashSet; import java.util.Set; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_NOT_IN_GROUP; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(value = IMTopic.RobotReplyMessageTopic) public class ReplyMessageHandler extends IMHandler { private int mSensitiveType = 0; //命中敏感词时,0 失败,1 吞掉, 2 敏感词替换成*。 private String mForwardUrl = null; private String mSensitiveMessageForwardUrl = null; private Set mForwardMessageTypes = new HashSet<>(); private Set mForwardExcludeMessageTypes = new HashSet<>(); private String mMentionForwardUrl = null; private int mBlacklistStrategy = 0; //黑名单中时,0失败,1吞掉。 private boolean mBlacklistAllowSend2Black = true; private boolean mNoForwardAdminMessage = false; private boolean mAllowSend2ForbiddenUser = false; private String mRemoteSensitiveServerUrl = null; private Set mRemoteSensitiveMessageTypes; private boolean mWaitRemoteSensitiveServerResponse = false; public ReplyMessageHandler() { super(); mForwardUrl = mServer.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_Url); if (!StringUtil.isNullOrEmpty(mForwardUrl)) { String forwardTypes = mServer.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_Types); parseTypes(mForwardMessageTypes, forwardTypes); String excludeTypes = mServer.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_Exclude_Types); parseTypes(mForwardExcludeMessageTypes, excludeTypes); } mSensitiveMessageForwardUrl = mServer.getConfig().getProperty(BrokerConstants.MESSAGE_Sensitive_Forward_Url); mMentionForwardUrl = mServer.getConfig().getProperty(BrokerConstants.MESSAGE_MentionMsg_Forward_Url); try { mSensitiveType = Integer.parseInt(mServer.getConfig().getProperty(BrokerConstants.SENSITIVE_Filter_Type)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } try { mBlacklistStrategy = Integer.parseInt(mServer.getConfig().getProperty(BrokerConstants.MESSAGE_Blacklist_Strategy)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } try { mBlacklistAllowSend2Black = Boolean.parseBoolean(mServer.getConfig().getProperty(BrokerConstants.MESSAGE_Blacklist_Allow_Send, "true")); } catch (Exception e) { } try { mRemoteSensitiveServerUrl = mServer.getConfig().getProperty(BrokerConstants.SENSITIVE_Remote_Server_URL); if(!StringUtil.isNullOrEmpty(mRemoteSensitiveServerUrl)) { mWaitRemoteSensitiveServerResponse = Boolean.parseBoolean(mServer.getConfig().getProperty(BrokerConstants.SENSITIVE_Remote_Fail_When_Matched, "false")); String types = mServer.getConfig().getProperty(BrokerConstants.SENSITIVE_Remote_Message_Type, ""); mRemoteSensitiveMessageTypes = new HashSet<>(); if(!StringUtil.isNullOrEmpty(types)) { String[] ts = types.split(","); for (String t:ts) { mRemoteSensitiveMessageTypes.add(Integer.parseInt(t.trim())); } } } } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } try { mNoForwardAdminMessage = Boolean.parseBoolean(mServer.getConfig().getProperty(BrokerConstants.MESSAGE_NO_Forward_Admin_Message, "false")); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } try { mAllowSend2ForbiddenUser = Boolean.parseBoolean(mServer.getConfig().getProperty(BrokerConstants.MESSAGES_ALLOW_SEND_TO_FORBIDDEN_USER, "false")); } catch (Exception e) {} } private void parseTypes(Collection collection, String types) { try { if (!StringUtil.isNullOrEmpty(types)) { String[] tss = types.split(","); for (String ts:tss) { if(ts.contains("-")) { String[] ss = ts.split("-"); if(ss.length == 2) { int begin = Integer.parseInt(ss[0]); int end = Integer.parseInt(ss[1]); for (int i = begin; i <= end ; i++) { collection.add(i); } } } else { collection.add(Integer.parseInt(ts.trim())); } } } } catch (Exception e) { e.printStackTrace(); } } @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.Message message, Qos1PublishHandler.IMCallback callback) { if(requestSourceType != ProtoConstants.RequestSourceType.Request_From_Robot) { return ErrorCode.ERROR_CODE_NOT_IMPLEMENT; } ErrorCode errorCode = ErrorCode.ERROR_CODE_SUCCESS; if (message != null) { if(message.getContent().getContent().length() + message.getContent().getSearchableContent().length() + message.getContent().getData().size() + message.getContent().getExtra().length() + message.getContent().getPushContent().length() + message.getContent().getPushData().length() > 64 * 1024) { return ErrorCode.ERROR_CODE_MESSAGE_TOO_LARGE; } boolean ignoreMsg = false; // 不能在端上直接发送撤回和群通知 if (message.getContent().getType() == 80 || message.getContent().getType() == 81 || (message.getContent().getType() >= 100 && message.getContent().getType() < 200)) { return ErrorCode.INVALID_PARAMETER; } if(m_messagesStore.getClientForbiddenSendTypes().contains(message.getContent().getType())) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } int userStatus = m_messagesStore.getUserStatus(fromUser); if (userStatus == ProtoConstants.UserStatus.Muted || userStatus == ProtoConstants.UserStatus.Forbidden) { if(!m_messagesStore.getGlobalMuteExceptionTypes().contains(message.getContent().getType())) { return ErrorCode.ERROR_CODE_FORBIDDEN_SEND_MSG; } } if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Private) { if(!m_messagesStore.getBlackListExceptionTypes().contains(message.getContent().getType())) { errorCode = m_messagesStore.isAllowUserMessage(message.getConversation().getTarget(), fromUser, message.getConversation().getLine()); if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { if (errorCode == ErrorCode.ERROR_CODE_IN_BLACK_LIST && mBlacklistStrategy != ProtoConstants.BlacklistStrategy.Message_Reject) { ignoreMsg = true; errorCode = ErrorCode.ERROR_CODE_SUCCESS; } else { return errorCode; } } if(!mBlacklistAllowSend2Black) { errorCode = m_messagesStore.isBlacked(fromUser, message.getConversation().getTarget()); if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { return errorCode; } } } if (!mAllowSend2ForbiddenUser) { userStatus = m_messagesStore.getUserStatus(message.getConversation().getTarget()); if (userStatus == ProtoConstants.UserStatus.Forbidden) { return ErrorCode.ERROR_CODE_USER_FORBIDDEN; } } } if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Group ) { if(!m_messagesStore.getGroupMuteExceptionTypes().contains(message.getContent().getType())) { errorCode = m_messagesStore.canSendMessageInGroup(fromUser, message.getConversation().getTarget()); if(errorCode == ERROR_CODE_NOT_IN_GROUP) { errorCode = ERROR_CODE_SUCCESS; } if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { return errorCode; } } } else if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_ChatRoom) { if(!m_messagesStore.getGroupMuteExceptionTypes().contains(message.getContent().getType())) { if (!m_messagesStore.checkUserClientInChatroom(fromUser, clientID, message.getConversation().getTarget())) { return ErrorCode.ERROR_CODE_NOT_IN_CHATROOM; } } } else if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Channel) { if(!m_messagesStore.getGroupMuteExceptionTypes().contains(message.getContent().getType())) { if (!m_messagesStore.canSendMessageInChannel(fromUser, message.getConversation().getTarget())) { return ErrorCode.ERROR_CODE_NOT_IN_CHANNEL; } } } if(message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Private) { long beforeMessageId = message.getMessageId(); WFCMessage.Message replyMsg = m_messagesStore.getMessage(beforeMessageId); message = message.toBuilder().setConversation(message.getConversation().toBuilder().setTarget(replyMsg.getFromUser() + "|" + replyMsg.getConversation().getTarget())).build(); } long timestamp = System.currentTimeMillis(); final long messageId; try { messageId = MessageShardingUtil.generateId(); } catch (Exception e) { e.printStackTrace(); return ErrorCode.ERROR_CODE_SERVER_ERROR; } message = message.toBuilder().setFromUser(fromUser).setMessageId(messageId).setServerTimestamp(timestamp).build(); if (!StringUtil.isNullOrEmpty(mForwardUrl) && (mForwardMessageTypes.isEmpty() || mForwardMessageTypes.contains(message.getContent().getType())) && !mForwardExcludeMessageTypes.contains(message.getContent().getType())) { publisher.forwardMessage(message, mForwardUrl, clientID); } if(!StringUtil.isNullOrEmpty(mMentionForwardUrl) && message.hasContent() && message.getContent().getMentionedType() != 0) { publisher.forwardMessage(message, mMentionForwardUrl, clientID); } if(StringUtil.isNullOrEmpty(mRemoteSensitiveServerUrl)) { Set matched = m_messagesStore.handleSensitiveWord(message.getContent().getSearchableContent()); if (matched != null && !matched.isEmpty()) { m_messagesStore.storeSensitiveMessage(message); if (!StringUtil.isNullOrEmpty(mSensitiveMessageForwardUrl)) { publisher.forwardMessage(message, mSensitiveMessageForwardUrl, clientID); } if (mSensitiveType == 0) { errorCode = ErrorCode.ERROR_CODE_SENSITIVE_MATCHED; } else if (mSensitiveType == 1) { ignoreMsg = true; } else if (mSensitiveType == 2) { String text = message.getContent().getSearchableContent(); for (String word : matched) { text = text.replace(word, "***"); } message = message.toBuilder().setContent(message.getContent().toBuilder().setSearchableContent(text).build()).build(); } } } else { if(mRemoteSensitiveMessageTypes.contains(message.getContent().getType())) { final WFCMessage.Message finalMsg = message; publisher.forwardMessageWithCallback(message, clientID, mRemoteSensitiveServerUrl, new HttpUtils.HttpCallback() { @Override public void onSuccess(String content) { if(StringUtil.isNullOrEmpty(content)) { saveAndPublish(fromUser, clientID, finalMsg, requestSourceType); } else { MessagePayload payload = GsonUtil.gson.fromJson(content, MessagePayload.class); if (payload != null && payload.getType() > 0) { WFCMessage.Message newMsg = finalMsg.toBuilder().setContent(payload.toProtoMessageContent()).build(); saveAndPublish(fromUser, clientID, newMsg, requestSourceType); } else { LOG.error("Response content {} from censor is invalid payload, ignore response and send original message", content); saveAndPublish(fromUser, clientID, finalMsg, requestSourceType); } } if(mWaitRemoteSensitiveServerResponse) { ByteBuf ackPayload = Unpooled.buffer(21); ErrorCode errorCode = ERROR_CODE_SUCCESS; ackPayload.writeByte(errorCode.getCode()); ackPayload.writeLong(messageId); ackPayload.writeLong(timestamp); callback.onIMHandled(ErrorCode.ERROR_CODE_SUCCESS, ackPayload); } } @Override public void onFailure(int statusCode, String errorMessage) { ByteBuf ackPayload = null; ErrorCode errorCode = ERROR_CODE_SUCCESS; if(statusCode == 403) { if(mWaitRemoteSensitiveServerResponse) { errorCode = ErrorCode.ERROR_CODE_SENSITIVE_MATCHED; ackPayload = Unpooled.buffer(1); ackPayload.writeByte(errorCode.getCode()); } } else { LOG.warn("Failed to censor message with status {}, errorMessage {}. Send the original message", statusCode, errorMessage); saveAndPublish(fromUser, clientID, finalMsg, requestSourceType); if(mWaitRemoteSensitiveServerResponse) { errorCode = ERROR_CODE_SUCCESS; ackPayload = Unpooled.buffer(21); ackPayload.writeByte(errorCode.getCode()); ackPayload.writeLong(messageId); ackPayload.writeLong(timestamp); } } if(mWaitRemoteSensitiveServerResponse) { callback.onIMHandled(errorCode, ackPayload); } } }); if(mWaitRemoteSensitiveServerResponse) { ackPayload.clear(); return ErrorCode.INVALID_ASYNC_HANDLING; } else { ackPayload = ackPayload.capacity(20); ackPayload.writeLong(messageId); ackPayload.writeLong(timestamp); return ErrorCode.ERROR_CODE_SUCCESS; } } } if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { if(!ignoreMsg) { saveAndPublish(fromUser, clientID, message, requestSourceType); } ackPayload = ackPayload.capacity(20); ackPayload.writeLong(messageId); ackPayload.writeLong(timestamp); } } else { errorCode = ErrorCode.ERROR_CODE_INVALID_MESSAGE; } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/RouteHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.core.Member; import io.moquette.persistence.MemorySessionStore; import io.moquette.spi.ClientSession; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Handler(IMTopic.RouteTopic) public class RouteHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.RouteRequest request, Qos1PublishHandler.IMCallback callback) { MemorySessionStore.Session session = m_sessionsStore.sessionForClientAndUser(fromUser, clientID); if (session == null) { ErrorCode errorCode = m_sessionsStore.loadActiveSession(fromUser, clientID); if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { return errorCode; } session = m_sessionsStore.sessionForClientAndUser(fromUser, clientID); } if (session == null || session.getDeleted() > 0) { if(session == null) { LOG.error("Session for <{}, {}> not exist", fromUser, clientID); } else { LOG.error("Session for <{}, {}> deleted", fromUser, clientID); } return ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH; } if(request.getPlatform() != session.getPlatform() && m_messagesStore.existSignatures()) { LOG.error("Session <{}, {}> platform is {} mismatch the request {}", session.getUsername(), session.getClientID(), session.getPlatform(), request.getPlatform()); return ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH; } String serverIp = mServer.getServerIp(); String longPort = mServer.getLongPort(); String shortPort = mServer.getShortPort(); ClientSession clientSession = m_sessionsStore.sessionForClient(clientID); boolean isSessionAlreadyStored = clientSession != null; if (!isSessionAlreadyStored) { m_sessionsStore.loadActiveSession(fromUser, clientID); } else { m_sessionsStore.updateExistSession(fromUser, clientID, request, true); } WFCMessage.RouteResponse response = WFCMessage.RouteResponse.newBuilder().setHost(serverIp).setLongPort(Integer.parseInt(longPort)).setShortPort(Integer.parseInt(shortPort)).build(); byte[] data = response.toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/SendMessageHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.pojos.OutputClient; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.hazelcast.util.StringUtil; import io.moquette.BrokerConstants; import io.moquette.persistence.MemorySessionStore; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import io.netty.buffer.Unpooled; import win.liyufan.im.*; import java.util.Collection; import java.util.HashSet; import java.util.Set; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(value = IMTopic.SendMessageTopic) public class SendMessageHandler extends IMHandler { private int mSensitiveType = 0; //命中敏感词时,0 失败,1 吞掉, 2 敏感词替换成*。 private String mForwardUrl = null; private String mSensitiveMessageForwardUrl = null; private Set mForwardMessageTypes = new HashSet<>(); private Set mForwardExcludeMessageTypes = new HashSet<>(); private String mMentionForwardUrl = null; private int mBlacklistStrategy = 0; //黑名单中时,0失败,1吞掉。 private boolean mBlacklistAllowSend2Black = true; private boolean mNoForwardAdminMessage = false; private boolean mAllowSend2ForbiddenUser = false; private String mRemoteSensitiveServerUrl = null; private Set mRemoteSensitiveMessageTypes; private boolean mWaitRemoteSensitiveServerResponse = false; public SendMessageHandler() { super(); mForwardUrl = mServer.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_Url); if (!StringUtil.isNullOrEmpty(mForwardUrl)) { String forwardTypes = mServer.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_Types); parseTypes(mForwardMessageTypes, forwardTypes); String excludeTypes = mServer.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_Exclude_Types); parseTypes(mForwardExcludeMessageTypes, excludeTypes); } mSensitiveMessageForwardUrl = mServer.getConfig().getProperty(BrokerConstants.MESSAGE_Sensitive_Forward_Url); mMentionForwardUrl = mServer.getConfig().getProperty(BrokerConstants.MESSAGE_MentionMsg_Forward_Url); try { mSensitiveType = Integer.parseInt(mServer.getConfig().getProperty(BrokerConstants.SENSITIVE_Filter_Type)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } try { mBlacklistStrategy = Integer.parseInt(mServer.getConfig().getProperty(BrokerConstants.MESSAGE_Blacklist_Strategy)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } try { mBlacklistAllowSend2Black = Boolean.parseBoolean(mServer.getConfig().getProperty(BrokerConstants.MESSAGE_Blacklist_Allow_Send, "true")); } catch (Exception e) { } try { mRemoteSensitiveServerUrl = mServer.getConfig().getProperty(BrokerConstants.SENSITIVE_Remote_Server_URL); if(!StringUtil.isNullOrEmpty(mRemoteSensitiveServerUrl)) { mWaitRemoteSensitiveServerResponse = Boolean.parseBoolean(mServer.getConfig().getProperty(BrokerConstants.SENSITIVE_Remote_Fail_When_Matched, "false")); String types = mServer.getConfig().getProperty(BrokerConstants.SENSITIVE_Remote_Message_Type, ""); mRemoteSensitiveMessageTypes = new HashSet<>(); if(!StringUtil.isNullOrEmpty(types)) { String[] ts = types.split(","); for (String t:ts) { mRemoteSensitiveMessageTypes.add(Integer.parseInt(t.trim())); } } } } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } try { mNoForwardAdminMessage = Boolean.parseBoolean(mServer.getConfig().getProperty(BrokerConstants.MESSAGE_NO_Forward_Admin_Message, "false")); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } try { mAllowSend2ForbiddenUser = Boolean.parseBoolean(mServer.getConfig().getProperty(BrokerConstants.MESSAGES_ALLOW_SEND_TO_FORBIDDEN_USER, "false")); } catch (Exception e) {} } private void parseTypes(Collection collection, String types) { try { if (!StringUtil.isNullOrEmpty(types)) { String[] tss = types.split(","); for (String ts:tss) { if(ts.contains("-")) { String[] ss = ts.split("-"); if(ss.length == 2) { int begin = Integer.parseInt(ss[0]); int end = Integer.parseInt(ss[1]); for (int i = begin; i <= end ; i++) { collection.add(i); } } } else { collection.add(Integer.parseInt(ts.trim())); } } } } catch (Exception e) { e.printStackTrace(); } } @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.Message message, Qos1PublishHandler.IMCallback callback) { ErrorCode errorCode = ErrorCode.ERROR_CODE_SUCCESS; boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if (message != null) { if(message.getContent().getContent().length() + message.getContent().getSearchableContent().length() + message.getContent().getData().size() + message.getContent().getExtra().length() + message.getContent().getPushContent().length() + message.getContent().getPushData().length() > 64 * 1024) { return ErrorCode.ERROR_CODE_MESSAGE_TOO_LARGE; } boolean ignoreMsg = false; if (!isAdmin) { //admin do not check the right // 不能在端上直接发送撤回和群通知 if (message.getContent().getType() == 80 || message.getContent().getType() == 81 || (message.getContent().getType() >= 100 && message.getContent().getType() < 200)) { return ErrorCode.INVALID_PARAMETER; } if(m_messagesStore.getClientForbiddenSendTypes().contains(message.getContent().getType())) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } int userStatus = m_messagesStore.getUserStatus(fromUser); if (userStatus == ProtoConstants.UserStatus.Muted || userStatus == ProtoConstants.UserStatus.Forbidden) { if(!m_messagesStore.getGlobalMuteExceptionTypes().contains(message.getContent().getType())) { return ErrorCode.ERROR_CODE_FORBIDDEN_SEND_MSG; } } if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Private) { if(!m_messagesStore.getBlackListExceptionTypes().contains(message.getContent().getType())) { errorCode = m_messagesStore.isAllowUserMessage(message.getConversation().getTarget(), fromUser, message.getConversation().getLine()); if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { if (errorCode == ErrorCode.ERROR_CODE_IN_BLACK_LIST && mBlacklistStrategy != ProtoConstants.BlacklistStrategy.Message_Reject) { ignoreMsg = true; errorCode = ErrorCode.ERROR_CODE_SUCCESS; } else { return errorCode; } } if(!mBlacklistAllowSend2Black) { errorCode = m_messagesStore.isBlacked(fromUser, message.getConversation().getTarget()); if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { return errorCode; } } } if (!mAllowSend2ForbiddenUser) { userStatus = m_messagesStore.getUserStatus(message.getConversation().getTarget()); if (userStatus == ProtoConstants.UserStatus.Forbidden) { return ErrorCode.ERROR_CODE_USER_FORBIDDEN; } } } if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Group ) { if(!m_messagesStore.getGroupMuteExceptionTypes().contains(message.getContent().getType())) { errorCode = m_messagesStore.canSendMessageInGroup(fromUser, message.getConversation().getTarget()); if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { return errorCode; } } } else if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_ChatRoom) { if(!m_messagesStore.getGroupMuteExceptionTypes().contains(message.getContent().getType())) { if (!m_messagesStore.checkUserClientInChatroom(fromUser, clientID, message.getConversation().getTarget())) { return ErrorCode.ERROR_CODE_NOT_IN_CHATROOM; } } } else if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Channel) { if(!m_messagesStore.getGroupMuteExceptionTypes().contains(message.getContent().getType())) { if (!m_messagesStore.canSendMessageInChannel(fromUser, message.getConversation().getTarget())) { return ErrorCode.ERROR_CODE_NOT_IN_CHANNEL; } } } } else if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Group) { if(m_messagesStore.getGroupInfo(message.getConversation().getTarget()) == null) { return ErrorCode.ERROR_CODE_NOT_EXIST; } } else if (message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Channel) { WFCMessage.ChannelInfo channelData = m_messagesStore.getChannelInfo(message.getConversation().getTarget()); if(channelData == null || channelData.getStatus() == ProtoConstants.ChannelState.Channel_State_Mask_Deleted) { return ErrorCode.ERROR_CODE_NOT_EXIST; } } long timestamp = System.currentTimeMillis(); final long messageId; try { messageId = MessageShardingUtil.generateId(); } catch (Exception e) { e.printStackTrace(); return ErrorCode.ERROR_CODE_SERVER_ERROR; } message = message.toBuilder().setFromUser(fromUser).setMessageId(messageId).setServerTimestamp(timestamp).build(); if (!StringUtil.isNullOrEmpty(mForwardUrl) && (mForwardMessageTypes.isEmpty() || mForwardMessageTypes.contains(message.getContent().getType())) && !(isAdmin && mNoForwardAdminMessage) && !mForwardExcludeMessageTypes.contains(message.getContent().getType())) { publisher.forwardMessage(message, mForwardUrl, clientID); } if(!StringUtil.isNullOrEmpty(mMentionForwardUrl) && message.hasContent() && message.getContent().getMentionedType() != 0 && !(isAdmin && mNoForwardAdminMessage)) { publisher.forwardMessage(message, mMentionForwardUrl, clientID); } if (!isAdmin) { if(StringUtil.isNullOrEmpty(mRemoteSensitiveServerUrl)) { Set matched = m_messagesStore.handleSensitiveWord(message.getContent().getSearchableContent()); if (matched != null && !matched.isEmpty()) { m_messagesStore.storeSensitiveMessage(message); if (!StringUtil.isNullOrEmpty(mSensitiveMessageForwardUrl)) { publisher.forwardMessage(message, mSensitiveMessageForwardUrl, clientID); } if (mSensitiveType == 0) { errorCode = ErrorCode.ERROR_CODE_SENSITIVE_MATCHED; } else if (mSensitiveType == 1) { ignoreMsg = true; } else if (mSensitiveType == 2) { String text = message.getContent().getSearchableContent(); for (String word : matched) { text = text.replace(word, "***"); } message = message.toBuilder().setContent(message.getContent().toBuilder().setSearchableContent(text).build()).build(); } } } else { if(mRemoteSensitiveMessageTypes.contains(message.getContent().getType())) { final WFCMessage.Message finalMsg = message; publisher.forwardMessageWithCallback(message, clientID, mRemoteSensitiveServerUrl, new HttpUtils.HttpCallback() { @Override public void onSuccess(String content) { if(StringUtil.isNullOrEmpty(content)) { saveAndPublish(fromUser, clientID, finalMsg, requestSourceType); } else { MessagePayload payload = GsonUtil.gson.fromJson(content, MessagePayload.class); if (payload != null && payload.getType() > 0) { WFCMessage.Message newMsg = finalMsg.toBuilder().setContent(payload.toProtoMessageContent()).build(); saveAndPublish(fromUser, clientID, newMsg, requestSourceType); } else { LOG.error("Response content {} from censor is invalid payload, ignore response and send original message", content); saveAndPublish(fromUser, clientID, finalMsg, requestSourceType); } } if(mWaitRemoteSensitiveServerResponse) { ByteBuf ackPayload = Unpooled.buffer(21); ErrorCode errorCode = ERROR_CODE_SUCCESS; ackPayload.writeByte(errorCode.getCode()); ackPayload.writeLong(messageId); ackPayload.writeLong(timestamp); callback.onIMHandled(ErrorCode.ERROR_CODE_SUCCESS, ackPayload); } } @Override public void onFailure(int statusCode, String errorMessage) { ByteBuf ackPayload = null; ErrorCode errorCode = ERROR_CODE_SUCCESS; if(statusCode == 403) { if(mWaitRemoteSensitiveServerResponse) { errorCode = ErrorCode.ERROR_CODE_SENSITIVE_MATCHED; ackPayload = Unpooled.buffer(1); ackPayload.writeByte(errorCode.getCode()); } } else { LOG.warn("Failed to censor message with status {}, errorMessage {}. Send the original message", statusCode, errorMessage); saveAndPublish(fromUser, clientID, finalMsg, requestSourceType); if(mWaitRemoteSensitiveServerResponse) { errorCode = ERROR_CODE_SUCCESS; ackPayload = Unpooled.buffer(21); ackPayload.writeByte(errorCode.getCode()); ackPayload.writeLong(messageId); ackPayload.writeLong(timestamp); } } if(mWaitRemoteSensitiveServerResponse) { callback.onIMHandled(errorCode, ackPayload); } } }); if(mWaitRemoteSensitiveServerResponse) { ackPayload.clear(); return ErrorCode.INVALID_ASYNC_HANDLING; } else { ackPayload = ackPayload.capacity(20); ackPayload.writeLong(messageId); ackPayload.writeLong(timestamp); return ErrorCode.ERROR_CODE_SUCCESS; } } } } if (errorCode == ErrorCode.ERROR_CODE_SUCCESS) { if(!ignoreMsg) { saveAndPublish(fromUser, clientID, message, requestSourceType); } ackPayload = ackPayload.capacity(20); ackPayload.writeLong(messageId); ackPayload.writeLong(timestamp); } } else { errorCode = ErrorCode.ERROR_CODE_INVALID_MESSAGE; } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/SetFriendAliasRequestHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.SetFriendAliasTopic) public class SetFriendAliasRequestHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.AddFriendRequest request, Qos1PublishHandler.IMCallback callback) { long[] head = new long[1]; ErrorCode errorCode = m_messagesStore.setFriendAliasRequest(fromUser, request.getTargetUid(), request.getReason(), head); if (errorCode == ERROR_CODE_SUCCESS) { publisher.publishNotification(IMTopic.NotifyFriendTopic, fromUser, head[0]); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/SetFriendExtraHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.SetFriendExtraTopic) public class SetFriendExtraHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.StringPair request, Qos1PublishHandler.IMCallback callback) { long[] heads = new long[1]; ErrorCode errorCode = m_messagesStore.setFriendExtraRequest(fromUser, request.getKey(), request.getValue(), heads); if (errorCode == ERROR_CODE_SUCCESS) { publisher.publishNotification(IMTopic.NotifyFriendTopic, fromUser, heads[0], clientID); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/SetGroupManagerHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.GroupNotificationBinaryContent; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.SetGroupManagerTopic) public class SetGroupManagerHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.SetGroupManagerRequest request, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !m_messagesStore.isAllowClientCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_Robot && !m_messagesStore.isAllowRobotCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) { int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation(); if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Set_Group_Manage) > 0) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } ErrorCode errorCode = m_messagesStore.setGroupManager(fromUser, request.getGroupId(), request.getType(), request.getUserIdList(), isAdmin); if (errorCode == ERROR_CODE_SUCCESS) { if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) { sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), request.getNotifyContent()); } else { WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, request.getType() + "", request.getUserIdList()).getSetGroupManagerNotifyContent(); sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content); } } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/SyncFriendRequestUnreadHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.RriendRequestUnreadSyncTopic) public class SyncFriendRequestUnreadHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.Version request, Qos1PublishHandler.IMCallback callback) { long[] head = new long[1]; ErrorCode errorCode = m_messagesStore.SyncFriendRequestUnread(fromUser, request.getVersion(), head); if (errorCode == ERROR_CODE_SUCCESS) { publisher.publishNotification(IMTopic.NotifyFriendRequestTopic, fromUser, head[0]); } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/TransferChannelHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Handler(IMTopic.TransferChannelInfoTopic) public class TransferChannelHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.TransferChannel request, Qos1PublishHandler.IMCallback callback) { ErrorCode errorCode = m_messagesStore.transferChannel(fromUser, request.getChannelId(), request.getNewOwner()); return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/TransferGroupHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.pojos.GroupNotificationBinaryContent; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; @Handler(IMTopic.TransferGroupTopic) public class TransferGroupHandler extends GroupHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.TransferGroupRequest request, Qos1PublishHandler.IMCallback callback) { boolean isAdmin = requestSourceType == ProtoConstants.RequestSourceType.Request_From_Admin; if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_User && !m_messagesStore.isAllowClientCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(request.hasNotifyContent() && request.getNotifyContent().getType() > 0 && requestSourceType == ProtoConstants.RequestSourceType.Request_From_Robot && !m_messagesStore.isAllowRobotCustomGroupNotification()) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_User) { int forbiddenClientOperation = m_messagesStore.getGroupForbiddenClientOperation(); if((forbiddenClientOperation & ProtoConstants.ForbiddenClientGroupOperationMask.Forbidden_Transfer_Group) > 0) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } ErrorCode errorCode = m_messagesStore.transferGroup(fromUser, request.getGroupId(), request.getNewOwner(), isAdmin); if (errorCode == ERROR_CODE_SUCCESS) { if (request.hasNotifyContent() && request.getNotifyContent().getType() > 0) { sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), request.getNotifyContent()); } else { WFCMessage.MessageContent content = new GroupNotificationBinaryContent(request.getGroupId(), fromUser, null, request.getNewOwner()).getTransferGroupNotifyContent(); sendGroupNotification(fromUser, request.getGroupId(), request.getToLineList(), content); } } return errorCode; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/UploadDeviceTokenHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.persistence.MemorySessionStore; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; @Handler(IMTopic.UploadDeviceTokenTopic) public class UploadDeviceTokenHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.UploadDeviceTokenRequest request, Qos1PublishHandler.IMCallback callback) { MemorySessionStore.Session session = m_sessionsStore.getSession(clientID); session.setPlatform(request.getPlatform()); session.setAppName(request.getAppName()); if (request.getPlatform() == ProtoConstants.Platform.Platform_iOS && request.getPushType() == 2) { LOG.info("Set device token, userId {}", fromUser); session.setVoipDeviceToken(request.getDeviceToken()); m_sessionsStore.updateSessionToken(session, true); } else { LOG.info("Set device token, userId {}, platform {}, pushType {}", fromUser, session.getPlatform(), request.getPushType()); session.setDeviceToken(request.getDeviceToken()); session.setPushType(request.getPushType()); m_sessionsStore.updateSessionToken(session, false); m_sessionsStore.cleanDuplatedToken(session.getClientID(), session.getPushType(), session.getDeviceToken(), false, session.getAppName()); } return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/imhandler/UserSearchHandler.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.imhandler; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.moquette.spi.impl.Qos1PublishHandler; import io.netty.buffer.ByteBuf; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.IMTopic; import java.util.ArrayList; import java.util.List; @Handler(IMTopic.UserSearchTopic) public class UserSearchHandler extends IMHandler { @Override public ErrorCode action(ByteBuf ackPayload, String clientID, String fromUser, ProtoConstants.RequestSourceType requestSourceType, WFCMessage.SearchUserRequest request, Qos1PublishHandler.IMCallback callback) { List users = new ArrayList<>(); ErrorCode errorCode = m_messagesStore.searchUser(fromUser, request.getKeyword(), request.getFuzzy(), request.getType(), request.getPage(), users); if(errorCode != ErrorCode.ERROR_CODE_SUCCESS) { return errorCode; } WFCMessage.SearchUserResult.Builder builder = WFCMessage.SearchUserResult.newBuilder(); builder.addAllEntry(users); byte[] data = builder.build().toByteArray(); ackPayload.ensureWritable(data.length).writeBytes(data); return ErrorCode.ERROR_CODE_SUCCESS; } } ================================================ FILE: broker/src/main/java/io/moquette/interception/InterceptHandler.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.interception; import io.moquette.interception.messages.*; import io.netty.handler.codec.mqtt.MqttMessage; /** * This interface is used to inject code for intercepting broker events. *

* The events can act only as observers. *

* Almost every method receives a subclass of {@link MqttMessage}, except onDisconnect * that receives the client id string and onSubscribe and onUnsubscribe * that receive a {@link Subscription} object. */ public interface InterceptHandler { Class[] ALL_MESSAGE_TYPES = {InterceptConnectMessage.class, InterceptDisconnectMessage.class, InterceptConnectionLostMessage.class, InterceptPublishMessage.class, InterceptAcknowledgedMessage.class}; /** * Returns the identifier of this intercept handler. * * @return */ String getID(); /** * Returns the InterceptMessage subtypes that this handler can process. If the result is null or * equal to ALL_MESSAGE_TYPES, all the message types will be processed. * * @return */ Class[] getInterceptedMessageTypes(); void onConnect(InterceptConnectMessage msg); void onDisconnect(InterceptDisconnectMessage msg); void onConnectionLost(InterceptConnectionLostMessage msg); void onPublish(InterceptPublishMessage msg); void onMessageAcknowledged(InterceptAcknowledgedMessage msg); } ================================================ FILE: broker/src/main/java/io/moquette/interception/Interceptor.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.interception; import io.moquette.interception.messages.InterceptAcknowledgedMessage; import io.netty.handler.codec.mqtt.MqttConnectMessage; import io.netty.handler.codec.mqtt.MqttPublishMessage; /** * This interface is to be used internally by the broker components. *

* An interface is used instead of a class to allow more flexibility in changing an implementation. *

* Interceptor implementations forward notifications to a InterceptHandler, that is * normally a field. So, the implementations should act as a proxy to a custom intercept handler. * * @see InterceptHandler */ public interface Interceptor { void notifyClientConnected(MqttConnectMessage msg); void notifyClientDisconnected(String clientID, String username); void notifyClientConnectionLost(String clientID, String username); void notifyMessageAcknowledged(InterceptAcknowledgedMessage msg); void addInterceptHandler(InterceptHandler interceptHandler); void removeInterceptHandler(InterceptHandler interceptHandler); } ================================================ FILE: broker/src/main/java/io/moquette/interception/messages/InterceptAbstractMessage.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.interception.messages; import io.netty.handler.codec.mqtt.MqttMessage; import io.netty.handler.codec.mqtt.MqttQoS; public abstract class InterceptAbstractMessage implements InterceptMessage { private final MqttMessage msg; InterceptAbstractMessage(MqttMessage msg) { this.msg = msg; } public boolean isRetainFlag() { return msg.fixedHeader().isRetain(); } public boolean isDupFlag() { return msg.fixedHeader().isDup(); } public MqttQoS getQos() { return msg.fixedHeader().qosLevel(); } } ================================================ FILE: broker/src/main/java/io/moquette/interception/messages/InterceptAcknowledgedMessage.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.interception.messages; import static io.moquette.spi.IMessagesStore.StoredMessage; public class InterceptAcknowledgedMessage implements InterceptMessage { private final StoredMessage msg; private final String username; private final String topic; private final int packetID; public InterceptAcknowledgedMessage(StoredMessage msg, String topic, String username, int packetID) { this.msg = msg; this.username = username; this.topic = topic; this.packetID = packetID; } public StoredMessage getMsg() { return msg; } public String getUsername() { return username; } public String getTopic() { return topic; } public int getPacketID() { return packetID; } } ================================================ FILE: broker/src/main/java/io/moquette/interception/messages/InterceptConnectMessage.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.interception.messages; import io.netty.handler.codec.mqtt.MqttConnectMessage; public class InterceptConnectMessage extends InterceptAbstractMessage { private final MqttConnectMessage msg; public InterceptConnectMessage(MqttConnectMessage msg) { super(msg); this.msg = msg; } public String getClientID() { return msg.payload().clientIdentifier(); } public boolean isCleanSession() { return msg.variableHeader().isCleanSession(); } public int getKeepAlive() { return msg.variableHeader().keepAliveTimeSeconds(); } public boolean isPasswordFlag() { return msg.variableHeader().hasPassword(); } public byte getProtocolVersion() { return (byte) msg.variableHeader().version(); } public String getProtocolName() { return msg.variableHeader().name(); } public boolean isUserFlag() { return msg.variableHeader().hasUserName(); } public boolean isWillFlag() { return msg.variableHeader().isWillFlag(); } public byte getWillQos() { return (byte) msg.variableHeader().willQos(); } public boolean isWillRetain() { return msg.variableHeader().isWillRetain(); } public String getUsername() { return msg.payload().userName(); } public byte[] getPassword() { return msg.payload().passwordInBytes(); } public String getWillTopic() { return msg.payload().willTopic(); } public byte[] getWillMessage() { return msg.payload().willMessage().getBytes(); } } ================================================ FILE: broker/src/main/java/io/moquette/interception/messages/InterceptConnectionLostMessage.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.interception.messages; public class InterceptConnectionLostMessage implements InterceptMessage { private final String clientID; private final String username; public InterceptConnectionLostMessage(String clientID, String username) { this.clientID = clientID; this.username = username; } public String getClientID() { return clientID; } public String getUsername() { return username; } } ================================================ FILE: broker/src/main/java/io/moquette/interception/messages/InterceptDisconnectMessage.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.interception.messages; public class InterceptDisconnectMessage implements InterceptMessage { private final String clientID; private final String username; public InterceptDisconnectMessage(String clientID, String username) { this.clientID = clientID; this.username = username; } public String getClientID() { return clientID; } public String getUsername() { return username; } } ================================================ FILE: broker/src/main/java/io/moquette/interception/messages/InterceptMessage.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.interception.messages; /** * An interface that sets the root of the interceptor messages type hierarchy. */ public interface InterceptMessage { } ================================================ FILE: broker/src/main/java/io/moquette/interception/messages/InterceptPublishMessage.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.interception.messages; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.mqtt.MqttPublishMessage; public class InterceptPublishMessage extends InterceptAbstractMessage { private final MqttPublishMessage msg; private final String clientID; private final String username; public InterceptPublishMessage(MqttPublishMessage msg, String clientID, String username) { super(msg); this.msg = msg; this.clientID = clientID; this.username = username; } public String getTopicName() { return msg.variableHeader().topicName(); } public ByteBuf getPayload() { return msg.payload(); } public String getClientID() { return clientID; } public String getUsername() { return username; } } ================================================ FILE: broker/src/main/java/io/moquette/logging/LoggingUtils.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.logging; import java.util.ArrayList; import java.util.Collection; import io.moquette.interception.InterceptHandler; public final class LoggingUtils { public static Collection getInterceptorIds(Collection handlers) { Collection result = new ArrayList<>(handlers.size()); for (T handler : handlers) { result.add(handler.getID()); } return result; } private LoggingUtils() { } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/ChannelLoader.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.persistence; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.core.MapStore; import io.moquette.server.Server; import java.util.Collection; import java.util.Map; public class ChannelLoader implements MapStore { @Override public void store(String s, WFCMessage.ChannelInfo channelInfo) { getDatabaseStore().updateChannelInfo(channelInfo); } @Override public void storeAll(Map map) { } @Override public void delete(String s) { getDatabaseStore().removeChannelInfo(s); } @Override public void deleteAll(Collection collection) { } private DatabaseStore getDatabaseStore() { return Server.getServer().getStore().messagesStore().getDatabaseStore(); } @Override public WFCMessage.ChannelInfo load(String key) { return getDatabaseStore().getPersistChannelInfo(key); } @Override public Map loadAll(Collection keys) { return null; } @Override public Iterable loadAllKeys() { return null; } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/ChatroomLoader.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.persistence; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.core.MapStore; import io.moquette.server.Server; import java.util.Collection; import java.util.Map; public class ChatroomLoader implements MapStore { private DatabaseStore getDatabaseStore() { return Server.getServer().getStore().messagesStore().getDatabaseStore(); } /** * Loads the value of a given key. If distributed map doesn't contain the value * for the given key then Hazelcast will call implementation's load (key) method * to obtain the value. Implementation can use any means of loading the given key; * such as an O/R mapping tool, simple SQL or reading a file etc. * * @param key@return value of the key, value cannot be null */ @Override public WFCMessage.ChatroomInfo load(String key) { return getDatabaseStore().getPersistChatroomInfo(key); } /** * Loads given keys. This is batch load operation so that implementation can * optimize the multiple loads. *

* For any key in the input keys, there should be a single mapping in the resulting map. Also the resulting * map should not have any keys that are not part of the input keys. *

* The given collection should not contain any null keys. * The returned Map should not contain any null keys or values. * * @param keys keys of the values entries to load * @return map of loaded key-value pairs. */ @Override public Map loadAll(Collection keys) { return null; } @Override public Iterable loadAllKeys() { return null; } @Override public void store(String s, WFCMessage.ChatroomInfo chatroomInfo) { getDatabaseStore().updateChatroomInfo(s, chatroomInfo); } @Override public void storeAll(Map map) { } @Override public void delete(String s) { getDatabaseStore().removeChatroomInfo(s); } @Override public void deleteAll(Collection collection) { } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/DatabaseStore.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.persistence; import cn.wildfirechat.pojos.SystemSettingPojo; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.server.ThreadPoolExecutorWrapper; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.core.MultiMap; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.model.FriendData; import io.moquette.server.Server; import io.moquette.spi.ClientSession; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.DBUtil; import win.liyufan.im.MessageBundle; import win.liyufan.im.MessageShardingUtil; import win.liyufan.im.Utility; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.security.MessageDigest; import java.sql.*; import java.util.*; import java.util.function.Function; import static cn.wildfirechat.common.IMExceptionEvent.EventType.RDBS_Exception; import static cn.wildfirechat.proto.ProtoConstants.PersistFlag.Transparent; import static cn.wildfirechat.proto.ProtoConstants.UserSearchUserType.UserSearchUserType_ONLY_ROBOT; import static cn.wildfirechat.proto.ProtoConstants.UserSearchUserType.UserSearchUserType_ONLY_USER; import static io.moquette.BrokerConstants.GROUP_INFO_MARK_DELETION; import static io.moquette.server.Constants.MAX_MESSAGE_QUEUE; import static cn.wildfirechat.proto.ProtoConstants.SearchUserType.*; import static win.liyufan.im.UserSettingScope.kUserSettingPrivacySearchable; public class DatabaseStore { private static final Logger LOG = LoggerFactory.getLogger(DatabaseStore.class); private final ThreadPoolExecutorWrapper mScheduler; private boolean disableRemoteMessageSearch = false; private boolean encryptMessage = false; private boolean keepGroupInfo = false; public void setDisableRemoteMessageSearch(boolean disableRemoteMessageSearch) { this.disableRemoteMessageSearch = disableRemoteMessageSearch; } public void setEncryptMessage(boolean encryptMessage) { this.encryptMessage = encryptMessage; } public DatabaseStore(ThreadPoolExecutorWrapper scheduler) { this.mScheduler = scheduler; try { keepGroupInfo = Boolean.parseBoolean(Server.getServer().getConfig().getProperty(GROUP_INFO_MARK_DELETION, "false")); } catch (Exception e) { } } TreeMap reloadUserMessageMaps(String userId) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; TreeMap out = new TreeMap<>(); try { connection = DBUtil.getConnection(); String sql = "select `_seq`, `_mid` from " + getUserMessageTable(userId) + " where `_uid` = ? order by `_seq` DESC limit " + MAX_MESSAGE_QUEUE; statement = connection.prepareStatement(sql); statement.setString(1, userId); rs = statement.executeQuery(); while (rs.next()) { int index = 1; long msgSeq = rs.getLong(index++); long msgId = rs.getLong(index); out.put(msgSeq, msgId); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return out; } boolean updateSystemSetting(int id, String value, String desc) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "insert into t_settings " + " (`id`, `_value`, `_desc`) values(?, ?, ?)" + " ON DUPLICATE KEY UPDATE " + "`_value` = ?," + "`_desc` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setLong(index++, id); statement.setString(index++, value); statement.setString(index++, desc); statement.setString(index++, value); statement.setString(index++, desc); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); return true; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } return false; } SystemSettingPojo getSystemSetting(int id) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_value`, `_desc` from t_settings where `id` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setLong(index++, id); rs = statement.executeQuery(); while (rs.next()) { SystemSettingPojo out = new SystemSettingPojo(); index = 1; out.id = id; String value = rs.getString(index++); value = (value == null ? "" : value); out.value = value; value = rs.getString(index++); value = (value == null ? "" : value); out.desc = value; return out; } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } List searchUserByNameMobileUserId(String keyword, int searchType, int userType) { ArrayList out = new ArrayList<>(); Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_uid`, `_name`" + ", `_display_name`" + ", `_portrait`" + ", `_mobile`" + ", `_gender`" + ", `_email`" + ", `_address`" + ", `_company`" + ", `_social`" + ", `_extra`" + ", `_dt`, `_type` from t_user"; int sqlParaCount = 1; if(searchType == SearchUserType_Name) { sql += " where `_name` = ? "; } else if(searchType == SearchUserType_Mobile) { sql += " where `_mobile` = ? "; } else if(searchType == SearchUserType_UserId) { sql += " where `_uid` = ? "; } else if(searchType == SearchUserType_Name_Mobile || searchType == SearchUserType_Name_Mobile_DisplayName) { sqlParaCount = 2; sql += " where (`_name` = ? or `_mobile` = ?) "; } else { sqlParaCount = 3; sql += " where (`_name` = ? or `_mobile` = ? or `_uid` = ?) "; } if(userType == UserSearchUserType_ONLY_USER) { sql += " and _type <> 2 "; //can not search device sql += " and _type <> 1 "; } else if(userType == UserSearchUserType_ONLY_ROBOT) { sql += " and _type = 1 "; } else { sql += " and _type <> 2 "; //can not search device } sql += " and _deleted = 0 "; if(searchType == SearchUserType_Name || searchType == SearchUserType_Mobile || searchType == SearchUserType_UserId) { sql += " limit 1"; } else if(searchType == SearchUserType_Name_Mobile || searchType == SearchUserType_Name_Mobile_DisplayName) { sql += " limit 2"; } else { sql += " limit 3"; } statement = connection.prepareStatement(sql); for (int i = 0; i < sqlParaCount; i++) { statement.setString(i+1, keyword); } rs = statement.executeQuery(); while (rs.next()) { WFCMessage.User.Builder builder = WFCMessage.User.newBuilder(); int index = 1; String value = rs.getString(index++); value = (value == null ? "" : value); builder.setUid(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setName(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setDisplayName(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setPortrait(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setMobile(value); int gender = rs.getInt(index++); builder.setGender(gender); value = rs.getString(index++); value = (value == null ? "" : value); builder.setEmail(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setAddress(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setCompany(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setSocial(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setExtra(value); long longValue = rs.getLong(index++); builder.setUpdateDt(longValue); int type = rs.getInt(index++); builder.setType( type); WFCMessage.User user = builder.build(); out.add(user); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } List filter = new ArrayList<>(); for (WFCMessage.User user : out) { WFCMessage.UserSettingEntry userSettingEntry = Server.getServer().getStore().messagesStore().getUserSetting(user.getUid(), kUserSettingPrivacySearchable, null); if(userSettingEntry != null) { int value = 0; try { value = StringUtil.isNullOrEmpty(userSettingEntry.getValue())?0:Integer.parseInt(userSettingEntry.getValue()); } catch (NumberFormatException e) { e.printStackTrace(); } if((value & ProtoConstants.DisableSearchMask.DisableSearchNameMask) > 0) { if (searchType == SearchUserType_Name) { filter.add(user); continue; } else if(searchType == SearchUserType_Name_Mobile || searchType == SearchUserType_Name_Mobile_DisplayName) { if(keyword.equals(user.getName())) { if(!keyword.equals(user.getMobile())) { filter.add(user); continue; } else if((value & ProtoConstants.DisableSearchMask.DisableSearchMobileMask) > 0) { filter.add(user); continue; } } } else if(searchType == SearchUserType_Name_Mobile_UserId) { if(keyword.equals(user.getName())) { if(keyword.equals(user.getMobile()) && keyword.equals(user.getUid())) { if((value & ProtoConstants.DisableSearchMask.DisableSearchMobileMask) > 0 && (value & ProtoConstants.DisableSearchMask.DisableSearchUserIdMask) > 0) { filter.add(user); continue; } } else if(keyword.equals(user.getMobile())) { if((value & ProtoConstants.DisableSearchMask.DisableSearchMobileMask) > 0) { filter.add(user); continue; } } else if(keyword.equals(user.getUid())) { if((value & ProtoConstants.DisableSearchMask.DisableSearchUserIdMask) > 0) { filter.add(user); continue; } } else { filter.add(user); continue; } } } } if((value & ProtoConstants.DisableSearchMask.DisableSearchMobileMask) > 0) { if (searchType == SearchUserType_Mobile) { filter.add(user); continue; } else if(searchType == SearchUserType_Name_Mobile || searchType == SearchUserType_Name_Mobile_DisplayName) { if(keyword.equals(user.getMobile())) { if(!keyword.equals(user.getName())) { filter.add(user); continue; } else if((value & ProtoConstants.DisableSearchMask.DisableSearchNameMask) > 0) { filter.add(user); continue; } } } else if(searchType == SearchUserType_Name_Mobile_UserId) { if(keyword.equals(user.getMobile())) { if(keyword.equals(user.getName()) && keyword.equals(user.getUid())) { if((value & ProtoConstants.DisableSearchMask.DisableSearchNameMask) > 0 && (value & ProtoConstants.DisableSearchMask.DisableSearchUserIdMask) > 0) { filter.add(user); continue; } } else if(keyword.equals(user.getName())) { if((value & ProtoConstants.DisableSearchMask.DisableSearchNameMask) > 0) { filter.add(user); continue; } } else if(keyword.equals(user.getUid())) { if((value & ProtoConstants.DisableSearchMask.DisableSearchUserIdMask) > 0) { filter.add(user); continue; } } else { filter.add(user); continue; } } } } if((value & ProtoConstants.DisableSearchMask.DisableSearchUserIdMask) > 0) { if (searchType == SearchUserType_UserId) { filter.add(user); continue; } else if(searchType == SearchUserType_Name_Mobile_UserId) { if(keyword.equals(user.getUid())) { if(keyword.equals(user.getName()) && keyword.equals(user.getMobile())) { if((value & ProtoConstants.DisableSearchMask.DisableSearchNameMask) > 0 && (value & ProtoConstants.DisableSearchMask.DisableSearchMobileMask) > 0) { filter.add(user); continue; } } else if(keyword.equals(user.getName())) { if((value & ProtoConstants.DisableSearchMask.DisableSearchNameMask) > 0) { filter.add(user); continue; } } else if(keyword.equals(user.getMobile())) { if((value & ProtoConstants.DisableSearchMask.DisableSearchMobileMask) > 0) { filter.add(user); continue; } } else { filter.add(user); continue; } } } } } } out.removeAll(filter); return out; } List searchUserByDisplayName(String keyword, int userType, int page, List nameOrIdMatched) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; ArrayList out = new ArrayList<>(); try { connection = DBUtil.getConnection(); String sql = "select u._uid, u._name, u._display_name, u._portrait, u._mobile, u._gender, u._email, u._address, u._company, u._social, u._extra, u._dt, u._type " + " from t_user u left join (select _uid, _value from t_user_setting where _scope = 27) s on u._uid = s._uid " + " where u._display_name like ? ESCAPE '!' "; if(userType == UserSearchUserType_ONLY_USER) { sql += " and u._type <> 2 "; sql += " and u._type <> 1 "; } else if(userType == UserSearchUserType_ONLY_ROBOT) { sql += " and u._type = 1 "; } else { sql += " and u._type <> 2 "; } sql += " and u._deleted = 0 "; if(nameOrIdMatched.size() == 1) { sql += " and u._uid <> ? and u._name <> ?"; } else if(nameOrIdMatched.size() == 2) { sql += " and u._uid <> ? and u._uid <>? and u._name <> ? and u._name <>? "; } sql += " and (s._value is null or (s._value <> 1 and s._value <> 3 and s._value <> 5 and s._value <> 7)) limit "; if(page == 0) { sql += (20 - nameOrIdMatched.size()); } else { sql += 20; } if (page > 0) { sql += " offset " + (page * 20 - nameOrIdMatched.size()); } keyword = keyword .replace("!", "!!") .replace("%", "!%") .replace("_", "!_") .replace("[", "!["); statement = connection.prepareStatement(sql); statement.setString(1, "%" + keyword + "%"); if(nameOrIdMatched.size() == 1) { statement.setString(2, nameOrIdMatched.toArray(new WFCMessage.User[0])[0].getUid()); statement.setString(3, nameOrIdMatched.toArray(new WFCMessage.User[0])[0].getUid()); } else if(nameOrIdMatched.size() == 2) { statement.setString(2, nameOrIdMatched.toArray(new WFCMessage.User[0])[0].getUid()); statement.setString(3, nameOrIdMatched.toArray(new WFCMessage.User[0])[1].getUid()); statement.setString(4, nameOrIdMatched.toArray(new WFCMessage.User[0])[0].getUid()); statement.setString(5, nameOrIdMatched.toArray(new WFCMessage.User[0])[1].getUid()); } rs = statement.executeQuery(); while (rs.next()) { WFCMessage.User.Builder builder = WFCMessage.User.newBuilder(); int index = 1; String value = rs.getString(index++); value = (value == null ? "" : value); builder.setUid(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setName(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setDisplayName(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setPortrait(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setMobile(value); int gender = rs.getInt(index++); builder.setGender(gender); value = rs.getString(index++); value = (value == null ? "" : value); builder.setEmail(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setAddress(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setCompany(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setSocial(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setExtra(value); long longValue = rs.getLong(index++); builder.setUpdateDt(longValue); int type = rs.getInt(index++); builder.setType(type); WFCMessage.User user = builder.build(); out.add(user); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return out; } List searchUserFromDB(String keyword, int searchType, int userType, int page) { List nameOrIdMatched = searchUserByNameMobileUserId(keyword, searchType, userType); List out = new ArrayList<>(); if(page == 0) { out.addAll(nameOrIdMatched); } if(searchType == SearchUserType_General || searchType == SearchUserType_Name_Mobile_DisplayName) { List general = searchUserByDisplayName(keyword, userType, page, nameOrIdMatched); general.removeAll(nameOrIdMatched); out.addAll(general); } return out; } Integer getUserStatus(String userId) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_status` from t_user_status where `_uid` = ?"; statement = connection.prepareStatement(sql); statement.setString(1, userId); rs = statement.executeQuery(); if (rs.next()) { return rs.getInt(1); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return 0; } synchronized Collection reloadGroupMemberFromDB(HazelcastInstance hzInstance, String groupId) { MultiMap groupMembers = hzInstance.getMultiMap(MemoryMessagesStore.GROUP_MEMBERS); if (groupMembers.get(groupId).size() > 0) { return groupMembers.get(groupId); } Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_mid`" + ", `_alias`" + ", `_type`" + ", `_dt`, `_create_dt`, `_extra` from t_group_member where _gid = ?"; statement = connection.prepareStatement(sql); statement.setString(1, groupId); int index; rs = statement.executeQuery(); while (rs.next()) { WFCMessage.GroupMember.Builder builder = WFCMessage.GroupMember.newBuilder(); index = 1; String value = rs.getString(index++); value = (value == null ? "" : value); builder.setMemberId(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setAlias(value); int intvalue = rs.getInt(index++); builder.setType(intvalue); long longValue = rs.getLong(index++); builder.setUpdateDt(longValue); longValue = rs.getLong(index++); builder.setCreateDt(longValue); value = rs.getString(index++); value = (value == null ? "" : value); builder.setExtra(value); WFCMessage.GroupMember member = builder.build(); groupMembers.put(groupId, member); } return groupMembers.get(groupId); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return new ArrayList<>(); } void reloadFriendsFromDB(HazelcastInstance hzInstance) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; MultiMap friendsMap = hzInstance.getMultiMap(MemoryMessagesStore.USER_FRIENDS); if (friendsMap.size() > 0) { return; } try { connection = DBUtil.getConnection(); String sql = "select `_uid`, `_friend_uid`, `_alias`, `_state`, `_blacked`, `_dt`, `_extra` from t_friend"; statement = connection.prepareStatement(sql); int index; rs = statement.executeQuery(); while (rs.next()) { FriendData builder = new FriendData(); index = 1; String value = rs.getString(index++); value = (value == null ? "" : value); builder.setUserId(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setFriendUid(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setAlias(value); int intvalue = rs.getInt(index++); builder.setState(intvalue); intvalue = rs.getInt(index++); builder.setBlacked(intvalue); long longvalue = rs.getLong(index++); builder.setTimestamp(longvalue); builder.setExtra(rs.getString(index++)); friendsMap.put(builder.getUserId(), builder); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } } void reloadFriendRequestsFromDB(HazelcastInstance hzInstance) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; MultiMap requestMap = hzInstance.getMultiMap(MemoryMessagesStore.USER_FRIENDS_REQUEST); if (requestMap.size() > 0) { return; } try { connection = DBUtil.getConnection(); String sql = "select `_uid`, `_friend_uid`, `_reason`, `_status`, `_dt`, `_from_read_status`, `_to_read_status`, `_extra` from t_friend_request"; statement = connection.prepareStatement(sql); int index; rs = statement.executeQuery(); while (rs.next()) { WFCMessage.FriendRequest.Builder builder = WFCMessage.FriendRequest.newBuilder(); index = 1; String value = rs.getString(index++); value = (value == null ? "" : value); builder.setFromUid(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setToUid(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setReason(value); int intvalue = rs.getInt(index++); builder.setStatus(intvalue); long longvalue = rs.getLong(index++); builder.setUpdateDt(longvalue); intvalue = rs.getInt(index++); builder.setFromReadStatus(intvalue > 0); intvalue = rs.getInt(index++); builder.setToReadStatus(intvalue > 0); value = rs.getString(index++); value = (value == null ? "" : value); builder.setExtra(value); WFCMessage.FriendRequest request = builder.build(); requestMap.put(request.getFromUid(), request); requestMap.put(request.getToUid(), request); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } } void persistMessage(final WFCMessage.Message message, boolean update) { if(message.getContent().getPersistFlag() == Transparent) { return; } mScheduler.execute(()-> { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String table = MessageShardingUtil.getMessageTable(message.getMessageId()); String sql; if (disableRemoteMessageSearch) { sql = "insert into " + table + " (`_mid`, `_from`, `_type`, `_target`, `_line`, `_data`, `_dt`, `_content_type`, `_to`) values(?, ?, ?, ?, ?, ?, ?, ?, ?)" + " ON DUPLICATE KEY UPDATE " + "`_data` = ?," + "`_dt` = ?," + "`_content_type` = ?"; } else { sql = "insert into " + table + " (`_mid`, `_from`, `_type`, `_target`, `_line`, `_data`, `_searchable_key`, `_dt`, `_content_type`, `_to`) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" + " ON DUPLICATE KEY UPDATE " + "`_data` = ?," + "`_searchable_key` = ?," + "`_dt` = ?," + "`_content_type` = ?"; } String searchableContent = message.getContent().getSearchableContent() == null ? "" : message.getContent().getSearchableContent(); statement = connection.prepareStatement(sql); int index = 1; statement.setLong(index++, message.getMessageId()); statement.setString(index++, message.getFromUser()); statement.setInt(index++, message.getConversation().getType()); statement.setString(index++, message.getConversation().getTarget()); statement.setInt(index++, message.getConversation().getLine()); Blob blob = connection.createBlob(); blob.setBytes(1, encryptMessageContent(message.getContent().toByteArray(), false)); statement.setBlob(index++, blob); if (!disableRemoteMessageSearch) { statement.setString(index++, searchableContent); } statement.setTimestamp(index++, new Timestamp(message.getServerTimestamp())); statement.setInt(index++, message.getContent().getType()); String to = message.getToUser(); if (StringUtil.isNullOrEmpty(message.getToUser())) { if (message.getToList().size() > 0) { to = message.getToList().get(0); } } statement.setString(index++, to); statement.setBlob(index++, blob); if (!disableRemoteMessageSearch) { statement.setString(index++, searchableContent); } statement.setTimestamp(index++, new Timestamp(message.getServerTimestamp())); statement.setInt(index++, message.getContent().getType()); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } byte[] encryptMessageContent(byte[] in, boolean force) { if(in != null && (encryptMessage || force)) { for (int i = 0; i < in.length; i++) { in[i] ^= 0xBD; } } return in; } void persistSensitiveMessage(final WFCMessage.Message message) { if(message.getContent().getPersistFlag() == Transparent) { return; } mScheduler.execute(()-> { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "insert into " + "t_sensitive_messages" + " (`_mid`, `_from`, `_type`, `_target`, `_line`, `_data`, `_searchable_key`, `_dt`, `_content_type`) values(?, ?, ?, ?, ?, ?, ?, ?, ?)" + " ON DUPLICATE KEY UPDATE " + "`_data` = ?," + "`_searchable_key` = ?," + "`_dt` = ?," + "`_content_type` = ?"; String searchableContent = message.getContent().getSearchableContent() == null ? "" : message.getContent().getSearchableContent(); statement = connection.prepareStatement(sql); int index = 1; statement.setLong(index++, message.getMessageId()); statement.setString(index++, message.getFromUser()); statement.setInt(index++, message.getConversation().getType()); statement.setString(index++, message.getConversation().getTarget()); statement.setInt(index++, message.getConversation().getLine()); Blob blob = connection.createBlob(); blob.setBytes(1, encryptMessageContent(message.getContent().toByteArray(), false)); statement.setBlob(index++, blob); statement.setString(index++, searchableContent); statement.setTimestamp(index++, new Timestamp(message.getServerTimestamp())); statement.setInt(index++, message.getContent().getType()); statement.setBlob(index++, blob); statement.setString(index++, searchableContent); statement.setTimestamp(index++, new Timestamp(message.getServerTimestamp())); statement.setInt(index++, message.getContent().getType()); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } Map getMessages(Collection keys) { Map> messageTableMap = new HashMap<>(); for (Long key : keys) { String messageTableId = MessageShardingUtil.getMessageTable(key); messageTableMap.computeIfAbsent(messageTableId, new Function>() { @Override public List apply(String s) { return new ArrayList<>(); } }); messageTableMap.get(messageTableId).add(key); } Map out = null; Connection connection = null; try { connection = DBUtil.getConnection(); out = new HashMap<>(); for (Map.Entry> entry : messageTableMap.entrySet()) { String sql = "select `_mid`, `_from`, `_type`, `_target`, `_line`, `_data`, `_dt` from " + entry.getKey() +" where _mid in ("; for (int i = 0; i < entry.getValue().size(); i++) { sql += entry.getValue().get(i); if (i != entry.getValue().size() - 1) { sql += ","; } } sql += ")"; ResultSet resultSet = null; try { PreparedStatement statement = connection.prepareStatement(sql); resultSet = statement.executeQuery(); while (resultSet.next()) { WFCMessage.Message.Builder builder = WFCMessage.Message.newBuilder(); int index = 1; builder.setMessageId(resultSet.getLong(index++)); builder.setFromUser(resultSet.getString(index++)); WFCMessage.Conversation.Builder cb = WFCMessage.Conversation.newBuilder(); cb.setType(resultSet.getInt(index++)); cb.setTarget(resultSet.getString(index++)); cb.setLine(resultSet.getInt(index++)); builder.setConversation(cb.build()); Blob blob = resultSet.getBlob(index++); WFCMessage.MessageContent messageContent = WFCMessage.MessageContent.parseFrom(encryptMessageContent(toByteArray(blob.getBinaryStream()), false)); builder.setContent(messageContent); builder.setServerTimestamp(resultSet.getTimestamp(index++).getTime()); WFCMessage.Message message = builder.build(); out.put(message.getMessageId(),new MessageBundle(message.getMessageId(), message.getFromUser(), null, message)); } } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } catch (IOException e) { e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { try { if (resultSet!=null) { resultSet.close(); } } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } } } } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, null); } return out; } public byte[] toByteArray(InputStream input) throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); byte[] buffer = new byte[4096]; int n = 0; while (-1 != (n = input.read(buffer))) { output.write(buffer, 0, n); } return output.toByteArray(); } MessageBundle getMessage(long messageId) { String sql = "select `_from`, `_type`, `_target`, `_line`, `_data`, `_dt` from " + MessageShardingUtil.getMessageTable(messageId) +" where _mid = ? order by `_dt` DESC limit 1"; Connection connection = null; PreparedStatement statement = null; ResultSet resultSet = null; try { connection = DBUtil.getConnection(); statement = connection.prepareStatement(sql); statement.setLong(1, messageId); resultSet = statement.executeQuery(); if (resultSet.next()) { WFCMessage.Message.Builder builder = WFCMessage.Message.newBuilder(); builder.setMessageId(messageId); int index = 1; builder.setFromUser(resultSet.getString(index++)); WFCMessage.Conversation.Builder cb = WFCMessage.Conversation.newBuilder(); cb.setType(resultSet.getInt(index++)); cb.setTarget(resultSet.getString(index++)); cb.setLine(resultSet.getInt(index++)); builder.setConversation(cb.build()); Blob blob = resultSet.getBlob(index++); WFCMessage.MessageContent messageContent = WFCMessage.MessageContent.parseFrom(encryptMessageContent(toByteArray(blob.getBinaryStream()), false)); builder.setContent(messageContent); builder.setServerTimestamp(resultSet.getTimestamp(index++).getTime()); WFCMessage.Message message = builder.build(); return new MessageBundle(messageId, message.getFromUser(), null, message); } } catch (SQLException | IOException e) { e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, resultSet); } return null; } void deleteMessage(long messageId) { String sql = "delete from " + MessageShardingUtil.getMessageTable(messageId) + " where _mid = ?"; Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); statement = connection.prepareStatement(sql); statement.setLong(1, messageId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } List loadRemoteMessages(String user, WFCMessage.Conversation conversation, long beforeUid, int count, Collection contentTypes, String channelOwner) { List messages = new ArrayList<>(); long[] before = new long[1]; before[0] = beforeUid; boolean hasMore = loadRemoteMessagesFromTable(user, conversation, before, count, MessageShardingUtil.getMessageTable(beforeUid), messages, contentTypes, channelOwner); while (messages.size() < count && hasMore) { hasMore = loadRemoteMessagesFromTable(user, conversation, before, count - messages.size(), MessageShardingUtil.getMessageTable(beforeUid), messages, contentTypes, channelOwner); } int month = 0; while (messages.size() < count && !DBUtil.IsEmbedDB && month++ < 24) { String nexTable = MessageShardingUtil.getMessageTable(beforeUid, -month); int size = messages.size(); hasMore = true; while (size == messages.size() && hasMore) { hasMore = loadRemoteMessagesFromTable(user, conversation, before, count - messages.size(), nexTable, messages, contentTypes, channelOwner); } if (size < messages.size()) { break; } } return messages; } boolean loadRemoteMessagesFromTable(String user, WFCMessage.Conversation conversation, long[] before, int count, String table, List messages, Collection contentTypes, String channelOwner) { long beforeUid = before[0]; String sql = "select `_mid`, `_from`, `_type`, `_target`, `_line`, `_data`, `_dt`, `_to` from " + table +" where"; if (conversation.getType() == ProtoConstants.ConversationType.ConversationType_Private) { sql += " _type = ? and _line = ? and _mid < ? and ((_target = ? and _from = ?) or (_target = ? and _from = ?)) and (_to = '' or _to = ?)"; } else if (conversation.getType() == ProtoConstants.ConversationType.ConversationType_Channel && !user.equals(channelOwner)) { sql += " _type = ? and _line = ? and _mid < ? and _target = ? and ((_from = ? and (_to = '' or _to = ?)) or (_from = ?))"; } else { sql += " _type = ? and _line = ? and _mid < ? and _target = ?"; } if(contentTypes != null && !contentTypes.isEmpty()) { sql += " and _content_type in ("; boolean first = true; for (int i:contentTypes) { if(first) { first = false; } else { sql += ","; } sql += i; } sql += ")"; } sql += " order by `_mid` DESC limit ?"; Connection connection = null; PreparedStatement statement = null; ResultSet resultSet = null; try { connection = DBUtil.getConnection(); statement = connection.prepareStatement(sql); int index = 1; statement.setInt(index++, conversation.getType()); statement.setInt(index++, conversation.getLine()); statement.setLong(index++, beforeUid); statement.setString(index++, conversation.getTarget()); if (conversation.getType() == ProtoConstants.ConversationType.ConversationType_Private) { statement.setString(index++, user); statement.setString(index++, user); statement.setString(index++, conversation.getTarget()); statement.setString(index++, user); } else if (conversation.getType() == ProtoConstants.ConversationType.ConversationType_Channel && !user.equals(channelOwner)) { statement.setString(index++, channelOwner); statement.setString(index++, user); statement.setString(index++, user); } statement.setInt(index++, count); resultSet = statement.executeQuery(); while (resultSet.next()) { count--; WFCMessage.Message.Builder builder = WFCMessage.Message.newBuilder(); index = 1; builder.setMessageId(resultSet.getLong(index++)); before[0] = builder.getMessageId(); builder.setFromUser(resultSet.getString(index++)); WFCMessage.Conversation.Builder cb = WFCMessage.Conversation.newBuilder(); cb.setType(resultSet.getInt(index++)); cb.setTarget(resultSet.getString(index++)); cb.setLine(resultSet.getInt(index++)); builder.setConversation(cb.build()); Blob blob = resultSet.getBlob(index++); WFCMessage.MessageContent messageContent = WFCMessage.MessageContent.parseFrom(encryptMessageContent(toByteArray(blob.getBinaryStream()), false)); builder.setContent(messageContent); builder.setServerTimestamp(resultSet.getTimestamp(index++).getTime()); String to = resultSet.getString(index++); if (!StringUtil.isNullOrEmpty(to)) { if (to.equals(user) || builder.getFromUser().equals(user)) { builder.setToUser(to); } else { continue; } } WFCMessage.Message message = builder.build(); boolean expired = false; if (message.getContent().getExpireDuration() > 0) { if (System.currentTimeMillis() > message.getServerTimestamp() + message.getContent().getExpireDuration()*1000) { expired = true; } } if (!expired) { boolean duplicated = false; for (WFCMessage.Message msg : messages) { if(message.getMessageId() == msg.getMessageId()) { duplicated = true; break; } } if(!duplicated) { messages.add(message); } } } if (count == 0) { return true; } } catch (SQLException | IOException e) { e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, resultSet); } return false; } void persistUserMessage(final String userId, final String sender, final long messageId, final long messageSeq, int type, String target, int line, boolean directing, final int messageContentType) { mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "insert into " + getUserMessageTable(userId) + " (`_mid`, `_uid`, `_seq`, `_type`, `_target`, `_line`, `_directing`, `_cont_type`) values(?, ?, ?, ?, ?, ?, ?, ?)"; statement = connection.prepareStatement(sql); int index = 1; statement.setLong(index++, messageId); statement.setString(index++, userId); statement.setLong(index++, messageSeq); statement.setInt(index++, type); statement.setString(index++, getPrivateChatUserMessageTarget(type, target, sender)); statement.setInt(index++, line); statement.setInt(index++, directing ? 1 :0); statement.setInt(index++, messageContentType); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } String getPrivateChatUserMessageTarget(int conversationType, String target, String userId) { if(conversationType == ProtoConstants.ConversationType.ConversationType_Private) { return target.compareTo(userId) > 0 ? (userId + "|" + target) : (target + "|" + userId); } else { return target; } } void clearUserMessage(final String userId) { mScheduler.execute(()->{ String tableName = getUserMessageTable(userId); Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "delete from " + tableName + " where _uid = ?"; statement = connection.prepareStatement(sql); statement.setString(1, userId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); try { if (statement!=null) { statement.close(); } statement = null; } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } void removeFavGroup(final String groupId, final List memberIds) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); StringBuilder sb = new StringBuilder("update t_user_setting set _value = ?, _dt = ? where _uid in ("); for (int i = 0; i < memberIds.size(); i++) { sb.append("?"); if (i != memberIds.size() - 1) { sb.append(","); } } sb.append(")"); sb.append(" and _scope in (5,6,26) and _key = ?"); statement = connection.prepareStatement(sb.toString()); int index = 1; statement.setString(index++, "0"); statement.setLong(index++, System.currentTimeMillis()); for (int i = 0; i < memberIds.size(); i++) { statement.setString(index++, memberIds.get(i)); } statement.setString(index++, groupId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } void persistUserSetting(final String userId, WFCMessage.UserSettingEntry entry) { mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "insert into t_user_setting (`_uid`" + ", `_scope`" + ", `_key`" + ", `_value`" + ", `_dt`) values(?, ?, ?, ?, ?)" + " ON DUPLICATE KEY UPDATE " + "`_value` = ?," + "`_dt` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, userId); statement.setInt(index++, entry.getScope()); statement.setString(index++, entry.getKey()); statement.setString(index++, entry.getValue()); statement.setLong(index++, entry.getUpdateDt()); statement.setString(index++, entry.getValue()); statement.setLong(index++, entry.getUpdateDt()); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } void clearUserSetting(final String userId) { mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "delete from t_user_setting where `_uid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, userId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } List getPersistUserSetting(final String userId) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select " + "`_scope`" + ", `_key`" + ", `_value`" + ", `_dt`" + " from t_user_setting where `_uid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, userId); rs = statement.executeQuery(); List out = new ArrayList<>(); while (rs.next()) { WFCMessage.UserSettingEntry.Builder builder = WFCMessage.UserSettingEntry.newBuilder(); index = 1; int intvalue = rs.getInt(index++); builder.setScope(intvalue); String value = rs.getString(index++); value = (value == null ? "" : value); builder.setKey(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setValue(value); long longValue = rs.getLong(index++); builder.setUpdateDt(longValue); out.add(builder.build()); } if (out.isEmpty()) { WFCMessage.UserSettingEntry.Builder builder = WFCMessage.UserSettingEntry.newBuilder().setScope(999).setKey("").setValue("").setUpdateDt(0); out.add(builder.build()); } return out; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } void removeGroupUserSettings(String groupId, List users) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); StringBuilder sb = new StringBuilder("delete from t_user_setting where _scope in (1,3,5,6,7,19) and _uid in ("); for (int i = 0; i < users.size(); i++) { sb.append("?"); if (i != users.size() - 1) { sb.append(","); } } sb.append(") and _key like ?"); statement = connection.prepareStatement(sb.toString()); int index = 1; for (String userId:users) { statement.setString(index++, userId); } statement.setString(index++, "1-_-" + groupId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } void persistGroupInfo(final WFCMessage.GroupInfo groupInfo) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "insert into t_group (`_gid`" + ", `_name`" + ", `_portrait`" + ", `_owner`" + ", `_type`" + ", `_extra`" + ", `_dt`" + ", `_member_count`" + ", `_mute`" + ", `_join_type`" + ", `_private_chat`" + ", `_searchable`" + ", `_deleted`" + ", `_member_dt`) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" + " ON DUPLICATE KEY UPDATE " + "`_name` = ?," + "`_portrait` = ?," + "`_owner` = ?," + "`_type` = ?," + "`_extra` = ?," + "`_dt` = ?," + "`_mute` = ?" + ", `_join_type` = ?" + ", `_private_chat` = ?" + ", `_searchable` = ?" + ", `_deleted` = ?" + ", `_member_dt` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, groupInfo.getTargetId()); statement.setString(index++, groupInfo.getName()); statement.setString(index++, groupInfo.getPortrait()); statement.setString(index++, groupInfo.getOwner()); statement.setInt(index++, groupInfo.getType()); statement.setString(index++, groupInfo.getExtra()); statement.setLong(index++, groupInfo.getUpdateDt() == 0 ? System.currentTimeMillis() : groupInfo.getUpdateDt()); statement.setInt(index++, groupInfo.getMemberCount()); statement.setInt(index++, groupInfo.getMute()); statement.setInt(index++, groupInfo.getJoinType()); statement.setInt(index++, groupInfo.getPrivateChat()); statement.setInt(index++, groupInfo.getSearchable()); statement.setInt(index++, groupInfo.getDeleted()); statement.setLong(index++, groupInfo.getMemberUpdateDt() == 0 ? System.currentTimeMillis() : groupInfo.getUpdateDt()); statement.setString(index++, groupInfo.getName()); statement.setString(index++, groupInfo.getPortrait()); statement.setString(index++, groupInfo.getOwner()); statement.setInt(index++, groupInfo.getType()); statement.setString(index++, groupInfo.getExtra()); statement.setLong(index++, groupInfo.getUpdateDt() == 0 ? System.currentTimeMillis() : groupInfo.getUpdateDt()); statement.setInt(index++, groupInfo.getMute()); statement.setInt(index++, groupInfo.getJoinType()); statement.setInt(index++, groupInfo.getPrivateChat()); statement.setInt(index++, groupInfo.getSearchable()); statement.setInt(index++, groupInfo.getDeleted()); statement.setLong(index++, groupInfo.getMemberUpdateDt() == 0 ? System.currentTimeMillis() : groupInfo.getUpdateDt()); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } List getUserActivedSessions(String uid) { String sql = "select `_cid`, `_package_name`,`_token`,`_voip_token`,`_secret`,`_db_secret`,`_platform`,`_push_type`,`_device_name`,`_device_version`,`_phone_name`,`_language`,`_carrier_name`, `_dt` from t_user_session where `_uid` = ? and `_deleted` = 0"; Connection connection = null; PreparedStatement statement = null; List result = new ArrayList<>(); ResultSet resultSet = null; try { connection = DBUtil.getConnection(); statement = connection.prepareStatement(sql); statement.setString(1, uid); resultSet = statement.executeQuery(); while (resultSet.next()) { int index = 1; String cid = resultSet.getString(index++); ClientSession clientSession = new ClientSession(cid, Server.getServer().getStore().sessionsStore()); MemorySessionStore.Session session = new MemorySessionStore.Session(uid, cid, clientSession); session.setAppName(resultSet.getString(index++)); session.setDeviceToken(resultSet.getString(index++)); session.setVoipDeviceToken(resultSet.getString(index++)); session.setSecret(resultSet.getString(index++)); session.setDbSecret(resultSet.getString(index++)); session.setPlatform(resultSet.getInt(index++)); session.setPushType(resultSet.getInt(index++)); session.setDeviceName(resultSet.getString(index++)); session.setDeviceVersion(resultSet.getString(index++)); session.setPhoneName(resultSet.getString(index++)); session.setLanguage(resultSet.getString(index++)); session.setCarrierName(resultSet.getString(index++)); session.setUpdateDt(resultSet.getLong(index++)); result.add(session); } } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, resultSet); } return result; } void clearUserSessions(String uid) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "delete from t_user_session where `_uid`=?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, uid); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } MemorySessionStore.Session getSession(String uid, String clientId, ClientSession clientSession) { String sql = "select `_package_name`,`_token`,`_voip_token`,`_secret`,`_db_secret`,`_platform`,`_push_type`,`_device_name`,`_device_version`,`_phone_name`,`_language`,`_carrier_name`, `_dt`, `_deleted` from t_user_session where `_uid` = ? and `_cid` = ? limit 1"; Connection connection = null; PreparedStatement statement = null; ResultSet resultSet = null; try { connection = DBUtil.getConnection(); statement = connection.prepareStatement(sql); statement.setString(1, uid); statement.setString(2, clientId); resultSet = statement.executeQuery(); if (resultSet.next()) { MemorySessionStore.Session session = new MemorySessionStore.Session(uid, clientId, clientSession); int index = 1; session.setAppName(resultSet.getString(index++)); session.setDeviceToken(resultSet.getString(index++)); session.setVoipDeviceToken(resultSet.getString(index++)); session.setSecret(resultSet.getString(index++)); session.setDbSecret(resultSet.getString(index++)); session.setPlatform(resultSet.getInt(index++)); session.setPushType(resultSet.getInt(index++)); session.setDeviceName(resultSet.getString(index++)); session.setDeviceVersion(resultSet.getString(index++)); session.setPhoneName(resultSet.getString(index++)); session.setLanguage(resultSet.getString(index++)); session.setCarrierName(resultSet.getString(index++)); session.setUpdateDt(resultSet.getLong(index++)); session.setDeleted(resultSet.getInt(index)); return session; } } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, resultSet); } return null; } void clearOtherSessionToken(String cid, String token, int pushType, boolean voipToken) { if (voipToken) { return; } Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "update t_user_session set `_token` = ?, `_dt` = ? where `_token` = ? and `_push_type` = ? and `_cid` <> ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, ""); statement.setLong(index++, System.currentTimeMillis()); statement.setString(index++, token); statement.setInt(index++, pushType); statement.setString(index++, cid); int c = statement.executeUpdate(); LOG.info("Update rows {}", c); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } void updateSessionToken(String uid, String cid, String token, int pushType, boolean voipToken) { mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; clearOtherSessionToken(cid, token, pushType, voipToken); try { connection = DBUtil.getConnection(); String sql ; if (voipToken) { sql = "update t_user_session set `_voip_token` = ?, `_dt` = ? where `_uid` = ? and `_cid` = ?"; } else { sql = "update t_user_session set `_token` = ?, `_push_type` = ?, `_dt` = ? where `_uid` = ? and `_cid` = ?"; } statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, token); if (!voipToken) { statement.setInt(index++, pushType); } statement.setLong(index++, System.currentTimeMillis()); statement.setString(index++, uid); statement.setString(index++, cid); int c = statement.executeUpdate(); LOG.info("Update rows {}", c); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } void updateSessionDeleted(String uid, String cid, int deleted) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "update t_user_session set `_deleted` = ? where `_uid` = ? and `_cid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setInt(index++, deleted); statement.setString(index++, uid); statement.setString(index++, cid); int c = statement.executeUpdate(); LOG.info("Update rows {}", c); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } void updateSessionPlatform(String uid, String cid, int platform) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "update t_user_session set `_platform` = ? where `_uid` = ? and `_cid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setInt(index++, platform); statement.setString(index++, uid); statement.setString(index++, cid); int c = statement.executeUpdate(); LOG.info("Update rows {}", c); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } private boolean strEqual(String left, String right) { if (left == right) return true; if (left == null) return false; return left.equals(right); } void updateSession(String uid, String cid, MemorySessionStore.Session session, WFCMessage.RouteRequest request) { mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "update t_user_session set"; if (!strEqual(session.getAppName(), request.getApp())) { sql += " `_package_name` = ?,"; } if (!strEqual(session.getDeviceName(), request.getDeviceName())) { sql += " `_device_name` = ?,"; } if (!strEqual(session.getDeviceVersion(), request.getDeviceVersion())) { sql += " `_device_version` = ?,"; } if (!strEqual(session.getPhoneName(), request.getPhoneName())) { sql += " `_phone_name` = ?,"; } if (!strEqual(session.getLanguage(), request.getLanguage())) { sql += " `_language` = ?,"; } if (!strEqual(session.getCarrierName(), request.getCarrierName())) { sql += " `_carrier_name` = ?,"; } sql += " `_dt` = ?"; sql += " where `_uid` = ? and `_cid` = ?"; statement = connection.prepareStatement(sql); int index = 1; if (!strEqual(session.getAppName(), request.getApp())) { statement.setString(index++, request.getApp()); } if (!strEqual(session.getDeviceName(), request.getDeviceName())) { statement.setString(index++, request.getDeviceName()); } if (!strEqual(session.getDeviceVersion(), request.getDeviceVersion())) { statement.setString(index++, request.getDeviceVersion()); } if (!strEqual(session.getPhoneName(), request.getPhoneName())) { statement.setString(index++, request.getPhoneName()); } if (!strEqual(session.getLanguage(), request.getLanguage())) { statement.setString(index++, request.getLanguage()); } if (!strEqual(session.getCarrierName(), request.getCarrierName())) { statement.setString(index++, request.getCarrierName()); } statement.setLong(index++, System.currentTimeMillis()); statement.setString(index++, uid); statement.setString(index++, cid); int c = statement.executeUpdate(); LOG.info("Update rows {}", c); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } void updateSessionIp(String uid, String cid, String ip) { mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "update t_user_session set _ip = ? where `_uid` = ? and `_cid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, ip); statement.setString(index++, uid); statement.setString(index++, cid); int c = statement.executeUpdate(); LOG.info("Update rows {}", c); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } void clearMultiEndpoint(String uid, String clientId, int platform) { LOG.info("clearMultiEndpoint {}, {}", uid, clientId); Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql; if (platform == ProtoConstants.Platform.Platform_Windows || platform == ProtoConstants.Platform.Platform_OSX || platform == ProtoConstants.Platform.Platform_LINUX || platform == ProtoConstants.Platform.Platform_HarmonyPC) { sql = "update t_user_session set `_deleted` = ?, `_token` = ?, `_voip_token` = ?, `_dt` = ? where `_uid`=? and (`_platform` = ? or `_platform` = ? or `_platform` = ? or `_platform` = ?) and `_cid` <> ? and `_deleted` = 0"; } else if(platform == ProtoConstants.Platform.Platform_iOS || platform == ProtoConstants.Platform.Platform_Android || platform == ProtoConstants.Platform.Platform_Harmony) { sql = "update t_user_session set `_deleted` = ?, `_token` = ?, `_voip_token` = ?, `_dt` = ? where `_uid`=? and (`_platform` = ? or `_platform` = ? or `_platform` = ?) and `_cid` <> ? and `_deleted` = 0"; } else if(platform == ProtoConstants.Platform.Platform_iPad || platform == ProtoConstants.Platform.Platform_APad || platform == ProtoConstants.Platform.Platform_HarmonyPad) { sql = "update t_user_session set `_deleted` = ?, `_token` = ?, `_voip_token` = ?, `_dt` = ? where `_uid`=? and (`_platform` = ? or `_platform` = ? or `_platform` = ?) and `_cid` <> ? and `_deleted` = 0"; } else if(platform == ProtoConstants.Platform.Platform_AndroidWearable || platform == ProtoConstants.Platform.Platform_HarmonyWearable) { sql = "update t_user_session set `_deleted` = ?, `_token` = ?, `_voip_token` = ?, `_dt` = ? where `_uid`=? and (`_platform` = ? or `_platform` = ?) and `_cid` <> ? and `_deleted` = 0"; } else if(platform == ProtoConstants.Platform.Platform_AndroidTV || platform == ProtoConstants.Platform.Platform_AppleTV || platform == ProtoConstants.Platform.Platform_HarmonyTV) { sql = "update t_user_session set `_deleted` = ?, `_token` = ?, `_voip_token` = ?, `_dt` = ? where `_uid`=? and (`_platform` = ? or `_platform` = ? or `_platform` = ?) and `_cid` <> ? and `_deleted` = 0"; } else { sql = "update t_user_session set `_deleted` = ?, `_token` = ?, `_voip_token` = ?, `_dt` = ? where `_uid`=? and `_platform` = ? and `_cid` <> ? and `_deleted` = 0"; } statement = connection.prepareStatement(sql); int index = 1; statement.setInt(index++, 1); statement.setString(index++, ""); statement.setString(index++, ""); statement.setLong(index++, System.currentTimeMillis()); statement.setString(index++, uid); if (platform == ProtoConstants.Platform.Platform_Windows || platform == ProtoConstants.Platform.Platform_OSX || platform == ProtoConstants.Platform.Platform_LINUX || platform == ProtoConstants.Platform.Platform_HarmonyPC) { statement.setInt(index++, ProtoConstants.Platform.Platform_Windows); statement.setInt(index++, ProtoConstants.Platform.Platform_OSX); statement.setInt(index++, ProtoConstants.Platform.Platform_LINUX); statement.setInt(index++, ProtoConstants.Platform.Platform_HarmonyPC); } else if(platform == ProtoConstants.Platform.Platform_iOS || platform == ProtoConstants.Platform.Platform_Android || platform == ProtoConstants.Platform.Platform_Harmony) { statement.setInt(index++, ProtoConstants.Platform.Platform_iOS); statement.setInt(index++, ProtoConstants.Platform.Platform_Android); statement.setInt(index++, ProtoConstants.Platform.Platform_Harmony); } else if(platform == ProtoConstants.Platform.Platform_iPad || platform == ProtoConstants.Platform.Platform_APad || platform == ProtoConstants.Platform.Platform_HarmonyPad) { statement.setInt(index++, ProtoConstants.Platform.Platform_iPad); statement.setInt(index++, ProtoConstants.Platform.Platform_APad); statement.setInt(index++, ProtoConstants.Platform.Platform_HarmonyPad); } else if(platform == ProtoConstants.Platform.Platform_AndroidWearable || platform == ProtoConstants.Platform.Platform_HarmonyWearable) { statement.setInt(index++, ProtoConstants.Platform.Platform_AndroidWearable); statement.setInt(index++, ProtoConstants.Platform.Platform_HarmonyWearable); } else if(platform == ProtoConstants.Platform.Platform_AndroidTV || platform == ProtoConstants.Platform.Platform_AppleTV || platform == ProtoConstants.Platform.Platform_HarmonyTV) { statement.setInt(index++, ProtoConstants.Platform.Platform_AndroidTV); statement.setInt(index++, ProtoConstants.Platform.Platform_AppleTV); statement.setInt(index++, ProtoConstants.Platform.Platform_HarmonyTV); } else { statement.setInt(index++, platform); } statement.setString(index++, clientId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } void clearMultiUser(String uid, String clientId) { long start = System.currentTimeMillis(); LOG.info("clearMultiUser {}, {}", uid, clientId); Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "update t_user_session set _deleted = ?, _token = ?, _voip_token = ?, _dt = ? where _cid = ? and _uid <> ? and _deleted = 0"; statement = connection.prepareStatement(sql); int index = 1; statement.setInt(index++, 1); statement.setString(index++, ""); statement.setString(index++, ""); statement.setLong(index++, System.currentTimeMillis()); statement.setString(index++, clientId); statement.setString(index++, uid); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } MemorySessionStore.Session createSession(String uid, String clientId, ClientSession clientSession, int platform) { Connection connection = null; PreparedStatement statement = null; LOG.info("Database create session {},{}", uid, clientId); try { connection = DBUtil.getConnection(); String sql = "insert into t_user_session (`_uid`,`_cid`,`_platform`,`_secret`,`_db_secret`, `_dt`) values (?,?,?,?,?,?)"; statement = connection.prepareStatement(sql); int index = 1; MemorySessionStore.Session session = new MemorySessionStore.Session(uid, clientId, clientSession); session.setPlatform(platform); statement.setString(index++, uid); statement.setString(index++, clientId); statement.setInt(index++, platform); session.setSecret(UUID.randomUUID().toString()); statement.setString(index++, session.getSecret()); session.setDbSecret(UUID.randomUUID().toString()); statement.setString(index++, session.getDbSecret()); statement.setLong(index++, System.currentTimeMillis()); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); return session; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } return null; } Set getUserGroupIds(String userId) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_gid` from t_group_member where `_mid` = ? and `_type` <> 4"; statement = connection.prepareStatement(sql); statement.setString(1, userId); rs = statement.executeQuery(); Set out = new HashSet<>(); while (rs.next()) { String uid = rs.getString(1); out.add(uid); } return out; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } Set getUserGroupIds(String userId, List memberTypes) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select _gid from t_group_member where _mid = ? "; if(!memberTypes.isEmpty()) { sql += " and _type in ("; for (int i = 0; i < memberTypes.size(); i++) { if(i > 0) { sql += ","; } sql += memberTypes.get(i); } sql += ")"; } statement = connection.prepareStatement(sql); statement.setString(1, userId); rs = statement.executeQuery(); Set out = new HashSet<>(); while (rs.next()) { String uid = rs.getString(1); out.add(uid); } return out; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } Set getCommonGroupIds(String userId1, String userId2) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select t1._gid from t_group_member t1, t_group_member t2 where t1._mid = ? and t2._mid = ? and t1._type <> 4 and t2._type <> 4 and t1._gid = t2._gid"; statement = connection.prepareStatement(sql); statement.setString(1, userId1); statement.setString(2, userId2); rs = statement.executeQuery(); Set out = new HashSet<>(); while (rs.next()) { String uid = rs.getString(1); out.add(uid); } return out; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } void updateGroupMemberDt(final String groupId, final long dt) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "update t_group set `_member_dt` = ?, `_dt` = ? where `_gid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setLong(index++, dt); statement.setLong(index++, dt); statement.setString(index++, groupId); int c = statement.executeUpdate(); LOG.info("Update rows {}", c); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } void updateGroupMemberCountDt(final String groupId) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "update t_group set `_member_count` = (select count(*) from t_group_member where `_gid` = ? and `_type` <> 4 limit 1), `_dt` = ?, `_member_dt` = `_member_dt` + 1 where `_gid` = ?"; statement = connection.prepareStatement(sql); statement.setString(1, groupId); statement.setLong(2, System.currentTimeMillis()); statement.setString(3, groupId); int c = statement.executeUpdate(); LOG.info("Update rows {}", c); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } void persistGroupMember(final String groupId, final List memberList, boolean updateCreateTime) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); connection.setAutoCommit(false); String sql = "insert into t_group_member (`_gid`" + ", `_mid`" + ", `_alias`" + ", `_type`" + ", `_dt`, `_create_dt`, `_extra`) values(?, ?, ?, ?, ?, ?,?)" + " ON DUPLICATE KEY UPDATE " + "`_alias` = ?," + "`_type` = ?," + "`_dt` = ?," + "`_extra` = ?"; if(updateCreateTime) { sql += ", `_create_dt` = ?"; } statement = connection.prepareStatement(sql); for (WFCMessage.GroupMember member : memberList ) { int index = 1; long dt = System.currentTimeMillis(); if (member.getUpdateDt() > 0) { dt = member.getUpdateDt(); } statement.setString(index++, groupId); statement.setString(index++, member.getMemberId()); statement.setString(index++, member.getAlias()); statement.setInt(index++, member.getType()); statement.setLong(index++, dt); statement.setLong(index++, member.getCreateDt()); statement.setString(index++, member.getExtra()); statement.setString(index++, member.getAlias()); statement.setInt(index++, member.getType()); statement.setLong(index++, dt); statement.setString(index++, member.getExtra()); if(updateCreateTime) { statement.setLong(index++, dt); } int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { if (connection != null) { try { connection.commit(); connection.setAutoCommit(true); } catch (SQLException e1) { e1.printStackTrace(); } } DBUtil.closeDB(connection, statement); } } int removeGroupMember(String groupId, List groupMembers) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); StringBuilder sqlBuilder = new StringBuilder("update t_group_member set `_type` = ?, `_dt` = ? where `_mid` in ("); for (int i = 0; i < groupMembers.size(); i++) { sqlBuilder.append("?"); if (i != groupMembers.size()-1) { sqlBuilder.append(","); } } sqlBuilder.append(")"); sqlBuilder.append(" and _gid = ?"); statement = connection.prepareStatement(sqlBuilder.toString()); int index = 1; long current = System.currentTimeMillis(); statement.setInt(index++, ProtoConstants.GroupMemberType.GroupMemberType_Removed); statement.setLong(index++, current); for (String memberId:groupMembers) { statement.setString(index++, memberId); } statement.setString(index++, groupId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } return 0; } WFCMessage.GroupInfo getPersistGroupInfo(String groupId) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_name`" + ", `_portrait`" + ", `_owner`" + ", `_type`" + ", `_extra`" + ", `_dt`" + ", `_member_count`" + ", `_member_dt`" + ", `_mute`" + ", `_join_type`" + ", `_private_chat`" + ", `_searchable`" + ", _deleted" + " from t_group where `_gid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, groupId); rs = statement.executeQuery(); if (rs.next()) { String strValue; int intValue; WFCMessage.GroupInfo.Builder builder = WFCMessage.GroupInfo.newBuilder(); index = 1; builder.setTargetId(groupId); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setName(strValue); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setPortrait(strValue); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setOwner(strValue); intValue = rs.getInt(index++); builder.setType(intValue); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setExtra(strValue); long longValue = rs.getLong(index++); builder.setUpdateDt(longValue); intValue = rs.getInt(index++); builder.setMemberCount(intValue); longValue = rs.getLong(index++); builder.setMemberUpdateDt(longValue); intValue = rs.getInt(index++); builder.setMute(intValue); intValue = rs.getInt(index++); builder.setJoinType(intValue); intValue = rs.getInt(index++); builder.setPrivateChat(intValue); intValue = rs.getInt(index++); builder.setSearchable(intValue); intValue = rs.getInt(index++); builder.setDeleted(intValue); return builder.build(); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } void updateChatroomInfo(String chatroomId, WFCMessage.ChatroomInfo chatroomInfo) { LOG.info("Database update chatroom info {}", chatroomId); mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "insert into t_chatroom (`_cid`" + ", `_title`" + ", `_portrait`" + ", `_state`" + ", `_desc`" + ", `_extra`" + ", `_dt`) values(?, ?, ?, ?, ?, ?, ?)" + " ON DUPLICATE KEY UPDATE `_title`=?" + ", `_portrait`=?" + ", `_state`=?" + ", `_desc`=?" + ", `_extra`=?" + ", `_dt`=?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, chatroomId); statement.setString(index++, chatroomInfo.getTitle()); statement.setString(index++, chatroomInfo.getPortrait()); statement.setInt(index++, chatroomInfo.getState()); statement.setString(index++, chatroomInfo.getDesc()); statement.setString(index++, chatroomInfo.getExtra()); statement.setLong(index++, chatroomInfo.getUpdateDt() == 0 ? System.currentTimeMillis() : chatroomInfo.getUpdateDt()); statement.setString(index++, chatroomInfo.getTitle()); statement.setString(index++, chatroomInfo.getPortrait()); statement.setInt(index++, chatroomInfo.getState()); statement.setString(index++, chatroomInfo.getDesc()); statement.setString(index++, chatroomInfo.getExtra()); statement.setLong(index++, chatroomInfo.getUpdateDt() == 0 ? System.currentTimeMillis() : chatroomInfo.getUpdateDt()); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } void removeChatroomInfo(String chatroomId) { LOG.info("Database remove chatroom {}", chatroomId); mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "delete from t_chatroom where `_cid`=?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, chatroomId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } WFCMessage.ChatroomInfo getPersistChatroomInfo(String chatroomId) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_title`" + ", `_portrait`" + ", `_state`" + ", `_desc`" + ", `_extra`" + ", `_dt`" + " from t_chatroom where `_cid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, chatroomId); rs = statement.executeQuery(); if (rs.next()) { String strValue; int intValue; WFCMessage.ChatroomInfo.Builder builder = WFCMessage.ChatroomInfo.newBuilder(); index = 1; strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setTitle(strValue); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setPortrait(strValue); intValue = rs.getInt(index++); builder.setState(intValue); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setDesc(strValue); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setExtra(strValue); long longValue = rs.getLong(index++); builder.setUpdateDt(longValue); builder.setCreateDt(longValue); return builder.build(); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } void updateUserPassword(final String userId, final String password) { mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "update t_user set `_passwd_md5` = ? where `_uid` = ?"; statement = connection.prepareStatement(sql); int index = 1; try { MessageDigest md5 = MessageDigest.getInstance("MD5"); String passwdMd5 = Base64.getEncoder().encodeToString(md5.digest(password.getBytes("utf-8"))); statement.setString(index, passwdMd5); } catch (Exception e) { statement.setString(index, ""); } index++; statement.setString(index++, userId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } void deleteUser(final String userId) { mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "delete from t_user where `_uid`=?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, userId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } void deleteRobot(String robotId) { mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "delete from t_robot where `_uid`=?"; statement = connection.prepareStatement(sql); statement.setString(1, robotId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } WFCMessage.Robot getRobot(String robotId) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_owner`" + ", `_secret`" + ", `_callback`" + ", `_state`" + ", `_extra`" + ", `_dt` from t_robot where `_uid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(1, robotId); rs = statement.executeQuery(); if (rs.next()) { WFCMessage.Robot.Builder builder = WFCMessage.Robot.newBuilder(); index = 1; String value = rs.getString(index++); value = (value == null ? "" : value); builder.setUid(robotId); builder.setOwner(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setSecret(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setCallback(value); int state = rs.getInt(index++); builder.setState(state); value = rs.getString(index++); value = (value == null ? "" : value); builder.setExtra(value); long longValue = rs.getLong(index++); return builder.build(); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } void updateRobot(final WFCMessage.Robot robot) { LOG.info("Database update user info {}", robot.getUid()); mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "insert into t_robot (`_uid`" + ", `_owner`" + ", `_secret`" + ", `_callback`" + ", `_state`" + ", `_extra`" + ", `_dt`) values(?, ?, ?, ?, ?, ?, ?)" + " ON DUPLICATE KEY UPDATE `_owner`=?" + ", `_secret`=?" + ", `_callback`=?" + ", `_state`=?" + ", `_extra`=?" + ", `_dt`=?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, robot.getUid()); statement.setString(index++, robot.getOwner()); statement.setString(index++, robot.getSecret()); statement.setString(index++, robot.getCallback()); statement.setInt(index++, robot.getState()); statement.setString(index++, robot.getExtra()); statement.setLong(index++, System.currentTimeMillis()); statement.setString(index++, robot.getOwner()); statement.setString(index++, robot.getSecret()); statement.setString(index++, robot.getCallback()); statement.setInt(index++, robot.getState()); statement.setString(index++, robot.getExtra()); statement.setLong(index++, System.currentTimeMillis()); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } boolean isUidAndNameConflict(String uid, String name) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; long start = System.currentTimeMillis(); try { connection = DBUtil.getConnection(); String sql = "select _uid from t_user where _name = ? and _uid <> ? limit 1"; statement = connection.prepareStatement(sql); statement.setString(1, name); statement.setString(2, uid); rs = statement.executeQuery(); if (rs.next()) { String conflictId = rs.getString(1); LOG.error("user {} already have name {} !!!", conflictId, name); return true; } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return false; } void updateUser(final WFCMessage.User user) throws Exception { LOG.info("Database update user info {} {}", user.getUid(), user.getUpdateDt()); Connection connection = null; PreparedStatement statement = null; LOG.info("Database update user info {}", user.getDisplayName()); try { connection = DBUtil.getConnection(); String sql = "insert into t_user (`_uid`" + ", `_name`" + ", `_display_name`" + ", `_portrait`" + ", `_mobile`" + ", `_gender`" + ", `_email`" + ", `_address`" + ", `_company`" + ", `_social`" + ", `_extra`" + ", `_type`" + ", `_dt`) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" + " ON DUPLICATE KEY UPDATE `_name`=?" + ", `_display_name`=?" + ", `_portrait`=?" + ", `_mobile`=?" + ", `_gender`=?" + ", `_email`=?" + ", `_address`=?" + ", `_company`=?" + ", `_social`=?" + ", `_extra`=?" + ", `_type`=?" + ", `_deleted`=?" + ", `_dt`=?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, user.getUid()); statement.setString(index++, user.getName()); statement.setString(index++, user.getDisplayName()); statement.setString(index++, user.getPortrait()); statement.setString(index++, user.getMobile()); statement.setInt(index++, user.getGender()); statement.setString(index++, user.getEmail()); statement.setString(index++, user.getAddress()); statement.setString(index++, user.getCompany()); statement.setString(index++, user.getSocial()); statement.setString(index++, user.getExtra()); statement.setInt(index++, user.getType()); statement.setLong(index++, user.getUpdateDt() == 0 ? System.currentTimeMillis() : user.getUpdateDt()); statement.setString(index++, user.getName()); statement.setString(index++, user.getDisplayName()); statement.setString(index++, user.getPortrait()); statement.setString(index++, user.getMobile()); statement.setInt(index++, user.getGender()); statement.setString(index++, user.getEmail()); statement.setString(index++, user.getAddress()); statement.setString(index++, user.getCompany()); statement.setString(index++, user.getSocial()); statement.setString(index++, user.getExtra()); statement.setInt(index++, user.getType()); statement.setInt(index++, user.getDeleted()); statement.setLong(index++, user.getUpdateDt() == 0 ? System.currentTimeMillis() : user.getUpdateDt()); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); throw new Exception(e.getMessage()); } finally { DBUtil.closeDB(connection, statement); } } void deleteUserStatus(String userId) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "delete from t_user_status where _uid = ?"; statement = connection.prepareStatement(sql); statement.setString(1, userId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } void updateUserStatus(String userId, int status) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); if (status == 0) { String sql = "delete from t_user_status where _uid = ?"; statement = connection.prepareStatement(sql); statement.setString(1, userId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } else { String sql = "insert into t_user_status (`_uid`, `_status`, `_dt`) values(?,?,?) ON DUPLICATE KEY UPDATE `_status` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, userId); statement.setInt(index++, status); statement.setLong(index++, System.currentTimeMillis()); statement.setInt(index++, status); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } int getGeneratedId() { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "INSERT INTO `t_id_generator` (`id`) VALUES (NULL);"; statement = connection.prepareStatement(sql); if(statement.executeUpdate()> 0) { sql = "SELECT LAST_INSERT_ID()"; try { if (statement!=null) { statement.close(); } } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } statement = connection.prepareStatement(sql); rs = statement.executeQuery(); if (rs.next()) { return rs.getInt(1); } } return -1; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); return -1; } finally { DBUtil.closeDB(connection, statement, rs); } } WFCMessage.User getPersistUser(String userId) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_name`" + ", `_display_name`" + ", `_portrait`" + ", `_mobile`" + ", `_gender`" + ", `_email`" + ", `_address`" + ", `_company`" + ", `_social`" + ", `_extra`" + ", `_type`" + ", `_deleted`" + ", `_dt` from t_user where `_uid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(1, userId); rs = statement.executeQuery(); if (rs.next()) { WFCMessage.User.Builder builder = WFCMessage.User.newBuilder(); index = 1; String value = rs.getString(index++); value = (value == null ? "" : value); builder.setUid(userId); builder.setName(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setDisplayName(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setPortrait(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setMobile(value); int gender = rs.getInt(index++); builder.setGender(gender); value = rs.getString(index++); value = (value == null ? "" : value); builder.setEmail(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setAddress(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setCompany(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setSocial(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setExtra(value); int type = rs.getInt(index++); builder.setType(type); int deleted = rs.getInt(index++); builder.setDeleted(deleted); long longValue = rs.getLong(index++); if(longValue <= 0) longValue = 1; builder.setUpdateDt(longValue); return builder.build(); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } String getUserIdByName(String name) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_uid` from t_user where `_name` = ? limit 1"; statement = connection.prepareStatement(sql); statement.setString(1, name); rs = statement.executeQuery(); if (rs.next()) { return rs.getString(1); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } String getUserIdByMobile(String mobile) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_uid` from t_user where `_mobile` = ? limit 1"; statement = connection.prepareStatement(sql); statement.setString(1, mobile); rs = statement.executeQuery(); if (rs.next()) { return rs.getString(1); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } List getUserInfosByEmail(String email) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; List outList = new ArrayList<>(); try { connection = DBUtil.getConnection(); String sql = "select `_uid`, `_name`" + ", `_display_name`" + ", `_portrait`" + ", `_mobile`" + ", `_gender`" + ", `_email`" + ", `_address`" + ", `_company`" + ", `_social`" + ", `_extra`" + ", `_type`" + ", `_deleted`" + ", `_dt` from t_user where `_deleted` = 0 and `_email` = ?"; statement = connection.prepareStatement(sql); statement.setString(1, email); rs = statement.executeQuery(); while (rs.next()) { WFCMessage.User.Builder builder = WFCMessage.User.newBuilder(); int index = 1; String value = rs.getString(index++); value = (value == null ? "" : value); builder.setUid(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setName(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setDisplayName(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setPortrait(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setMobile(value); int gender = rs.getInt(index++); builder.setGender(gender); value = rs.getString(index++); value = (value == null ? "" : value); builder.setEmail(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setAddress(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setCompany(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setSocial(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setExtra(value); int type = rs.getInt(index++); builder.setType(type); int deleted = rs.getInt(index++); builder.setDeleted(deleted); long longValue = rs.getLong(index++); if(longValue <= 0) longValue = 1; builder.setUpdateDt(longValue); outList.add(builder.build()); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return outList; } List getAllUsers(int count, int offset) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; List outList = new ArrayList<>(); try { connection = DBUtil.getConnection(); String sql = "select `_uid`, `_name`" + ", `_display_name`" + ", `_portrait`" + ", `_mobile`" + ", `_gender`" + ", `_email`" + ", `_address`" + ", `_company`" + ", `_social`" + ", `_extra`" + ", `_type`" + ", `_deleted`" + ", `_dt` from t_user where `_deleted` = 0 order by _createTime limit ? offset ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setInt(1, count); statement.setInt(2, offset); rs = statement.executeQuery(); while (rs.next()) { WFCMessage.User.Builder builder = WFCMessage.User.newBuilder(); index = 1; String value = rs.getString(index++); value = (value == null ? "" : value); builder.setUid(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setName(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setDisplayName(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setPortrait(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setMobile(value); int gender = rs.getInt(index++); builder.setGender(gender); value = rs.getString(index++); value = (value == null ? "" : value); builder.setEmail(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setAddress(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setCompany(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setSocial(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setExtra(value); int type = rs.getInt(index++); builder.setType(type); int deleted = rs.getInt(index++); builder.setDeleted(deleted); long longValue = rs.getLong(index++); if(longValue <= 0) longValue = 1; builder.setUpdateDt(longValue); outList.add(builder.build()); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return outList; } List getUserRobotIds(String userId) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; List outList = new ArrayList<>(); try { connection = DBUtil.getConnection(); String sql = "select _uid from t_robot where _owner = ? and _state = 0"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(1, userId); rs = statement.executeQuery(); while (rs.next()) { outList.add(rs.getString(1)); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return outList; } Set getAllEnds(boolean fromUserTable) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql; if(fromUserTable) { sql = "select distinct(`_uid`) from t_user_session"; } else { sql = "select distinct(`_uid`) from t_user where `_deleted` = 0 and `_type` <> 1 and `_type` <> 2"; } statement = connection.prepareStatement(sql); rs = statement.executeQuery(); Set out = new HashSet<>(); while (rs.next()) { String uid = rs.getString(1); out.add(uid); } return out; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } List getPersistFriends(String userId) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_friend_uid`, `_alias`, `_state`, `_blacked`, `_dt`, `_extra` from t_friend where `_uid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, userId); rs = statement.executeQuery(); List out = new ArrayList<>(); while (rs.next()) { String uid = rs.getString(1); String alias = rs.getString(2); int state = rs.getInt(3); int blacked = rs.getInt(4); long timestamp = rs.getLong(5); String extra = rs.getString(6); FriendData data = new FriendData(userId, uid, alias, extra, state, blacked, timestamp); out.add(data); } return out; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } void removeUserFriend(String userId) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "update t_friend set `_alias` = '', `_state` = 1, `_blacked` = 0, `_dt` = ?, `_extra` = 0 where `_uid` = ? or `_friend_uid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setLong(index++, System.currentTimeMillis()); statement.setString(index++, userId); statement.setString(index++, userId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } void removeUserFriendRequest(String userId) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "delete from t_friend_request where _uid = ? or _friend_uid = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, userId); statement.setString(index++, userId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } List getPersistFriendRequests(String userId) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_uid`" + ", `_friend_uid`" + ", `_reason`" + ", `_status`" + ", `_dt`" + ", `_from_read_status`" + ", `_to_read_status`, `_extra` from t_friend_request where `_uid` = ? UNION ALL " + "select `_uid`" + ", `_friend_uid`" + ", `_reason`" + ", `_status`" + ", `_dt`" + ", `_from_read_status`" + ", `_to_read_status`, `_extra` from t_friend_request where `_friend_uid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, userId); statement.setString(index++, userId); rs = statement.executeQuery(); List out = new ArrayList<>(); while (rs.next()) { WFCMessage.FriendRequest.Builder builder = WFCMessage.FriendRequest.newBuilder(); index = 1; String value = rs.getString(index++); value = (value == null ? "" : value); builder.setFromUid(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setToUid(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setReason(value); int intValue = rs.getInt(index++); builder.setStatus(intValue); long longValue = rs.getLong(index++); builder.setUpdateDt(longValue); boolean b = rs.getBoolean(index++); builder.setFromReadStatus(b); b = rs.getBoolean(index++); builder.setToReadStatus(b); value = rs.getString(index++); value = (value == null ? "" : value); builder.setExtra(value); out.add(builder.build()); } return out; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } void persistFriendRequestUnreadStatus(String userId, long readDt, long updateDt) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "update t_friend_request set `_dt`=? , `_to_read_status`=?" + " where " + "`_friend_uid` = ? and" + "`_dt` <= ? and" + "`_to_read_status` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setLong(index++, updateDt); statement.setBoolean(index++, true); statement.setString(index++, userId); statement.setLong(index++, readDt); statement.setBoolean(index++, false); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } // void persistOrUpdateFriendRequest(final WFCMessage.FriendRequest request) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "insert into t_friend_request (`_uid`, `_friend_uid`, `_reason`, `_status`, `_dt`, `_from_read_status`, `_to_read_status`, `_extra`) values(?, ?, ?, ?, ?, ?, ?, ?)" + " ON DUPLICATE KEY UPDATE " + "`_reason` = ?," + "`_status` = ?," + "`_dt` = ?," + "`_from_read_status` = ?," + "`_to_read_status` = ?," + "`_extra` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, request.getFromUid()); statement.setString(index++, request.getToUid()); statement.setString(index++, request.getReason()); statement.setInt(index++, request.getStatus()); statement.setLong(index++, request.getUpdateDt()); statement.setInt(index++, request.getFromReadStatus() ? 1 : 0); statement.setInt(index++, request.getToReadStatus() ? 1 : 0); statement.setString(index++, request.getExtra()); statement.setString(index++, request.getReason()); statement.setInt(index++, request.getStatus()); statement.setLong(index++, request.getUpdateDt()); statement.setInt(index++, request.getFromReadStatus() ? 1 : 0); statement.setInt(index++, request.getToReadStatus() ? 1 : 0); statement.setString(index++, request.getExtra()); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } void persistOrUpdateFriendData(final FriendData request) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "insert into t_friend (`_uid`, `_friend_uid`, `_alias`, `_state`, `_blacked`, `_dt`, `_extra`) values(?, ?, ?, ?, ?, ?, ?)" + " ON DUPLICATE KEY UPDATE " + "`_alias` = ?," + "`_state` = ?," + "`_blacked` = ?," + "`_dt` = ?," + "`_extra` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, request.getUserId()); statement.setString(index++, request.getFriendUid()); statement.setString(index++, request.getAlias()); statement.setInt(index++, request.getState()); statement.setInt(index++, request.getBlacked()); statement.setLong(index++, request.getTimestamp()); statement.setString(index++, request.getExtra()); statement.setString(index++, request.getAlias()); statement.setInt(index++, request.getState()); statement.setInt(index++, request.getBlacked()); statement.setLong(index++, request.getTimestamp()); statement.setString(index++, request.getExtra()); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } boolean removeGroupInfoFromDB(String groupId) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql; if(keepGroupInfo) { sql = "update t_group set _deleted = 1, _dt = _dt+1, _member_count = 0, _member_dt = _member_dt+1 where _gid = ?"; } else { sql = "delete from t_group where _gid = ?"; } statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, groupId); return statement.executeUpdate() > 0; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } return false; } boolean removeGroupMemberFromDB(String groupId) { Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "delete from t_group_member where _gid = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, groupId); return statement.executeUpdate() > 0; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } return false; } void updateChannelInfo(final WFCMessage.ChannelInfo channelInfo) { LOG.info("Database update channel info {} {}", channelInfo.getTargetId(), channelInfo.getUpdateDt()); Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "insert into t_channel (`_cid`" + ", `_name`" + ", `_portrait`" + ", `_owner`" + ", `_status`" + ", `_desc`" + ", `_extra`" + ", `_secret`" + ", `_callback`" + ", `_automatic`" + ", `_menu`" + ", `_dt`) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)" + " ON DUPLICATE KEY UPDATE `_name`=?" + ", `_portrait`=?" + ", `_owner`=?" + ", `_status`=?" + ", `_desc`=?" + ", `_extra`=?" + ", `_secret`=?" + ", `_callback`=?" + ", `_automatic`=?" + ", `_menu`=?" + ", `_dt`=?"; statement = connection.prepareStatement(sql); WFCMessage.ChannelMenuList.Builder builder = WFCMessage.ChannelMenuList.newBuilder(); if (!channelInfo.getMenuList().isEmpty()) { for (WFCMessage.ChannelMenu menuBtn:channelInfo.getMenuList()) { builder.addMenu(menuBtn); } } byte[] menuBytes = builder.build().toByteArray(); int index = 1; statement.setString(index++, channelInfo.getTargetId()); statement.setString(index++, channelInfo.getName()); statement.setString(index++, channelInfo.getPortrait()); statement.setString(index++, channelInfo.getOwner()); statement.setInt(index++, channelInfo.getStatus()); statement.setString(index++, channelInfo.getDesc()); statement.setString(index++, channelInfo.getExtra()); statement.setString(index++, channelInfo.getSecret()); statement.setString(index++, channelInfo.getCallback()); statement.setInt(index++, channelInfo.getAutomatic()); statement.setBytes(index++, menuBytes); statement.setLong(index++, channelInfo.getUpdateDt() == 0 ? System.currentTimeMillis() : channelInfo.getUpdateDt()); statement.setString(index++, channelInfo.getName()); statement.setString(index++, channelInfo.getPortrait()); statement.setString(index++, channelInfo.getOwner()); statement.setInt(index++, channelInfo.getStatus()); statement.setString(index++, channelInfo.getDesc()); statement.setString(index++, channelInfo.getExtra()); statement.setString(index++, channelInfo.getSecret()); statement.setString(index++, channelInfo.getCallback()); statement.setInt(index++, channelInfo.getAutomatic()); statement.setBytes(index++, menuBytes); statement.setLong(index++, channelInfo.getUpdateDt() == 0 ? System.currentTimeMillis() : channelInfo.getUpdateDt()); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } void removeChannelInfo(final String channelId) { LOG.info("Database remove channel {}", channelId); mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "delete from t_channel where `_cid`=?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, channelId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } WFCMessage.ChannelInfo getPersistChannelInfo(String channelId) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_name`" + ", `_portrait`" + ", `_owner`" + ", `_status`" + ", `_desc`" + ", `_extra`" + ", `_secret`" + ", `_callback`" + ", `_automatic`" + ", `_menu`" + ", `_dt` from t_channel where `_cid` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, channelId); rs = statement.executeQuery(); if (rs.next()) { String strValue; int intValue; WFCMessage.ChannelInfo.Builder builder = WFCMessage.ChannelInfo.newBuilder(); index = 1; builder.setTargetId(channelId); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setName(strValue); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setPortrait(strValue); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setOwner(strValue); intValue = rs.getInt(index++); builder.setStatus(intValue); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setDesc(strValue); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setExtra(strValue); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setSecret(strValue); strValue = rs.getString(index++); strValue = (strValue == null ? "" : strValue); builder.setCallback(strValue); intValue = rs.getInt(index++); builder.setAutomatic(intValue); try { byte[] bytes = null; Blob blob = rs.getBlob(index++); if (blob != null) { bytes = toByteArray(blob.getBinaryStream()); } WFCMessage.ChannelMenuList menuButtonList = WFCMessage.ChannelMenuList.parseFrom(bytes); if (menuButtonList.getMenuCount() > 0) { builder.addAllMenu(menuButtonList.getMenuList()); } } catch (IOException e) { e.printStackTrace(); } long longValue = rs.getLong(index++); builder.setUpdateDt(longValue); return builder.build(); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return null; } void persistChannelListener(final String groupId, final List memberList) { mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); connection.setAutoCommit(false); String sql = "insert into t_channel_listener (`_cid`" + ", `_mid`" + ", `_dt`) values(?, ?, ?)" + " ON DUPLICATE KEY UPDATE " + "`_dt` = ?"; statement = connection.prepareStatement(sql); long dt = System.currentTimeMillis(); for (String member : memberList) { int index = 1; statement.setString(index++, groupId); statement.setString(index++, member); statement.setLong(index++, dt); statement.setLong(index++, dt); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { if (connection != null) { try { connection.commit(); connection.setAutoCommit(true); } catch (SQLException e1) { e1.printStackTrace(); } } DBUtil.closeDB(connection, statement); } }); } List getChannelListener(String channelId) { List out = new ArrayList<>(); Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select `_mid` from t_channel_listener where _cid = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, channelId); rs = statement.executeQuery(); while (rs.next()) { String value = rs.getString(1); if (!StringUtil.isNullOrEmpty(value)) { out.add(value); } } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return out; } List searchChannelFromDB(String keyword, boolean buzzy, int page) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; ArrayList out = new ArrayList<>(); try { connection = DBUtil.getConnection(); String sql = "select `_cid`, `_name`" + ", `_portrait`" + ", `_owner`" + ", `_status`" + ", `_desc`" + ", `_extra`" + ", `_dt` from t_channel"; if (buzzy) { sql += " where `_name` like ? ESCAPE '!' "; } else { sql += " where `_name` = ?"; } sql += " and _status <> 64"; sql += " and _status <> 16"; sql += " and _status <> 17"; sql += " and _status <> 24"; sql += " and _status <> 25"; sql += " limit 20"; if (page > 0) { sql += " offset " + page * 20; } keyword = keyword .replace("!", "!!") .replace("%", "!%") .replace("_", "!_") .replace("[", "!["); statement = connection.prepareStatement(sql); int index = 1; if (buzzy) { statement.setString(index++, "%" + keyword + "%"); } else { statement.setString(index++, keyword); } rs = statement.executeQuery(); while (rs.next()) { WFCMessage.ChannelInfo.Builder builder = WFCMessage.ChannelInfo.newBuilder(); index = 1; String value = rs.getString(index++); value = (value == null ? "" : value); builder.setTargetId(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setName(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setPortrait(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setOwner(value); int status = rs.getInt(index++); builder.setStatus(status); value = rs.getString(index++); value = (value == null ? "" : value); builder.setDesc(value); value = rs.getString(index++); value = (value == null ? "" : value); builder.setExtra(value); long longValue = rs.getLong(index++); builder.setUpdateDt(longValue); out.add(builder.build()); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return out; } void updateChannelListener(final String channelId, final String listener, final boolean listen) { LOG.info("updateChannelListener channel {}, listener {}, listen {}", channelId, listener, listen); Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql; if (listen) { sql = "insert into t_channel_listener (`_cid`" + ", `_mid`" + ", `_dt`) values(?, ?, ?)" + " ON DUPLICATE KEY UPDATE " + "`_dt` = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, channelId); statement.setString(index++, listener); statement.setLong(index++, System.currentTimeMillis()); statement.setLong(index++, System.currentTimeMillis()); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } else { sql = "delete from t_channel_listener where `_cid`=? and `_mid`=?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, channelId); statement.setString(index++, listener); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } List getUserChannels(String userId) { List out = new ArrayList<>(); Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; try { connection = DBUtil.getConnection(); String sql = "select _cid from t_channel_listener where _mid = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setString(index++, userId); rs = statement.executeQuery(); while (rs.next()) { String value = rs.getString(1); if (!StringUtil.isNullOrEmpty(value)) { out.add(value); } } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return out; } void clearChannelListener(final String channelId) { LOG.info("Database remove channel {}", channelId); Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "delete from t_channel_listener where _cid=?"; statement = connection.prepareStatement(sql); statement.setString(1, channelId); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } public Set getSensitiveWord() { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; Set out = new HashSet<>(); try { connection = DBUtil.getConnection(); String sql = "select `_word` from t_sensitiveword order by `id` desc"; statement = connection.prepareStatement(sql); rs = statement.executeQuery(); while (rs.next()) { String value = rs.getString(1); out.add(value); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } return out; } void deleteSensitiveWord(final String word) { LOG.info("delete sensitive word {}", word); mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "delete from t_sensitiveword where `_word` = ?"; statement = connection.prepareStatement(sql); statement.setString(1, word); int c = statement.executeUpdate(); LOG.info("Update rows {}", c); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } void persistSensitiveWord(final String word) { mScheduler.execute(()->{ Connection connection = null; PreparedStatement statement = null; try { connection = DBUtil.getConnection(); String sql = "insert into t_sensitiveword (`_word`) values(?)"; statement = connection.prepareStatement(sql); statement.setString(1, word); int count = statement.executeUpdate(); LOG.info("Update rows {}", count); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } }); } private String getUserMessageTable(String uid) { if (DBUtil.IsEmbedDB) { return "t_user_messages"; } int hashId = Math.abs(uid.hashCode())%128; return "t_user_messages_" + hashId; } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/GroupLoader.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.persistence; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.core.MapLoader; import com.hazelcast.core.MapStore; import io.moquette.server.Server; import java.util.Collection; import java.util.Map; public class GroupLoader implements MapStore { private DatabaseStore getDatabaseStore() { return Server.getServer().getStore().messagesStore().getDatabaseStore(); } /** * Loads the value of a given key. If distributed map doesn't contain the value * for the given key then Hazelcast will call implementation's load (key) method * to obtain the value. Implementation can use any means of loading the given key; * such as an O/R mapping tool, simple SQL or reading a file etc. * * @param key@return value of the key, value cannot be null */ @Override public WFCMessage.GroupInfo load(String key) { return getDatabaseStore().getPersistGroupInfo(key); } /** * Loads given keys. This is batch load operation so that implementation can * optimize the multiple loads. *

* For any key in the input keys, there should be a single mapping in the resulting map. Also the resulting * map should not have any keys that are not part of the input keys. *

* The given collection should not contain any null keys. * The returned Map should not contain any null keys or values. * * @param keys keys of the values entries to load * @return map of loaded key-value pairs. */ @Override public Map loadAll(Collection keys) { return null; } @Override public Iterable loadAllKeys() { return null; } @Override public void store(String key, WFCMessage.GroupInfo value) { getDatabaseStore().persistGroupInfo(value); } @Override public void storeAll(Map map) { for (WFCMessage.GroupInfo value : map.values()) { getDatabaseStore().persistGroupInfo(value); } } @Override public void delete(String key) { getDatabaseStore().removeGroupInfoFromDB(key); } @Override public void deleteAll(Collection keys) { } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/MemoryMessagesStore.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.persistence; import cn.wildfirechat.pojos.*; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.google.protobuf.ByteString; import com.hazelcast.core.*; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.RestResult; import com.xiaoleilu.loServer.action.Action; import com.xiaoleilu.loServer.action.admin.AdminAction; import com.xiaoleilu.loServer.model.FriendData; import cn.wildfirechat.common.ErrorCode; import io.moquette.BrokerConstants; import io.moquette.imhandler.IMHandler; import io.moquette.server.Constants; import io.moquette.server.Server; import io.moquette.spi.IMatchingCondition; import io.moquette.spi.IMessagesStore; import io.moquette.spi.impl.security.AES; import io.moquette.spi.security.Tokenor; import io.moquette.spi.impl.subscriptions.Topic; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.mqtt.MqttVersion; import org.apache.commons.codec.digest.DigestUtils; import org.json.simple.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.*; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import java.util.concurrent.TimeUnit; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.regex.Matcher; import java.util.regex.Pattern; import static cn.wildfirechat.common.IMExceptionEvent.EventType.EVENT_CALLBACK_Exception; import static cn.wildfirechat.proto.ProtoConstants.ChannelState.*; import static cn.wildfirechat.proto.ProtoConstants.ChannelUpdateEventType.*; import static cn.wildfirechat.proto.ProtoConstants.ChatroomMemberUpdateEventType.Chatroom_Member_Event_Join; import static cn.wildfirechat.proto.ProtoConstants.ChatroomMemberUpdateEventType.Chatroom_Member_Event_Leave; import static cn.wildfirechat.proto.ProtoConstants.ChatroomUpdateEventType.Chatroom_Event_Create; import static cn.wildfirechat.proto.ProtoConstants.ChatroomUpdateEventType.Chatroom_Event_Destroy; import static cn.wildfirechat.proto.ProtoConstants.GroupMemberType.*; import static cn.wildfirechat.proto.ProtoConstants.ModifyChannelInfoType.*; import static cn.wildfirechat.proto.ProtoConstants.ModifyGroupInfoType.*; import static cn.wildfirechat.proto.ProtoConstants.PersistFlag.Transparent; import static cn.wildfirechat.proto.ProtoConstants.Platform.*; import static cn.wildfirechat.proto.ProtoConstants.UpdateUserInfoMask.*; import static io.moquette.BrokerConstants.*; import static io.moquette.server.Constants.MAX_CHATROOM_MESSAGE_QUEUE; import static io.moquette.server.Constants.MAX_MESSAGE_QUEUE; import static cn.wildfirechat.pojos.MyInfoType.*; import static win.liyufan.im.UserSettingScope.*; public class MemoryMessagesStore implements IMessagesStore { private static final String MESSAGES_MAP = "messages_map"; private static final String GROUPS_MAP = "groups_map"; static int dumy = 0; static final String GROUP_MEMBERS = "group_members"; private static final String CHATROOM_MEMBER_IDS = "chatroom_members"; private static final String USER_CHATROOM = "user_chatroom"; static final String USER_FRIENDS = "user_friends"; static final String USER_FRIENDS_REQUEST = "user_friends_request"; static final String USERS = "users"; static final String USER_STATUS = "user_status"; private static final String CHATROOMS = "chatrooms"; private static final String USER_SETTING = "user_setting"; private static final String CHANNELS = "channels_map"; private static final String CHANNEL_LISTENERS = "channel_listeners"; private static boolean IS_MESSAGE_ROAMING = true; private static long msgCompensateTimeLimit = 300000; private static boolean IS_MESSAGE_REMOTE_HISTORY_MESSAGE = true; private static boolean IS_CHATROOM_MESSAGE_REMOTE_HISTORY_MESSAGE = true; static final String USER_ROBOTS = "user_robots"; static final String USER_THINGS = "user_things"; static final String ROBOTS = "robots"; static final String THINGS = "things"; private static final Logger LOG = LoggerFactory.getLogger(MemoryMessagesStore.class); private Map m_retainedStore = new HashMap<>(); private final Server m_Server; private Map> userMessages = new HashMap<>(); private Map> chatroomMessages = new HashMap<>(); private ReadWriteLock mLock = new ReentrantReadWriteLock(); private Lock mReadLock = mLock.readLock(); private Lock mWriteLock = mLock.writeLock(); private Lock mUserSettingLock = new ReentrantLock(); private final DatabaseStore databaseStore; private ConcurrentHashMap userMaxPullSeq = new ConcurrentHashMap<>(); private SensitiveFilter mSensitiveFilter; private volatile long lastUpdateSensitiveTime = 0; private ConcurrentHashMap userGlobalSlientMap = new ConcurrentHashMap<>(); private ConcurrentHashMap userVoipSlientMap = new ConcurrentHashMap<>(); private ConcurrentHashMap userPushHiddenDetail = new ConcurrentHashMap<>(); private ConcurrentHashMap userConvSlientMap = new ConcurrentHashMap<>(); private LinkedHashMap repeatFriendRequest = new LinkedHashMap() { @Override protected boolean removeEldestEntry(Map.Entry eldest) { return System.currentTimeMillis() - eldest.getValue() > 5 * 60 * 1000; } }; private boolean mDisableSearch = false; private boolean mDisableNicknameSearch = false; private boolean mDisableUserIdSearch = false; private boolean mDisableFriendRequest = false; private long mFriendRequestDuration = 7 * 24 * 60 * 60 * 1000; private long mFriendRejectDuration = 30 * 24 * 60 * 60 * 1000; private long mFriendRequestExpiration = 7 * 24 * 60 * 60 * 1000; private RateLimiter mFriendRateLimiter; private RateLimiter mFriendSearchEmpthMobileRateLimiter; private RateLimiter mFriendSearchRateLimiter; private boolean mFriendRobotAutoAccept = true; private long mPushExpiredTimes = 604800000L; private Set mForcePushTypes = new HashSet<>(); private boolean mMultiPlatformNotification = false; private boolean mMobileDefaultSilentWhenPCOnline = true; private boolean mDisableStrangerChat = false; private Set mAllowStrangerChatSet = new HashSet<>(); private Set mAllowStrangerLineSet = new HashSet<>(); private boolean mDisableStrangerAddGroup = false; private boolean mGroupAllowPartSuccess = false; private boolean mIDUseUUID = true; private boolean mSensitiveOnlyMessage = true; private Set mClientSignatureSet = new HashSet<>(); private boolean mRejectEmptySignature = true; private long mChatroomParticipantIdleTime = 900000; private boolean mChatroomRejoinWhenActive = true; private boolean mChatroomCreateWhenNotExist = true; private boolean mChatroomKickoffOtherPlatform = true; private List mForbiddenClientSendTypes = new ArrayList<>(); private List mBlackListExceptionTypes = new ArrayList<>(); private List mGroupMuteExceptionTypes = new ArrayList<>(); private List mGlobalMuteExceptionTypes = new ArrayList<>(); private long mRecallTimeLimit = 300; private boolean mDisableGroupManagerRecall = false; private String mGroupInfoUpdateCallback; private String mGroupMemberUpdateCallback; private String mRelationUpdateCallback; private String mUserInfoUpdateCallback; private String mChannelInfoUpdateCallback; private String mChatroomInfoUpdateCallback; private String mChatroomMemberUpdateCallback; private boolean mGroupAllowOwnerRecallSelfMsg = false; private boolean mGroupAllowManagerRecallSelfMsg = false; private boolean mGroupAllowClientCustomOperationNotification; private boolean mGroupAllowRobotCustomOperationNotification; private int mGroupVisibleQuitKickoffNotification; private int mGroupForbiddenClientOperation; private int mSyncDataPartSize = 0; private boolean keepDisplayNameWhenDestroyUser = true; private boolean keepFullInfoWhenDestroyUser = false; private boolean keepMobileWhenDestroyUser = false; private boolean keepMessagesWhenDestroyUser = false; private String mRecallForwardUrl = null; private boolean mBroadcastTargetFromUserTable = false; private boolean mForwardMessageWithClientInfo = false; private boolean mForwardMessageWithSenderInfo = false; private boolean mForwardMessageWithTargetInfo = false; private boolean mRobotCallbackWithClientInfo = false; private boolean mRobotCallbackWithSenderInfo = false; private boolean mRobotCallbackWithTargetInfo = false; private boolean mRobotMentionExternalRobot = false; private int mRobotGetUserInfoMask = 0; private boolean mChannelCallbackWithClientInfo = false; private boolean mChannelCallbackWithSenderInfo = false; private boolean mChannelCallbackWithTargetInfo = false; private boolean mChannelNewCallbackFeature = true; private Set mUserHideProperties = new HashSet<>(); MemoryMessagesStore(Server server, DatabaseStore databaseStore) { m_Server = server; this.databaseStore = databaseStore; IS_MESSAGE_ROAMING = "1".equals(m_Server.getConfig().getProperty(MESSAGE_ROAMING)); try { msgCompensateTimeLimit = Long.parseLong(m_Server.getConfig().getProperty(MESSAGE_Compensate_Time_Limit, "300000")); } catch (NumberFormatException e) { } IS_MESSAGE_REMOTE_HISTORY_MESSAGE = "1".equals(m_Server.getConfig().getProperty(MESSAGE_Remote_History_Message)); IS_CHATROOM_MESSAGE_REMOTE_HISTORY_MESSAGE = "1".equals(m_Server.getConfig().getProperty(MESSAGE_Remote_Chatroom_History_Message, "1")); Constants.MAX_MESSAGE_QUEUE = Integer.parseInt(m_Server.getConfig().getProperty(MESSAGE_Max_Queue)); try { String signatureList = m_Server.getConfig().getProperty(BrokerConstants.CONNECT_CLIENT_SIGNATURE_LIST); if(!StringUtil.isNullOrEmptyAfterTrim(signatureList)) { signatureList = signatureList.replace(",", ","); for (String s : signatureList.split(",")) { mClientSignatureSet.add(s.trim()); } } } catch (Exception e) { e.printStackTrace(); } try { if(!mClientSignatureSet.isEmpty()) { mRejectEmptySignature = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.CONNECT_REJECT_EMPTY_SIGNATURE, "true")); } else { mRejectEmptySignature = false; } } catch (Exception e) { } try { mDisableStrangerChat = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.MESSAGE_Disable_Stranger_Chat)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); printMissConfigLog(MESSAGE_Disable_Stranger_Chat, mDisableStrangerChat + ""); } try { String allowStrangerList = m_Server.getConfig().getProperty(BrokerConstants.MESSAGE_Allow_Stranger_Chat_List); if(!StringUtil.isNullOrEmptyAfterTrim(allowStrangerList)) { allowStrangerList = allowStrangerList.replace(",", ","); for (String s : allowStrangerList.split(",")) { mAllowStrangerChatSet.add(s.trim()); } } } catch (Exception e) { e.printStackTrace(); } try { String allowStrangerList = m_Server.getConfig().getProperty(BrokerConstants.MESSAGE_Allow_Stranger_Line); if(!StringUtil.isNullOrEmptyAfterTrim(allowStrangerList)) { allowStrangerList = allowStrangerList.replace(",", ","); for (String s : allowStrangerList.split(",")) { mAllowStrangerLineSet.add(Integer.parseInt(s.trim())); } } } catch (Exception e) { e.printStackTrace(); } try { String forcePushTypes = m_Server.getConfig().getProperty(BrokerConstants.MESSAGE_Force_Push_Types); if(!StringUtil.isNullOrEmptyAfterTrim(forcePushTypes)) { forcePushTypes = forcePushTypes.replace(",", ","); for (String s : forcePushTypes.split(",")) { int type = Integer.parseInt(s.trim()); if(type > 0) { mForcePushTypes.add(type); } } } } catch (Exception e) { } try { mMultiPlatformNotification = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.SERVER_MULTI_PLATFROM_NOTIFICATION, "false")); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); printMissConfigLog(SERVER_MULTI_PLATFROM_NOTIFICATION, mMultiPlatformNotification + ""); } try { mMobileDefaultSilentWhenPCOnline = Boolean.parseBoolean(m_Server.getConfig().getProperty(SERVER_MOBILE_DEFAULT_SILENT_WHEN_PC_ONLINE, "true")); } catch (Exception e) { e.printStackTrace(); } try { mDisableSearch = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.FRIEND_Disable_Search)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); printMissConfigLog(FRIEND_Disable_Search, mDisableSearch + ""); } try { mDisableNicknameSearch = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.FRIEND_Disable_NickName_Search)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); printMissConfigLog(FRIEND_Disable_NickName_Search, mDisableNicknameSearch + ""); } try { mDisableUserIdSearch = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.FRIEND_Disable_UserId_Search, "false")); } catch (Exception e) { } try { mDisableFriendRequest = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.FRIEND_Disable_Friend_Request)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); printMissConfigLog(FRIEND_Disable_Friend_Request, mDisableFriendRequest + ""); } try { mFriendRequestDuration = Long.parseLong(m_Server.getConfig().getProperty(FRIEND_Repeat_Request_Duration)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); printMissConfigLog(FRIEND_Repeat_Request_Duration, mFriendRequestDuration + ""); } try { mFriendRejectDuration = Long.parseLong(m_Server.getConfig().getProperty(FRIEND_Reject_Request_Duration)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); printMissConfigLog(FRIEND_Reject_Request_Duration, mFriendRejectDuration + ""); } try { mFriendRequestExpiration = Long.parseLong(m_Server.getConfig().getProperty(FRIEND_Request_Expiration_Duration)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); printMissConfigLog(FRIEND_Request_Expiration_Duration, mFriendRequestExpiration + ""); } try { int friendRequestRateLimit = Integer.parseInt(m_Server.getConfig().getProperty(FRIEND_Request_Rate_Limit, "0")); if(friendRequestRateLimit > 0) { mFriendRateLimiter = new RateLimiter(86400, friendRequestRateLimit); } } catch (Exception e) { } try { int rateLimit = Integer.parseInt(m_Server.getConfig().getProperty(FRIEND_Search_Mobile_Empty_Rate_Limit, "0")); if(rateLimit > 0) { mFriendSearchEmpthMobileRateLimiter = new RateLimiter(86400, rateLimit); } } catch (Exception e) { } try { int rateLimit = Integer.parseInt(m_Server.getConfig().getProperty(FRIEND_Search_Rate_Limit, "0")); if(rateLimit > 0) { mFriendSearchRateLimiter = new RateLimiter(86400, rateLimit); } } catch (Exception e) { } try { mFriendRobotAutoAccept = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.FRIEND_Request_Robot_Auto_Accept, "true")); } catch (Exception e) { } try { mPushExpiredTimes = Long.parseLong(m_Server.getConfig().getProperty(BrokerConstants.MESSAGE_Push_Expired_Days, "7")) * 86400000L; if(mPushExpiredTimes == 0) mPushExpiredTimes = Long.MAX_VALUE; } catch (Exception e) { } try { mChatroomRejoinWhenActive = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.CHATROOM_Rejoin_When_Active)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); printMissConfigLog(CHATROOM_Rejoin_When_Active, mChatroomRejoinWhenActive + ""); } try { mChatroomCreateWhenNotExist = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.CHATROOM_Create_When_Not_Exist)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); printMissConfigLog(CHATROOM_Create_When_Not_Exist, mChatroomCreateWhenNotExist + ""); } try { mChatroomKickoffOtherPlatform = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.CHATROOM_Kickoff_Other_Platform, "true")); } catch (Exception e) { } try { mChatroomParticipantIdleTime = Long.parseLong(m_Server.getConfig().getProperty(CHATROOM_Participant_Idle_Time, "900000")); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); printMissConfigLog(CHATROOM_Participant_Idle_Time, mChatroomParticipantIdleTime + ""); } try { boolean disableRemoteMessageSearch = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.MESSAGES_DISABLE_REMOTE_SEARCH, "false")); databaseStore.setDisableRemoteMessageSearch(disableRemoteMessageSearch); } catch (Exception e) { } try { boolean encryptMessage = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.MESSAGES_ENCRYPT_MESSAGE_CONTENT, "false")); databaseStore.setEncryptMessage(encryptMessage); } catch (Exception e) { } try { mRecallTimeLimit = Long.parseLong(m_Server.getConfig().getProperty(BrokerConstants.MESSAGES_RECALL_TIME_LIMIT)); } catch (Exception e) { } try { mDisableGroupManagerRecall = Boolean.parseBoolean(m_Server.getConfig().getProperty(BrokerConstants.MESSAGES_DISABLE_GROUP_MANAGER_RECALL, "false")); } catch (Exception e) { } try { String strTypes = m_Server.getConfig().getProperty(BrokerConstants.MESSAGES_FORBIDDEN_CLIENT_SEND_TYPES); if(!StringUtil.isNullOrEmpty(strTypes)) { for (String strType:strTypes.split(",")) { try { int type = Integer.parseInt(strType); mForbiddenClientSendTypes.add(type); } catch (NumberFormatException e) { } } } } catch (Exception e) { } try { String strTypes = m_Server.getConfig().getProperty(BrokerConstants.MESSAGES_BLACKLIST_EXCEPTION_TYPES); if(!StringUtil.isNullOrEmpty(strTypes)) { for (String strType:strTypes.split(",")) { try { int type = Integer.parseInt(strType); mBlackListExceptionTypes.add(type); } catch (NumberFormatException e) { } } } } catch (Exception e) { } try { String strTypes = m_Server.getConfig().getProperty(BrokerConstants.MESSAGES_GROUP_MUTE_EXCEPTION_TYPES); if(!StringUtil.isNullOrEmpty(strTypes)) { for (String strType:strTypes.split(",")) { try { int type = Integer.parseInt(strType); mGroupMuteExceptionTypes.add(type); } catch (NumberFormatException e) { } } } } catch (Exception e) { } try { String strTypes = m_Server.getConfig().getProperty(BrokerConstants.MESSAGES_GLOBAL_MUTE_EXCEPTION_TYPES); if(!StringUtil.isNullOrEmpty(strTypes)) { for (String strType:strTypes.split(",")) { try { int type = Integer.parseInt(strType); mGlobalMuteExceptionTypes.add(type); } catch (NumberFormatException e) { } } } } catch (Exception e) { } try { mGroupInfoUpdateCallback = server.getConfig().getProperty(GROUP_INFO_UPDATE_CALLBACK); } catch (Exception e) { } try { mGroupMemberUpdateCallback = server.getConfig().getProperty(GROUP_MEMBER_UPDATE_CALLBACK); } catch (Exception e) { } try { mRelationUpdateCallback = server.getConfig().getProperty(RELATION_UPDATE_CALLBACK); } catch (Exception e) { } try { mUserInfoUpdateCallback = server.getConfig().getProperty(USER_INFO_UPDATE_CALLBACK); } catch (Exception e) { } try { mChannelInfoUpdateCallback = server.getConfig().getProperty(CHANNEL_INFO_UPDATE_CALLBACK); } catch (Exception e) { } try { mChatroomInfoUpdateCallback = server.getConfig().getProperty(CHATROOM_INFO_UPDATE_CALLBACK); } catch (Exception e) { } try { mChatroomMemberUpdateCallback = server.getConfig().getProperty(CHATROOM_MEMBER_UPDATE_CALLBACK); } catch (Exception e) { } try { mGroupAllowOwnerRecallSelfMsg = Boolean.parseBoolean(server.getConfig().getProperty(GROUP_Allow_Owner_Recall_Self_Msg, "true")); } catch (Exception e) { } try { mGroupAllowManagerRecallSelfMsg = Boolean.parseBoolean(server.getConfig().getProperty(GROUP_Allow_Manager_Recall_Self_Msg, "false")); } catch (Exception e) { } try { mGroupAllowClientCustomOperationNotification = Boolean.parseBoolean(server.getConfig().getProperty(GROUP_Allow_Client_Custom_Operation_Notification)); } catch (Exception e) { } try { mGroupAllowRobotCustomOperationNotification = Boolean.parseBoolean(server.getConfig().getProperty(GROUP_Allow_Robot_Custom_Operation_Notification)); } catch (Exception e) { } try { mGroupVisibleQuitKickoffNotification = Integer.parseInt(server.getConfig().getProperty(GROUP_Visible_Quit_Kickoff_Notification, "0")); } catch (Exception e) { } try { mDisableStrangerAddGroup = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.GROUP_Disable_Stranger_Invite, "false")); } catch (Exception e) { } try { String s = server.getConfig().getProperty(GROUP_Forbidden_Client_Operation, null); if(!StringUtil.isNullOrEmptyAfterTrim(s)) { s = s.toLowerCase(); if(s.startsWith("0x")) { s = s.substring(2); mGroupForbiddenClientOperation = Integer.parseInt(s, 16); } else { mGroupForbiddenClientOperation = Integer.parseInt(s); } } } catch (NumberFormatException e) { LOG.error("Invalid group.forbidden_client_operation {}", server.getConfig().getProperty(GROUP_Forbidden_Client_Operation, null)); } try { mSyncDataPartSize = Integer.parseInt(server.getConfig().getProperty(SYNC_Data_Part_Size, "0")); } catch (Exception e) { } try { keepDisplayNameWhenDestroyUser = Boolean.parseBoolean(server.getConfig().getProperty(USER_KEEP_DISPLAY_NAME_WHEN_DESTROY, "true")); } catch (Exception e) { } try { keepFullInfoWhenDestroyUser = "true".equals(server.getConfig().getProperty(USER_KEEP_FULL_INFO_WHEN_DESTROY)); } catch (Exception e) {} try { keepMobileWhenDestroyUser = "true".equals(server.getConfig().getProperty(USER_KEEP_MOBILE_WHEN_DESTROY)); } catch (Exception e) {} try { keepMessagesWhenDestroyUser = "true".equals(server.getConfig().getProperty(USER_KEEP_MESSAGES_WHEN_DESTROY)); } catch (Exception e) {} try { String userHideStr = server.getConfig().getProperty(USER_HIDE_PROPERTIES); if(!StringUtil.isNullOrEmpty(userHideStr)) { String[] proStrs = userHideStr.split(","); for (String proStr:proStrs) { int value = Integer.parseInt(proStr); if(value > 1 && value < 9) { mUserHideProperties.add(value); } } } } catch (NumberFormatException e) { e.printStackTrace(); } try { mForwardMessageWithClientInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_With_Client_Info, "false")); } catch (Exception e) {} try { mForwardMessageWithSenderInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_With_Sender_Info, "false")); } catch (Exception e) {} try { mForwardMessageWithTargetInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.MESSAGE_Forward_With_Target_Info, "false")); } catch (Exception e) {} try { mBroadcastTargetFromUserTable = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.BROADCAST_Target_From_User_Table, "false")); } catch (Exception e) { } try { mGroupAllowPartSuccess = "true".equals(server.getConfig().getProperty(BrokerConstants.GROUP_ADD_MEMBER_ALLOW_PART_SUCCESS, "false")); } catch (Exception e) { } try { mRobotCallbackWithClientInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.ROBOT_Callback_With_Client_Info, "false")); } catch (Exception e) {} try { mRobotCallbackWithSenderInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.ROBOT_Callback_With_Sender_Info, "false")); } catch (Exception e) {} try { mRobotCallbackWithTargetInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.ROBOT_Callback_With_Target_Info, "false")); } catch (Exception e) {} try { mRobotMentionExternalRobot = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.ROBOT_Mention_External_Robot, "false")); } catch (Exception e) {} try { mRobotGetUserInfoMask = Integer.parseInt(server.getConfig().getProperty(BrokerConstants.ROBOT_Get_User_Info_Mask, "0")); } catch (Exception e) {} try { mChannelCallbackWithClientInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.CHANNEL_Callback_With_Client_Info, "false")); } catch (Exception e) {} try { mChannelCallbackWithSenderInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.CHANNEL_Callback_With_Sender_Info, "false")); } catch (Exception e) {} try { mChannelCallbackWithTargetInfo = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.CHANNEL_Callback_With_Target_Info, "false")); } catch (Exception e) {} try { mChannelNewCallbackFeature = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.CHANNEL_New_Callback_Feature, "true")); } catch (Exception e) {} try { mRecallForwardUrl = server.getConfig().getProperty(BrokerConstants.MESSAGE_RecallMsg_Forward_Url); } catch (Exception e) { } try { mIDUseUUID = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.ID_USE_UUID, "false")); } catch (Exception e) { } try { mSensitiveOnlyMessage = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.SENSITIVE_Only_Message, "true")); } catch (Exception e) { } } private void printMissConfigLog(String config, String defaultValue) { LOG.info("配置文件中缺少配置项目 {}, 缺省值为 {},可以忽略本提醒,或者更新配置项", config, defaultValue); } @Override public void initStore() { updateSensitiveWord(); } private Collection loadGroupMemberFromDB(HazelcastInstance hzInstance, String groupId) { Collection members = databaseStore.reloadGroupMemberFromDB(hzInstance, groupId); return members; } private void updateSensitiveWord() { long now = System.currentTimeMillis(); if (now - lastUpdateSensitiveTime > 2 * 60 * 60 * 1000) { synchronized (this) { if (now - lastUpdateSensitiveTime > 2 * 60 * 60 * 1000) { lastUpdateSensitiveTime = now; } else { return; } } Set sensitiveWords = databaseStore.getSensitiveWord(); mSensitiveFilter = new SensitiveFilter(sensitiveWords); } } @Override public DatabaseStore getDatabaseStore() { return databaseStore; } @Override public WFCMessage.Message storeMessage(String fromUser, String fromClientId, WFCMessage.Message message) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(MESSAGES_MAP); MessageBundle messageBundle = new MessageBundle(message.getMessageId(), fromUser, fromClientId, message); if (message.getContent().getPersistFlag() == Transparent) { mIMap.put(message.getMessageId(), messageBundle, 10, TimeUnit.SECONDS); } else { mIMap.put(message.getMessageId(), messageBundle, 7, TimeUnit.DAYS); } return message; } @Override public void storeSensitiveMessage(WFCMessage.Message message) { databaseStore.persistSensitiveMessage(message); } @Override public int getNotifyReceivers(String fromUser, WFCMessage.Message.Builder messageBuilder, Set notifyReceivers, ProtoConstants.RequestSourceType requestSourceType) { WFCMessage.Message message = messageBuilder.build(); HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); int type = message.getConversation().getType(); int pullType = ProtoConstants.PullType.Pull_Normal; if (type == ProtoConstants.ConversationType.ConversationType_Private) { if(mRobotMentionExternalRobot && message.getConversation().getTarget().contains("|")) { String[] ss = message.getConversation().getTarget().split("\\|"); notifyReceivers.add(ss[0]); notifyReceivers.add(ss[1]); if(!message.getToList().isEmpty()) { notifyReceivers.addAll(message.getToList()); } else if(!StringUtil.isNullOrEmpty(message.getToUser())) { notifyReceivers.add(message.getToUser()); } } else { notifyReceivers.add(fromUser); if (message.getToCount() > 0) { if (message.getToList().contains(message.getConversation().getTarget())) { notifyReceivers.add(message.getConversation().getTarget()); } } else { notifyReceivers.add(message.getConversation().getTarget()); } } if (mRobotMentionExternalRobot && message.getContent().getMentionedTargetCount() > 0) { for (String mentioned : message.getContent().getMentionedTargetList()) { if (!notifyReceivers.contains(mentioned)) { WFCMessage.User user = getUserInfo(mentioned); if(user != null && user.getType() == ProtoConstants.UserType.UserType_Robot) { notifyReceivers.add(mentioned); } } } } pullType = ProtoConstants.PullType.Pull_Normal; } else if (type == ProtoConstants.ConversationType.ConversationType_Group) { notifyReceivers.add(fromUser); if (!StringUtil.isNullOrEmpty(message.getToUser())) { notifyReceivers.add(message.getToUser()); } else if(message.getToList()!=null && !message.getToList().isEmpty()) { MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(message.getConversation().getTarget()); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, message.getConversation().getTarget()); } for (WFCMessage.GroupMember member : members) { if (member.getType() != GroupMemberType_Removed && message.getToList().contains(member.getMemberId())) { notifyReceivers.add(member.getMemberId()); } } } else { MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(message.getConversation().getTarget()); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, message.getConversation().getTarget()); } for (WFCMessage.GroupMember member : members) { if (member.getType() != GroupMemberType_Removed) { notifyReceivers.add(member.getMemberId()); } } } if (mRobotMentionExternalRobot && message.getContent().getMentionedTargetCount() > 0) { for (String mentioned : message.getContent().getMentionedTargetList()) { if (!notifyReceivers.contains(mentioned)) { WFCMessage.User user = getUserInfo(mentioned); if(user != null && user.getType() == ProtoConstants.UserType.UserType_Robot) { notifyReceivers.add(mentioned); } } } } pullType = ProtoConstants.PullType.Pull_Normal; } else if (type == ProtoConstants.ConversationType.ConversationType_ChatRoom) { boolean isDirect = !StringUtil.isNullOrEmpty(message.getToUser()) || !message.getToList().isEmpty(); Collection entries = getChatroomMembers(message.getConversation().getTarget()); for (UserClientEntry entry : entries) { if (isDirect) { if (entry.userId.equals(message.getToUser())) { notifyReceivers.add(message.getToUser()); break; } if (message.getToList().contains(entry.userId)) { notifyReceivers.add(entry.userId); } } else { notifyReceivers.add(entry.userId); } } pullType = ProtoConstants.PullType.Pull_ChatRoom; } else if(type == ProtoConstants.ConversationType.ConversationType_Channel) { WFCMessage.ChannelInfo channelInfo = getChannelInfo(message.getConversation().getTarget()); if (channelInfo != null) { if (channelInfo.getOwner().equals(fromUser)) { if(requestSourceType == ProtoConstants.RequestSourceType.Request_From_Channel && channelInfo.getAutomatic() != 0 && !isChannelNewCallbackFeature()) { LOG.info("Channel api message not send to the owner when automatic"); } else { notifyReceivers.add(fromUser); } if((channelInfo.getStatus() & ProtoConstants.ChannelState.Channel_State_Mask_Global) > 0) { if((message.getToList() != null && !message.getToList().isEmpty())) { notifyReceivers.addAll(message.getToList()); } else { notifyReceivers.addAll(getAllEnds()); } } else { Collection listeners = getChannelListener(message.getConversation().getTarget()); if (!StringUtil.isNullOrEmpty(message.getToUser())) { if (listeners.contains(message.getToUser()) || (channelInfo.getStatus() & ProtoConstants.ChannelState.Channel_State_Mask_Message_Unsubscribed) > 0) { notifyReceivers.add(message.getToUser()); } } else if (message.getToList() != null && !message.getToList().isEmpty()) { for (String to : message.getToList()) { if (listeners.contains(to) || (channelInfo.getStatus() & ProtoConstants.ChannelState.Channel_State_Mask_Message_Unsubscribed) > 0) { notifyReceivers.add(to); } } } else { notifyReceivers.addAll(listeners); } } } else { notifyReceivers.add(fromUser); if (channelInfo.getAutomatic() == 0 || isChannelNewCallbackFeature()) { notifyReceivers.add(channelInfo.getOwner()); } else { LOG.info("Channel api message not send to the owner when automatic"); } } } else { LOG.error("Channel not exist"); } } // // if (message.getContent().getPersistFlag() == Transparent) { // notifyReceivers.remove(fromUser); // } return pullType; } private final Map unreceivedMsgCount = new ConcurrentHashMap<>(); @Override public void increaseUnreceivedMsgCount(String user) { unreceivedMsgCount.compute(user, (s, integer) -> integer == null ? 1 : integer+1); } @Override public int getUnreceivedMsgCount(String user) { return unreceivedMsgCount.getOrDefault(user, 0); } @Override public Set getAllEnds() { return databaseStore.getAllEnds(mBroadcastTargetFromUserTable); } @Override public WFCMessage.PullMessageResult fetchMessage(String user, String exceptClientId, long fromMessageId, int pullType) { WFCMessage.PullMessageResult.Builder builder = WFCMessage.PullMessageResult.newBuilder(); HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(MESSAGES_MAP); MemorySessionStore.Session session = m_Server.getStore().sessionsStore().getSession(exceptClientId); session.refreshLastActiveTime(); if (pullType != ProtoConstants.PullType.Pull_ChatRoom) { unreceivedMsgCount.put(user, 0); } else { session.refreshLastChatroomActiveTime(); } String chatroomId = null; if (pullType == ProtoConstants.PullType.Pull_ChatRoom) { chatroomId = (String)m_Server.getHazelcastInstance().getMap(USER_CHATROOM).get(user); } long head = fromMessageId; long current = fromMessageId; TreeMap maps; if (pullType != ProtoConstants.PullType.Pull_ChatRoom) { maps = userMessages.get(user); if (maps == null) { loadUserMessages(user); } maps = userMessages.get(user); } else { maps = chatroomMessages.get(user); if (maps == null) { mWriteLock.lock(); try { maps = chatroomMessages.get(user); if (maps == null) { maps = new TreeMap<>(); chatroomMessages.put(user, maps); } } finally { mWriteLock.unlock(); } } } if(fromMessageId == 1) { //lite mode if(maps == null || maps.isEmpty()) { head = 0; } else { head = maps.lastKey(); } builder.setCurrent(head); builder.setHead(head); return builder.build(); } mReadLock.lock(); int size = 0; try { if (pullType != ProtoConstants.PullType.Pull_ChatRoom) { userMaxPullSeq.compute(user, (s, aLong) -> { if (aLong == null || aLong < fromMessageId) { return fromMessageId; } else { return aLong; } }); } boolean noRoaming = false; if (pullType == ProtoConstants.PullType.Pull_Normal && fromMessageId == 0) { if(!IS_MESSAGE_ROAMING) { noRoaming = true; } session.setPullHistoryMsg(true); } long previousCurrent; while (true) { Map.Entry entry = maps.higherEntry(current); if (entry == null) { break; } previousCurrent = current; current = entry.getKey(); long targetMessageId = entry.getValue(); MessageBundle bundle = mIMap.get(targetMessageId); if (bundle != null) { if (exceptClientId == null || session.isPullHistoryMsg() || !exceptClientId.equals(bundle.getFromClientId()) || !user.equals(bundle.getFromUser())) { if (pullType == ProtoConstants.PullType.Pull_ChatRoom) { if (!bundle.getMessage().getConversation().getTarget().equals(chatroomId)) { continue; } } if (noRoaming && (System.currentTimeMillis() - bundle.getMessage().getServerTimestamp() > msgCompensateTimeLimit)) { continue; } if (bundle.getMessage().getContent().getExpireDuration() > 0) { if (System.currentTimeMillis() > bundle.getMessage().getServerTimestamp() + bundle.getMessage().getContent().getExpireDuration()* 1000L) { continue; } } size += bundle.getMessage().getSerializedSize(); if (size >= 512 * 1024) { //3M if(builder.getMessageCount() == 0){ builder.addMessage(bundle.getMessage()); } else { current = previousCurrent; } break; } builder.addMessage(bundle.getMessage()); } } } Map.Entry lastEntry = maps.lastEntry(); if (lastEntry != null) { head = lastEntry.getKey(); } if (pullType == ProtoConstants.PullType.Pull_Normal && current == head) { session.setPullHistoryMsg(false); } } finally { mReadLock.unlock(); } if(current == 0) { current = 2; head = 2; } builder.setCurrent(current); builder.setHead(head); return builder.build(); } @Override public WFCMessage.PullMessageResult loadRemoteMessages(String user, WFCMessage.Conversation conversation, long beforeUid, int count, Collection contentTypes) { WFCMessage.PullMessageResult.Builder builder = WFCMessage.PullMessageResult.newBuilder(); List messages; boolean loadMessage = IS_MESSAGE_REMOTE_HISTORY_MESSAGE; if(conversation.getType() == ProtoConstants.ConversationType.ConversationType_ChatRoom) { loadMessage = IS_CHATROOM_MESSAGE_REMOTE_HISTORY_MESSAGE; } String channelOwner = null; if(conversation.getType() == ProtoConstants.ConversationType.ConversationType_Channel) { IMap mIMap = m_Server.getHazelcastInstance().getMap(CHANNELS); WFCMessage.ChannelInfo info = mIMap.get(conversation.getTarget()); if(info == null) { loadMessage = false; } else { channelOwner = info.getOwner(); } } if (loadMessage) { messages = databaseStore.loadRemoteMessages(user, conversation, beforeUid, count, contentTypes, channelOwner); } else { messages = new ArrayList<>(); } builder.setCurrent(0).setHead(0); if(messages != null) { builder.addAllMessage(messages); } return builder.build(); } public void clearChatroomMembers(String chatroomId) { MultiMap chatroomMembers = m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS); IMap userChatroomMap = m_Server.getHazelcastInstance().getMap(USER_CHATROOM); chatroomMembers.get(chatroomId).forEach(userClientEntry -> { userChatroomMap.remove(userClientEntry.userId); }); chatroomMembers.remove(chatroomId); } @Override public Collection getChatroomMembers(String chatroomId) { MultiMap chatroomMembers = m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS); Collection members = chatroomMembers.get(chatroomId); return members; } @Override public OutputUserChatroom getUserChatroom(String userId) { String chatroomId = (String) m_Server.getHazelcastInstance().getMap(USER_CHATROOM).get(userId); if(chatroomId != null) { MultiMap chatroomMembers = m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS); for (UserClientEntry userClientEntry : chatroomMembers.get(chatroomId)) { if(userClientEntry.userId.equals(userId)) { OutputUserChatroom outputUserChatroom = new OutputUserChatroom(); outputUserChatroom.userId = userId; outputUserChatroom.chatroomId = chatroomId; outputUserChatroom.clientId = userClientEntry.clientId; MemorySessionStore.Session session = m_Server.getStore().sessionsStore().getSession(userClientEntry.clientId); if(session != null) { outputUserChatroom.platform = session.getPlatform(); } return outputUserChatroom; } } } return null; } @Override public WFCMessage.PullMessageResult fetchChatroomMessage(String fromUser, String chatroomId, String exceptClientId, long fromMessageId) { WFCMessage.PullMessageResult.Builder builder = WFCMessage.PullMessageResult.newBuilder(); HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(MESSAGES_MAP); long head = fromMessageId; long current = fromMessageId; TreeMap maps = chatroomMessages.get(chatroomId); if (maps == null) { mWriteLock.lock(); try { maps = chatroomMessages.get(chatroomId); if (maps == null) { maps = new TreeMap<>(); chatroomMessages.put(chatroomId, maps); } } finally { mWriteLock.unlock(); } } mReadLock.lock(); int size = 0; try { maps = chatroomMessages.get(chatroomId); while (true) { Map.Entry entry = maps.higherEntry(current); if (entry == null) { break; } current = entry.getKey(); long targetMessageId = entry.getValue(); MessageBundle bundle = mIMap.get(targetMessageId); if (bundle != null) { if (exceptClientId == null || !exceptClientId.equals(bundle.getFromClientId()) || !fromUser.equals(bundle.getFromUser())) { if (bundle.getMessage().getContent().getExpireDuration() > 0) { if (System.currentTimeMillis() > bundle.getMessage().getServerTimestamp() + bundle.getMessage().getContent().getExpireDuration() * 1000) { continue; } } size += bundle.getMessage().getSerializedSize(); if (size >= 3 * 1024 * 1024) { //3M break; } builder.addMessage(bundle.getMessage()); } } } Map.Entry lastEntry = maps.lastEntry(); if (lastEntry != null) { head = lastEntry.getKey(); } } finally { mReadLock.unlock(); } builder.setCurrent(current); builder.setHead(head); return builder.build(); } @Override public long insertUserMessages(String sender, int conversationType, String target, int line, int messageContentType, String user, long messageId, boolean directing) { // messageId是全局的,messageSeq是跟个人相关的,理论上messageId的增长数度远远大于seq。 // 考虑到一种情况,当服务器发生变化,用户发生迁移后,messageSeq还需要保持有序。 要么把Seq持久化,要么在迁移后Seq取一个肯定比以前更大的数字(这个数字就是messageId) // 这里选择使用后面一种情况 long messageSeq = 0; if (conversationType == ProtoConstants.ConversationType.ConversationType_ChatRoom) { return insertChatroomMessages(target, line, messageId); } mWriteLock.lock(); try { TreeMap maps = userMessages.get(user); if (maps == null) { maps = databaseStore.reloadUserMessageMaps(user); userMessages.put(user, maps); } Map.Entry lastEntry = maps.lastEntry(); if (lastEntry != null) { messageSeq = (lastEntry.getKey() + 1); } Long maxPullSeq = userMaxPullSeq.get(user); if (maxPullSeq != null && maxPullSeq > messageSeq) { messageSeq = maxPullSeq + 1; } if (messageSeq < messageId) { messageSeq = messageId; } maps.put(messageSeq, messageId); if (maps.size() > MAX_MESSAGE_QUEUE) { maps.remove(maps.firstKey()); } } finally { mWriteLock.unlock(); } databaseStore.persistUserMessage(user, sender, messageId, messageSeq, conversationType, target, line, directing, messageContentType); return messageSeq; } @Override public Collection getChatroomMemberClient(String userId) { String chatroomId = (String)m_Server.getHazelcastInstance().getMap(USER_CHATROOM).get(userId); if (StringUtil.isNullOrEmpty(chatroomId)) { return new HashSet<>(); } MultiMap chatroomMembers = m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS); if (chatroomMembers == null) { return new HashSet<>(); } Collection entries = chatroomMembers.get(chatroomId); HashSet clientIds = new HashSet<>(); if (entries == null) { return clientIds; } for (UserClientEntry entry : entries ) { clientIds.add(entry.clientId); } return clientIds; } @Override public boolean checkUserClientInChatroom(String user, String clientId, String chatroomId) { MemorySessionStore.Session session = m_Server.getStore().sessionsStore().getSession(clientId); String existChatroomId = (String)m_Server.getHazelcastInstance().getMap(USER_CHATROOM).get(user); if (chatroomId == null) { if (existChatroomId == null) { return false; } else { chatroomId = existChatroomId; } } if (StringUtil.isNullOrEmpty(existChatroomId) || !existChatroomId.equals(chatroomId)) { if (mChatroomRejoinWhenActive) { if (!StringUtil.isNullOrEmpty(existChatroomId)) { handleQuitChatroom(user, clientId, existChatroomId); } handleJoinChatroom(user, clientId, chatroomId); } else { return false; } } if (!mChatroomRejoinWhenActive && !checkChatroomParticipantIdelTime(session)) { handleQuitChatroom(user, clientId, chatroomId); return false; } MultiMap chatroomMembers = m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS); if (chatroomMembers == null) { return false; } Collection entries = chatroomMembers.get(existChatroomId); if (entries == null) { return false; } for (UserClientEntry entry : entries ) { if (entry.clientId.equals(clientId)) { return true; } } return false; } @Override public long insertChatroomMessages(String target, int line, long messageId) { // messageId是全局的,messageSeq是跟个人相关的,理论上messageId的增长数度远远大于seq。 // 考虑到一种情况,当服务器发生变化,用户发生迁移后,messageSeq还需要保持有序。 要么把Seq持久化,要么在迁移后Seq取一个肯定比以前更大的数字(这个数字就是messageId) // 这里选择使用后面一种情况 long messageSeq = 0; mWriteLock.lock(); try { TreeMap maps = chatroomMessages.get(target); if (maps == null) { maps = new TreeMap<>(); chatroomMessages.put(target, maps); } Map.Entry lastEntry = maps.lastEntry(); if (lastEntry != null) { messageSeq = (lastEntry.getKey() + 1); } if (messageSeq == 0) { messageSeq = messageId; } maps.put(messageSeq, messageId); if (maps.size() > MAX_CHATROOM_MESSAGE_QUEUE) { maps.remove(maps.firstKey()); } } finally { mWriteLock.unlock(); } return messageSeq; } @Override public ErrorCode canAddGroupMembers(String fromUser, List memberList, Map failedMembers) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); IMap mUserMap = hzInstance.getMap(USERS); WFCMessage.User operator = mUserMap.get(fromUser); if(operator != null && operator.getType() > 1) { return ErrorCode.ERROR_CODE_SUCCESS; } if (mDisableStrangerAddGroup) { for (WFCMessage.GroupMember groupMember : memberList) { String targetUser = groupMember.getMemberId(); if(fromUser.equals(targetUser)) { continue; } Collection friendDatas = friendsMap.get(targetUser); if (friendDatas == null || friendDatas.size() == 0) { friendDatas = loadFriend(friendsMap, targetUser); } boolean allow = false; for (FriendData friendData : friendDatas) { if (friendData.getFriendUid().equals(fromUser)) { if (friendData.getBlacked() == 1) { LOG.error("Add group member failure, because inviter {} is blocked by invitee {}", fromUser, targetUser); if(isGroupAllowPartSuccess()) { failedMembers.put(targetUser, 1); //black } else { return ErrorCode.ERROR_CODE_IN_BLACK_LIST; } } else { if (friendData.getState() == 0) { allow = true; } break; } } } if(allow) { continue; } //在禁止私聊时,是否是允许私聊的用户id if(mAllowStrangerChatSet.contains(targetUser) || mAllowStrangerChatSet.contains(fromUser)) { continue; } //在禁止私聊时,允许机器人,物联网设备及管理员进行私聊。 WFCMessage.User target = mUserMap.get(targetUser); if (target != null && target.getType() != ProtoConstants.UserType.UserType_Normal) { continue; } if(isGroupAllowPartSuccess()) { failedMembers.put(targetUser, 2);//stranger } else { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } } else { for (WFCMessage.GroupMember groupMember : memberList) { String targetUser = groupMember.getMemberId(); if(fromUser.equals(targetUser)) { continue; } Collection friendDatas = friendsMap.get(targetUser); if (friendDatas == null || friendDatas.size() == 0) { friendDatas = loadFriend(friendsMap, targetUser); } for (FriendData friendData : friendDatas) { if (friendData.getFriendUid().equals(fromUser)) { if (friendData.getBlacked() == 1) { LOG.error("Add group member failure, because inviter {} is blocked by invitee {}", fromUser, targetUser); if(isGroupAllowPartSuccess()) { failedMembers.put(targetUser, 1); //black } else { return ErrorCode.ERROR_CODE_IN_BLACK_LIST; } } else { break; } } } } } return ErrorCode.ERROR_CODE_SUCCESS; } @Override public WFCMessage.GroupInfo createGroup(String fromUser, WFCMessage.GroupInfo groupInfo, List memberList, String memberExtra, boolean isAdmin, Map failedMembers) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(GROUPS_MAP); String groupId = null; long dt = System.currentTimeMillis(); if (StringUtil.isNullOrEmpty(groupInfo.getTargetId())) { groupId = getShortUUID(); } else { groupId = groupInfo.getTargetId(); } MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); String owner = fromUser; if (isAdmin && !StringUtil.isNullOrEmpty(groupInfo.getOwner())) { owner = groupInfo.getOwner(); } List updatedMemberList = new ArrayList<>(); boolean hasOwnerMember = false; for (WFCMessage.GroupMember member : memberList) { if(failedMembers.containsKey(member.getMemberId())) { continue; } WFCMessage.GroupMember.Builder builder = member.toBuilder(); builder.setUpdateDt(dt).setCreateDt(dt); if (member.getMemberId().equals(owner)) { builder.setType(ProtoConstants.GroupMemberType.GroupMemberType_Owner); hasOwnerMember = true; } else { if (isAdmin) { if (member.getType() == GroupMemberType_Owner) { builder.setType(GroupMemberType_Normal); LOG.error("group member conflicted, group info owner is {}, and group member {} type is owner, set the member to normal member", owner, member.getMemberId()); } } else { builder.setType(GroupMemberType_Normal); } } if(!StringUtil.isNullOrEmpty(memberExtra)) { builder.setExtra(memberExtra); } member = builder.build(); groupMembers.put(groupId, member); updatedMemberList.add(member); dt++; } if(!hasOwnerMember && !StringUtil.isNullOrEmpty(owner)) { WFCMessage.GroupMember member; if(!StringUtil.isNullOrEmpty(memberExtra)) { member = WFCMessage.GroupMember.newBuilder().setMemberId(owner).setExtra(memberExtra).setUpdateDt(dt).setCreateDt(dt).setType(ProtoConstants.GroupMemberType.GroupMemberType_Owner).build(); } else { member = WFCMessage.GroupMember.newBuilder().setMemberId(owner).setUpdateDt(dt).setCreateDt(dt).setType(ProtoConstants.GroupMemberType.GroupMemberType_Owner).build(); } groupMembers.put(groupId, member); updatedMemberList.add(member); } groupInfo = groupInfo.toBuilder() .setTargetId(groupId) .setName(groupInfo.getName()) .setPortrait(groupInfo.getPortrait()) .setType(groupInfo.getType()) .setExtra(groupInfo.getExtra()) .setUpdateDt(dt) .setMemberUpdateDt(dt) .setMemberCount(updatedMemberList.size()) .setOwner(owner) .build(); mIMap.set(groupId, groupInfo); databaseStore.persistGroupMember(groupId, updatedMemberList, false); callbackGroupEvent(fromUser, groupInfo.getTargetId(), ProtoConstants.GroupUpdateEventType.Group_Event_Create, groupInfo); return groupInfo; } private void callbackGroupEvent(String operatorId, String groupId, int type, WFCMessage.GroupInfo groupInfo) { if (!StringUtil.isNullOrEmpty(mGroupInfoUpdateCallback)) { GroupUpdateEvent event = new GroupUpdateEvent(); event.operatorId = operatorId; event.groupId = groupId; event.type = type; PojoGroupInfo pojoGroupInfo = new PojoGroupInfo(); event.groupInfo = pojoGroupInfo; if (groupInfo != null && groupInfo.getDeleted() == 0) { pojoGroupInfo.setExtra(groupInfo.getExtra()); pojoGroupInfo.setName(groupInfo.getName()); pojoGroupInfo.setOwner(groupInfo.getOwner()); pojoGroupInfo.setPortrait(groupInfo.getPortrait()); pojoGroupInfo.setTarget_id(groupInfo.getTargetId()); pojoGroupInfo.setType(groupInfo.getType()); pojoGroupInfo.setMute(groupInfo.getMute()); pojoGroupInfo.setJoin_type(groupInfo.getJoinType()); pojoGroupInfo.setPrivate_chat(groupInfo.getPrivateChat()); pojoGroupInfo.setSearchable(groupInfo.getSearchable()); pojoGroupInfo.setMax_member_count(groupInfo.getMemberCount()); pojoGroupInfo.setHistory_message(groupInfo.getHistoryMessage()); pojoGroupInfo.setSuper_group(groupInfo.getSuperGroup()>0); } m_Server.getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(mGroupInfoUpdateCallback, GsonUtil.gson.toJson(event), HttpUtils.HttpPostType.POST_TYPE_Grout_Event_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } } private void callbackGroupMemberEvent(String operatorId, String groupId, List memberIds, int type, String value) { if (!StringUtil.isNullOrEmpty(mGroupMemberUpdateCallback)) { GroupMemberUpdateEvent event = new GroupMemberUpdateEvent(); event.operatorId = operatorId; event.groupId = groupId; event.memberIds = memberIds; event.type = type; event.value = value; m_Server.getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(mGroupMemberUpdateCallback, GsonUtil.gson.toJson(event), HttpUtils.HttpPostType.POST_TYPE_Grout_Member_Event_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } } private void callbackRelationEvent(String userId, String targetId, int type, String value) { if (!StringUtil.isNullOrEmpty(mRelationUpdateCallback)) { RelationUpdateEvent event = new RelationUpdateEvent(); event.userId = userId; event.targetId = targetId; event.type = type; event.value = value; m_Server.getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(mRelationUpdateCallback, GsonUtil.gson.toJson(event), HttpUtils.HttpPostType.POST_TYPE_User_Relation_Event_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } } private void callbackUserInfoEvent(WFCMessage.User user) { if (!StringUtil.isNullOrEmpty(mUserInfoUpdateCallback)) { m_Server.getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(mUserInfoUpdateCallback, GsonUtil.gson.toJson(InputOutputUserInfo.fromPbUser(user)), HttpUtils.HttpPostType.POST_TYPE_User_Info_Event_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } } private void callbackChannelInfoUpdateEvent(String operatorId, String channelId, int type) { if (!StringUtil.isNullOrEmpty(mChannelInfoUpdateCallback)) { ChannelUpdateEvent event = new ChannelUpdateEvent(); event.operatorId = operatorId; event.channelId = channelId; event.type = type; m_Server.getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(mChannelInfoUpdateCallback, GsonUtil.gson.toJson(event), HttpUtils.HttpPostType.POST_TYPE_Channel_Info_Event_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } } private void callbackChatroomInfoUpdateEvent(String chatroomId, int type) { if (!StringUtil.isNullOrEmpty(mChatroomInfoUpdateCallback)) { ChatroomUpdateEvent event = new ChatroomUpdateEvent(); event.chatroomId = chatroomId; event.type = type; m_Server.getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(mChatroomInfoUpdateCallback, GsonUtil.gson.toJson(event), HttpUtils.HttpPostType.POST_TYPE_Chatroom_Info_Event_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } } private void callbackChatroomMemberEvent(String operatorId, String chatroomId, List memberIds, int type) { if (!StringUtil.isNullOrEmpty(mChatroomMemberUpdateCallback)) { ChatroomMemberUpdateEvent event = new ChatroomMemberUpdateEvent(); event.operatorId = operatorId; event.chatroomId = chatroomId; event.memberIds = memberIds; event.type = type; m_Server.getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(mChatroomMemberUpdateCallback, GsonUtil.gson.toJson(event), HttpUtils.HttpPostType.POST_TYPE_Chatroom_Member_Event_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } } @Override public ErrorCode addGroupMembers(String operator, boolean isAdmin, String groupId, List memberList, String extra, Map failedMembers) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(GROUPS_MAP); WFCMessage.GroupInfo groupInfo = mIMap.get(groupId); if (groupInfo == null) { return ErrorCode.ERROR_CODE_NOT_EXIST; } int maxCount = Integer.MAX_VALUE; if (!isAdmin) { if (groupInfo.getType() == ProtoConstants.GroupType.GroupType_Organization) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } boolean isMember = false; boolean isManager = false; WFCMessage.GroupMember gm = getGroupMember(groupId, operator); if (gm != null) { if (gm.getType() == GroupMemberType_Removed && !(memberList.size() == 1 && operator.equals(memberList.get(0).getMemberId()))) { return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } else if (gm.getType() == GroupMemberType_Silent) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } isManager = (gm.getType() == GroupMemberType_Manager || gm.getType() == GroupMemberType_Owner); if (gm.getType() != GroupMemberType_Removed) { isMember = true; } } if (groupInfo.getType() == ProtoConstants.GroupType.GroupType_Restricted && ((groupInfo.getOwner() == null || !groupInfo.getOwner().equals(operator)) && !isManager)) { if (groupInfo.getJoinType() == 2) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } else if (groupInfo.getJoinType() == 1) { if (memberList.size() == 1 && operator.equals(memberList.get(0).getMemberId())) return ErrorCode.ERROR_CODE_NOT_RIGHT; } } if (!isMember && !(memberList.size() == 1 && operator.equals(memberList.get(0).getMemberId()))) { return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } SystemSettingPojo maxMemberSetting = databaseStore.getSystemSetting(ProtoConstants.SystemSettingType.Group_Max_Member_Count); if (maxMemberSetting != null) { try { maxCount = Integer.parseInt(maxMemberSetting.value); } catch (NumberFormatException e) { e.printStackTrace(); } } } MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(groupId); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, groupId); } ArrayList existMemberIds = new ArrayList<>(); for (WFCMessage.GroupMember member : members) { if (member.getType() != GroupMemberType_Removed) { existMemberIds.add(member.getMemberId()); } } long updateDt = System.currentTimeMillis(); List tmp = new ArrayList<>(); int newMemberCount = 0; for (WFCMessage.GroupMember member : memberList) { if(failedMembers.containsKey(member.getMemberId())) { continue; } if (existMemberIds.contains(member.getMemberId()) && member.getType() != GroupMemberType_Removed) { if(!isAdmin) continue; } else { newMemberCount++; } WFCMessage.GroupMember.Builder builder = member.toBuilder(); builder.setUpdateDt(updateDt).setCreateDt(updateDt); if (member.getMemberId().equals(groupInfo.getOwner())) { builder.setType(GroupMemberType_Owner).build(); } else { if (isAdmin) { if (member.getType() == GroupMemberType_Owner) { builder.setType(GroupMemberType_Normal); LOG.error("group member conflicted, group info owner is {}, and group member {} type is owner, set the member to normal member", groupInfo.getOwner(), member.getMemberId()); } } else { builder.setType(GroupMemberType_Normal); } } if(!StringUtil.isNullOrEmpty(extra)) { builder.setExtra(extra); } member = builder.build(); tmp.add(member); updateDt++; } memberList = tmp; if (memberList.size() == 0) { if (!isAdmin) { if(failedMembers.isEmpty()) { return ErrorCode.ERROR_CODE_ALREADY_IN_GROUP; } else { return ErrorCode.ERROR_CODE_SUCCESS; } } else { return ErrorCode.ERROR_CODE_SUCCESS; } } else { if (existMemberIds.size() + newMemberCount > maxCount) { return ErrorCode.ERROR_CODE_GROUP_EXCEED_MAX_MEMBER_COUNT; } } databaseStore.persistGroupMember(groupId, memberList, true); databaseStore.updateGroupMemberCountDt(groupId); groupMembers.remove(groupId); mIMap.evict(groupId); List memberIds = new ArrayList<>(); for (WFCMessage.GroupMember member : memberList) { if(failedMembers.containsKey(member.getMemberId())) { continue; } if (member.getType() != GroupMemberType_Removed) { memberIds.add(member.getMemberId()); } } callbackGroupMemberEvent(operator, groupId, memberIds, ProtoConstants.GroupMemberUpdateEventType.Group_Member_Event_Join, null); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode kickoffGroupMembers(String operator, boolean isAdmin, String groupId, List memberList) { removeGroupMember(groupId, memberList); removeFavGroup(groupId, memberList); removeGroupUserSettings(groupId, memberList); callbackGroupMemberEvent(operator, groupId, memberList, ProtoConstants.GroupMemberUpdateEventType.Group_Member_Event_Kickoff, null); return ErrorCode.ERROR_CODE_SUCCESS; } void removeGroupMember(String groupId, List memberIds) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); databaseStore.removeGroupMember(groupId, memberIds); databaseStore.updateGroupMemberCountDt(groupId); MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); groupMembers.remove(groupId); IMap mIMap = hzInstance.getMap(GROUPS_MAP); mIMap.evict(groupId); } void removeFavGroup(String groupId, List memberIds) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); databaseStore.removeFavGroup(groupId, memberIds); try { mUserSettingLock.lock(); MultiMap userSettingMap = hzInstance.getMultiMap(USER_SETTING); for (String member : memberIds) { userSettingMap.remove(member); } } finally { mUserSettingLock.unlock(); } } @Override public ErrorCode quitGroup(String operator, String groupId, boolean admin) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(GROUPS_MAP); WFCMessage.GroupInfo groupInfo = mIMap.get(groupId); if (groupInfo == null) { MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(groupId); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, groupId); } for (WFCMessage.GroupMember member :members) { if (member.getMemberId().equals(operator)) { groupMembers.remove(groupId, member); break; } } return ErrorCode.ERROR_CODE_NOT_EXIST; } if(!admin && groupInfo.getType() == ProtoConstants.GroupType.GroupType_Organization) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if (groupInfo.getType() != ProtoConstants.GroupType.GroupType_Free && groupInfo.getOwner() != null && groupInfo.getOwner().equals(operator)) { MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(groupId); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, groupId); } WFCMessage.GroupMember newOwner = null; for (WFCMessage.GroupMember member :members) { if (!member.getMemberId().equals(operator) && member.getType() != GroupMemberType_Removed) { if(newOwner == null) { newOwner = member; } else { if(newOwner.getType() == GroupMemberType_Silent && member.getType() != GroupMemberType_Silent) { newOwner = member; } else if(newOwner.getType() != GroupMemberType_Manager && member.getType() == GroupMemberType_Manager) { newOwner = member; } else if(newOwner.getType() == member.getType()) { if(newOwner.getCreateDt() > member.getCreateDt() && member.getCreateDt() > 0) { newOwner = member; } } } } } if (newOwner == null) { return dismissGroup(operator, groupId, false); } transferGroup(operator, groupId, newOwner.getMemberId(), false); try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } removeGroupMember(groupId, Arrays.asList(operator)); removeFavGroup(groupId, Arrays.asList(operator)); removeGroupUserSettings(groupId, Arrays.asList(operator)); callbackGroupMemberEvent(operator, groupId, Arrays.asList(operator), ProtoConstants.GroupMemberUpdateEventType.Group_Member_Event_Leave, null); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public void clearUserGroups(String userId) { Set groupIds = databaseStore.getUserGroupIds(userId); int[] removedCount = new int[1]; for (String groupId : groupIds) { removedCount[0] = 0; ErrorCode errorCode = quitGroup(userId, groupId, true); LOG.info("clear user {} group {} result {}", userId, groupId, errorCode); } } private void removeGroupUserSettings(String groupId, List users) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); databaseStore.removeGroupUserSettings(groupId, users); try { mUserSettingLock.lock(); MultiMap userSettingMap = hzInstance.getMultiMap(USER_SETTING); for (String userId:users) { userSettingMap.remove(userId); } } finally { mUserSettingLock.unlock(); } } @Override public ErrorCode dismissGroup(String operator, String groupId, boolean isAdmin) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(GROUPS_MAP); WFCMessage.GroupInfo groupInfo = mIMap.get(groupId); if (groupInfo == null) { MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); groupMembers.remove(groupId); return ErrorCode.ERROR_CODE_NOT_EXIST; } if (!isAdmin && (groupInfo.getType() == ProtoConstants.GroupType.GroupType_Free || groupInfo.getType() == ProtoConstants.GroupType.GroupType_Organization || (groupInfo.getType() == ProtoConstants.GroupType.GroupType_Restricted || groupInfo.getType() == ProtoConstants.GroupType.GroupType_Normal) && (groupInfo.getOwner() == null || !groupInfo.getOwner().equals(operator)))) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(groupId); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, groupId); } groupMembers.remove(groupId); mIMap.remove(groupId); databaseStore.removeGroupMemberFromDB(groupId); ArrayList ids = new ArrayList<>(); if (members != null) { for (WFCMessage.GroupMember member : members) { ids.add(member.getMemberId()); } } removeFavGroup(groupId, ids); removeGroupUserSettings(groupId, ids); callbackGroupEvent(operator, groupId, ProtoConstants.GroupUpdateEventType.Group_Event_Destroy, groupInfo); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode modifyGroupInfo(String operator, String groupId, int modifyType, String value, boolean isAdmin) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(GROUPS_MAP); WFCMessage.GroupInfo oldInfo = mIMap.get(groupId); if (oldInfo == null) { return ErrorCode.ERROR_CODE_NOT_EXIST; } if (!isAdmin) { if (oldInfo.getType() == ProtoConstants.GroupType.GroupType_Organization && modifyType != Modify_Group_Extra && modifyType != Modify_Group_Mute && modifyType != Modify_Group_PrivateChat) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } WFCMessage.GroupMember gm = getGroupMember(groupId, operator); if (gm == null || gm.getType() == GroupMemberType_Removed) { return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } if (oldInfo.getType() == ProtoConstants.GroupType.GroupType_Restricted || oldInfo.getType() == ProtoConstants.GroupType.GroupType_Organization) { boolean isAllow = false; if ((oldInfo.getOwner() != null && oldInfo.getOwner().equals(operator))) { isAllow = true; } else { if (gm.getType() == GroupMemberType_Manager) { isAllow = true; } } if (!isAllow) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if (modifyType == Modify_Group_Name && !StringUtil.isNullOrEmpty(value)) { if(!mSensitiveOnlyMessage) { Set matched = handleSensitiveWord(value); if (matched != null && !matched.isEmpty()) { return ErrorCode.ERROR_CODE_SENSITIVE_MATCHED; } } if(!isAllowName(value)) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } } if (oldInfo.getType() == ProtoConstants.GroupType.GroupType_Normal) { if (!operator.equals(oldInfo.getOwner())) { boolean isManager = false; if (gm.getType() == GroupMemberType_Manager) { isManager = true; } if (!isManager && modifyType != Modify_Group_Name && modifyType != Modify_Group_Portrait && modifyType != Modify_Group_Extra) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } } if (oldInfo.getType() == ProtoConstants.GroupType.GroupType_Free) { if (modifyType != Modify_Group_Name && modifyType != Modify_Group_Portrait && modifyType != Modify_Group_Extra) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } } WFCMessage.GroupInfo.Builder newInfoBuilder = oldInfo.toBuilder(); if (modifyType == Modify_Group_Name) newInfoBuilder.setName(value); else if(modifyType == Modify_Group_Portrait) newInfoBuilder.setPortrait(value); else if(modifyType == Modify_Group_Extra) newInfoBuilder.setExtra(value); else if(modifyType == Modify_Group_Mute) newInfoBuilder.setMute(Integer.parseInt(value)); else if(modifyType == Modify_Group_JoinType) newInfoBuilder.setJoinType(Integer.parseInt(value)); else if(modifyType == Modify_Group_PrivateChat) newInfoBuilder.setPrivateChat(Integer.parseInt(value)); else if(modifyType == Modify_Group_Searchable) newInfoBuilder.setSearchable(Integer.parseInt(value)); else if(modifyType == Modify_Group_Type) { int newType = Integer.parseInt(value); if(newType < 0 || newType > ProtoConstants.GroupType.GroupType_Organization) { LOG.error("modify group type failure, invalid group type {}", newType); return ErrorCode.INVALID_PARAMETER; } newInfoBuilder.setType(newType); } else return ErrorCode.INVALID_PARAMETER; newInfoBuilder.setUpdateDt(System.currentTimeMillis()); databaseStore.persistGroupInfo(newInfoBuilder.build()); mIMap.evict(groupId); if (modifyType == Modify_Group_Mute) { if (newInfoBuilder.getMute() > 0) { callbackGroupEvent(operator, groupId, ProtoConstants.GroupUpdateEventType.Group_Event_Mute, newInfoBuilder.build()); } else { callbackGroupEvent(operator, groupId, ProtoConstants.GroupUpdateEventType.Group_Event_Unmute, newInfoBuilder.build()); } } else { callbackGroupEvent(operator, groupId, ProtoConstants.GroupUpdateEventType.Group_Event_Update, newInfoBuilder.build()); } return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode modifyGroupMemberAlias(String operator, String groupId, String alias, String memberId, boolean isAdmin) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(GROUPS_MAP); WFCMessage.GroupInfo groupInfo = mIMap.get(groupId); if (groupInfo == null) { groupInfo = databaseStore.getPersistGroupInfo(groupId); if (groupInfo != null && groupInfo.getDeleted() == 0) { mIMap.set(groupId, groupInfo); } else { return ErrorCode.ERROR_CODE_NOT_EXIST; } } MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(groupId); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, groupId); } if (StringUtil.isNullOrEmpty(memberId)) { memberId = operator; } else { if (!isAdmin && !operator.equals(groupInfo.getOwner())) { WFCMessage.GroupMember operatorMember = null; WFCMessage.GroupMember targetMember = null; for (WFCMessage.GroupMember member : members) { if (member.getMemberId().equals(operator)) { operatorMember = member; if (targetMember != null) { break; } } if ((member.getMemberId().equals(memberId))) { targetMember = member; if (operatorMember != null) { break; } } } if (operatorMember == null || operatorMember.getType() == GroupMemberType_Removed) { LOG.error("Modify group member alias error, the operator {} is not in group", operator); return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } if (targetMember == null || targetMember.getType() == GroupMemberType_Removed) { LOG.error("Modify group member alias error, the member {} is not in group", memberId); return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } if (operatorMember.getType() == GroupMemberType_Manager && targetMember.getType() != GroupMemberType_Manager) { LOG.error("Modify group member alias error, the operator {} type is {} and the member {} type is {}", operator, operatorMember.getType(), memberId, targetMember.getType()); return ErrorCode.ERROR_CODE_NOT_RIGHT; } } } long updateDt = System.currentTimeMillis(); boolean inGroup = false; for (WFCMessage.GroupMember member : members) { if (member.getMemberId().equals(memberId)) { groupMembers.remove(groupId, member); member = member.toBuilder().setAlias(alias).setUpdateDt(updateDt).build(); databaseStore.persistGroupMember(groupId, Arrays.asList(member), false); databaseStore.updateGroupMemberDt(groupId, updateDt); groupMembers.put(groupId, member); mIMap.set(groupId, groupInfo.toBuilder().setUpdateDt(updateDt).setMemberUpdateDt(updateDt).build()); inGroup = true; break; } } if (!inGroup) { LOG.error("Modify group member alias error, the member {} is not in group", memberId); return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } callbackGroupMemberEvent(operator, groupId, Arrays.asList(memberId), ProtoConstants.GroupMemberUpdateEventType.Group_Member_Event_Alias, alias); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode modifyGroupMemberExtra(String operator, String groupId, String extra, String memberId, boolean isAdmin) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(GROUPS_MAP); WFCMessage.GroupInfo groupInfo = mIMap.get(groupId); if (groupInfo == null) { groupInfo = databaseStore.getPersistGroupInfo(groupId); if (groupInfo != null && groupInfo.getDeleted() == 0) { mIMap.set(groupId, groupInfo); } else { return ErrorCode.ERROR_CODE_NOT_EXIST; } } MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(groupId); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, groupId); } if (StringUtil.isNullOrEmpty(memberId)) { memberId = operator; } else { if (!isAdmin && !operator.equals(groupInfo.getOwner())) { WFCMessage.GroupMember operatorMember = null; WFCMessage.GroupMember targetMember = null; for (WFCMessage.GroupMember member : members) { if (member.getMemberId().equals(operator)) { operatorMember = member; if (targetMember != null) { break; } } if ((member.getMemberId().equals(memberId))) { targetMember = member; if (operatorMember != null) { break; } } } if (operatorMember == null) { LOG.error("Modify group member extra error, the operator {} is not in group", operator); return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } if (targetMember == null) { LOG.error("Modify group member extra error, the member {} is not in group", memberId); return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } if (operatorMember.getType() == GroupMemberType_Manager && targetMember.getType() != GroupMemberType_Manager) { LOG.error("Modify group member extra error, the operator {} type is {} and the member {} type is {}", operator, operatorMember.getType(), memberId, targetMember.getType()); return ErrorCode.ERROR_CODE_NOT_RIGHT; } } } long updateDt = System.currentTimeMillis(); boolean inGroup = false; for (WFCMessage.GroupMember member : members) { if (member.getMemberId().equals(memberId)) { groupMembers.remove(groupId, member); member = member.toBuilder().setExtra(extra).setUpdateDt(updateDt).build(); databaseStore.persistGroupMember(groupId, Arrays.asList(member), false); databaseStore.updateGroupMemberDt(groupId, updateDt); groupMembers.put(groupId, member); mIMap.set(groupId, groupInfo.toBuilder().setUpdateDt(updateDt).setMemberUpdateDt(updateDt).build()); inGroup = true; break; } } if (!inGroup) { LOG.error("Modify group member extra error, the member {} is not in group", memberId); return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } callbackGroupMemberEvent(operator, groupId, Arrays.asList(memberId), ProtoConstants.GroupMemberUpdateEventType.Group_Member_Event_Alias, extra); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public List getGroupInfos(List requests, String fromUser, boolean isAdmin) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(GROUPS_MAP); ArrayList out = new ArrayList<>(); for (WFCMessage.UserRequest request : requests) { WFCMessage.GroupInfo groupInfo = mIMap.get(request.getUid()); if (groupInfo != null && groupInfo.getUpdateDt() > request.getUpdateDt()) { if(!isAdmin && !StringUtil.isNullOrEmpty(fromUser) && groupInfo.getDeleted() == 0) { WFCMessage.GroupMember gm = getGroupMember(groupInfo.getTargetId(), fromUser); if((gm == null || gm.getType() == GroupMemberType_Removed) && request.getUpdateDt() > 0) { continue; } if(gm == null) { groupInfo = groupInfo.toBuilder().setMemberUpdateDt(-1).build(); } else if(gm.getType() == GroupMemberType_Removed) { groupInfo = groupInfo.toBuilder().setMemberUpdateDt(-groupInfo.getMemberUpdateDt()).build(); } } out.add(groupInfo); } } return out; } @Override public WFCMessage.GroupInfo getGroupInfo(String groupId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(GROUPS_MAP); WFCMessage.GroupInfo groupInfo = mIMap.get(groupId); return groupInfo; } @Override public Set getUserGroupIds(String userId) { return databaseStore.getUserGroupIds(userId); } @Override public Set getUserGroupIds(String userId, List memberTypes) { return databaseStore.getUserGroupIds(userId, memberTypes); } @Override public Set getCommonGroupIds(String userId1, String userId2) { return databaseStore.getCommonGroupIds(userId1, userId2); } @Override public ErrorCode getGroupMembers(String fromUser, String groupId, long maxDt, List members) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(GROUPS_MAP); WFCMessage.GroupInfo groupInfo = mIMap.get(groupId); if (groupInfo == null) { return ErrorCode.ERROR_CODE_NOT_EXIST; } MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection memberCollection = groupMembers.get(groupId); if (memberCollection == null || memberCollection.size() == 0) { memberCollection = loadGroupMemberFromDB(hzInstance, groupId); } boolean notInGroup = true; WFCMessage.GroupMember self = null; for (WFCMessage.GroupMember member:memberCollection) { if (member.getUpdateDt() > maxDt) { members.add(member); } if (fromUser != null && notInGroup) { if (member.getMemberId().equals(fromUser)) { if (member.getType() != GroupMemberType_Removed) { notInGroup = false; } else { self = member; break; } } } } //server api fromUser is null if (fromUser != null && notInGroup) { members.clear(); if (self != null) { members.add(self.toBuilder().setUpdateDt(0).setType(GroupMemberType_Removed).build()); } } return ErrorCode.ERROR_CODE_SUCCESS; } @Override public WFCMessage.GroupMember getGroupMember(String groupId, String memberId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(groupId); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, groupId); } if (members != null) { for (WFCMessage.GroupMember gm : members) { if (gm.getMemberId().equals(memberId)) { return gm; } } } return null; } @Override public ErrorCode transferGroup(String operator, String groupId, String newOwner, boolean isAdmin) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(GROUPS_MAP); WFCMessage.GroupInfo groupInfo = mIMap.get(groupId); if (groupInfo == null) { return ErrorCode.ERROR_CODE_NOT_EXIST; } if (!isAdmin && (groupInfo.getType() == ProtoConstants.GroupType.GroupType_Restricted || groupInfo.getType() == ProtoConstants.GroupType.GroupType_Normal) && (groupInfo.getOwner() == null || !groupInfo.getOwner().equals(operator))) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if (!isAdmin && groupInfo.getType() == ProtoConstants.GroupType.GroupType_Organization) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } //check the new owner is in member list? is that necessary? MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(groupId); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, groupId); } boolean isNewOwnerInGroup = false; for (WFCMessage.GroupMember member : members) { if (member.getMemberId().equals(newOwner)) { if(member.getType() != GroupMemberType_Removed) { isNewOwnerInGroup = true; } break; } } if(!isNewOwnerInGroup) { return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } long updateDt = System.currentTimeMillis(); groupInfo = groupInfo.toBuilder().setOwner(newOwner).setUpdateDt(updateDt).setMemberUpdateDt(updateDt).build(); mIMap.set(groupId, groupInfo); int modifyMemeberCount = 0; for (WFCMessage.GroupMember member : members) { if (modifyMemeberCount == 2) { break; } if (newOwner.equals(member.getMemberId())) { groupMembers.remove(groupId, member); member = member.toBuilder().setType(GroupMemberType_Owner).setUpdateDt(updateDt).build(); databaseStore.persistGroupMember(groupId, Arrays.asList(member), false); groupMembers.put(groupId, member); modifyMemeberCount++; } else if(member.getType() == GroupMemberType_Owner) { groupMembers.remove(groupId, member); member = member.toBuilder().setType(GroupMemberType_Normal).setUpdateDt(updateDt).build(); databaseStore.persistGroupMember(groupId, Arrays.asList(member), false); groupMembers.put(groupId, member); modifyMemeberCount++; } } callbackGroupEvent(operator, groupId, ProtoConstants.GroupUpdateEventType.Group_Event_Transfer, groupInfo); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode setGroupManager(String operator, String groupId, int type, List userList, boolean isAdmin) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(GROUPS_MAP); WFCMessage.GroupInfo groupInfo = mIMap.get(groupId); if (groupInfo == null) { return ErrorCode.ERROR_CODE_NOT_EXIST; } if (!isAdmin && (groupInfo.getType() == ProtoConstants.GroupType.GroupType_Restricted || groupInfo.getType() == ProtoConstants.GroupType.GroupType_Normal) && (groupInfo.getOwner() == null || !groupInfo.getOwner().equals(operator))) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(userList.contains(groupInfo.getOwner())) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } long updateDt = System.currentTimeMillis(); MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(groupId); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, groupId); } for (WFCMessage.GroupMember member : members) { if (userList.contains(member.getMemberId())) { groupMembers.remove(groupId, member); member = member.toBuilder().setType(type == 0 ? ProtoConstants.GroupMemberType.GroupMemberType_Normal : ProtoConstants.GroupMemberType.GroupMemberType_Manager).setUpdateDt(updateDt).build(); databaseStore.persistGroupMember(groupId, Arrays.asList(member), false); groupMembers.put(groupId, member); } } databaseStore.persistGroupInfo(groupInfo.toBuilder().setUpdateDt(updateDt).setMemberUpdateDt(updateDt).build()); mIMap.evict(groupId); callbackGroupMemberEvent(operator, groupId, userList, ProtoConstants.GroupMemberUpdateEventType.Group_Member_Event_Type_Update, (type == 0 ? ProtoConstants.GroupMemberType.GroupMemberType_Normal : ProtoConstants.GroupMemberType.GroupMemberType_Manager) + ""); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public boolean isMemberInGroup(String memberId, String groupId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(groupId); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, groupId); } for (WFCMessage.GroupMember member : members ) { if (member.getMemberId().equals(memberId) && member.getType() != GroupMemberType_Removed) return true; } return false; } @Override public ErrorCode canSendMessageInGroup(String memberId, String groupId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); IMap groups = hzInstance.getMap(GROUPS_MAP); WFCMessage.GroupInfo groupInfo = groups.get(groupId); boolean isMute = false; if (groupInfo != null && groupInfo.getDeleted() == 0) { if (groupInfo.getOwner().equals(memberId)) { return ErrorCode.ERROR_CODE_SUCCESS; } isMute = groupInfo.getMute()>0; } Collection members = groupMembers.get(groupId); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, groupId); } boolean isInGroup = false; for (WFCMessage.GroupMember member : members) { if (member.getMemberId().equals(memberId)) { if (member.getType() == GroupMemberType_Silent) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if (isMute && member.getType() != GroupMemberType_Manager && member.getType() != GroupMemberType_Owner) { return ErrorCode.ERROR_CODE_GROUP_MUTED; } if (member.getMemberId().equals(memberId) && member.getType() == GroupMemberType_Removed) { return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } isInGroup = true; break; } } if (!isInGroup) { return ErrorCode.ERROR_CODE_NOT_IN_GROUP; } return ErrorCode.ERROR_CODE_SUCCESS; } @Override public Set getGroupManagers(String groupId, boolean includeOwner) { Set ret = new HashSet<>(); HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(groupId); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, groupId); } for (WFCMessage.GroupMember member : members) { if(member.getType() == GroupMemberType_Manager || (member.getType() == GroupMemberType_Owner && includeOwner)) { ret.add(member.getMemberId()); } } return ret; } @Override public ErrorCode recallMessage(long messageUid, String operatorId, String clientId, boolean isAdmin, ByteBuf ackPayload) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(MESSAGES_MAP); MessageBundle messageBundle = mIMap.get(messageUid); long now = System.currentTimeMillis(); if (messageBundle != null) { WFCMessage.Message message = messageBundle.getMessage(); boolean canRecall = false; if (isAdmin) { canRecall = true; } boolean isExpired = false; if (!canRecall && message.getFromUser().equals(operatorId)) { if (mRecallTimeLimit >= 0 && now - message.getServerTimestamp() > mRecallTimeLimit * 1000) { isExpired = true; } else { canRecall = true; } } if (!canRecall && !mDisableGroupManagerRecall && message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_Group) { IMap groupMap = hzInstance.getMap(GROUPS_MAP); WFCMessage.GroupInfo groupInfo = groupMap.get(message.getConversation().getTarget()); if (groupInfo == null) { LOG.info("recall message failure, group {} not exist", message.getConversation().getTarget()); return ErrorCode.ERROR_CODE_NOT_EXIST; } if (operatorId.equals(groupInfo.getOwner())) { if(operatorId.equals(message.getFromUser())) { if(mGroupAllowOwnerRecallSelfMsg) { canRecall = true; } } else { canRecall = true; } } else { if(message.getFromUser().equals(operatorId) && mGroupAllowManagerRecallSelfMsg) { MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(message.getConversation().getTarget()); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, message.getConversation().getTarget()); } for (WFCMessage.GroupMember member : members) { if (member.getMemberId().equals(operatorId)) { if (member.getType() == GroupMemberType_Manager || member.getType() == ProtoConstants.GroupMemberType.GroupMemberType_Owner) { canRecall = true; } } } } } if(!canRecall && !message.getFromUser().equals(operatorId)) { boolean isOperatorManager = false; int senderType = GroupMemberType_Normal; MultiMap groupMembers = hzInstance.getMultiMap(GROUP_MEMBERS); Collection members = groupMembers.get(message.getConversation().getTarget()); if (members == null || members.size() == 0) { members = loadGroupMemberFromDB(hzInstance, message.getConversation().getTarget()); } for (WFCMessage.GroupMember member : members) { if (member.getMemberId().equals(operatorId)) { if (member.getType() == GroupMemberType_Manager || member.getType() == ProtoConstants.GroupMemberType.GroupMemberType_Owner) { isOperatorManager = true; } } if(member.getMemberId().equals(message.getFromUser())) { senderType = member.getType(); } } if(isOperatorManager && senderType != GroupMemberType_Manager && senderType != GroupMemberType_Owner) { canRecall = true; } } } if (!canRecall && message.getConversation().getType() == ProtoConstants.ConversationType.ConversationType_ChatRoom) { IMap chatroomInfoMap = hzInstance.getMap(CHATROOMS); WFCMessage.ChatroomInfo room = chatroomInfoMap.get(message.getConversation().getTarget()); //todo check is manager } if (!canRecall) { if(isExpired) { return ErrorCode.ERROR_CODE_RECALL_TIME_EXPIRED; } else { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } if(message.getContent().getType() == 80) { return ErrorCode.ERROR_CODE_SUCCESS; } if(!StringUtil.isNullOrEmpty(mRecallForwardUrl)) { OutputRecallMessageData event = new OutputRecallMessageData(OutputMessageData.fromProtoMessage(message, null), operatorId, System.currentTimeMillis(), isAdmin); m_Server.getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(mRecallForwardUrl, GsonUtil.gson.toJson(event), HttpUtils.HttpPostType.POST_TYPE_Forward_Recall_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } JSONObject json = new JSONObject(); json.put("s", message.getFromUser()); json.put("ts", message.getServerTimestamp()); json.put("t", message.getContent().getType()); json.put("sc", message.getContent().getSearchableContent()); json.put("c", message.getContent().getContent()); json.put("e", message.getContent().getExtra()); if (message.getContent().getData() != null && message.getContent().getData().size() > 0) { json.put("b", Base64.getEncoder().encodeToString(message.getContent().getData().toByteArray())); } if (message.getContent().getMediaType() > 0) { json.put("mt", message.getContent().getMediaType()); } if (!StringUtil.isNullOrEmpty(message.getContent().getRemoteMediaUrl())) { json.put("mu", message.getContent().getRemoteMediaUrl()); } String recalledContent = json.toJSONString(); JSONObject pushData = new JSONObject(); pushData.put("messageUid", messageUid); message = message.toBuilder().setContent(WFCMessage.MessageContent.newBuilder() .setContent(operatorId) .clearSearchableContent() .clearPushContent() .setPersistFlag(1) .setExpireDuration(0) .setMentionedType(0) .setType(80) .setData(ByteString.copyFrom(String.valueOf(messageUid).getBytes())) .setPushData(pushData.toJSONString()) .setExtra(recalledContent)).build(); messageBundle.setMessage(message); messageBundle.setFromClientId(clientId); databaseStore.deleteMessage(messageUid); mIMap.put(messageUid, messageBundle, 7, TimeUnit.DAYS); ackPayload.writeBytes(recalledContent.getBytes(StandardCharsets.UTF_8)); return ErrorCode.ERROR_CODE_SUCCESS; } else { return ErrorCode.ERROR_CODE_NOT_EXIST; } } public ErrorCode recallCastMessage(long messageUid, String operatorId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(MESSAGES_MAP); MessageBundle messageBundle = mIMap.get(messageUid); if (messageBundle != null) { WFCMessage.Message message = messageBundle.getMessage(); message = message.toBuilder().setContent(WFCMessage.MessageContent.newBuilder().setContent(operatorId).setType(80).setData(ByteString.copyFrom(String.valueOf(messageUid).getBytes()))).build(); messageBundle.setMessage(message); messageBundle.setFromClientId(null); databaseStore.deleteMessage(messageUid); mIMap.set(messageUid, messageBundle, 7, TimeUnit.DAYS); return ErrorCode.ERROR_CODE_SUCCESS; } else { return ErrorCode.ERROR_CODE_NOT_EXIST; } } @Override public void clearUserMessages(String userId) { mWriteLock.lock(); try { userMessages.remove(userId); } finally { mWriteLock.unlock(); } if(!keepMessagesWhenDestroyUser) { databaseStore.clearUserMessage(userId); } } @Override public WFCMessage.Robot getRobot(String robotId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mRobotMap = hzInstance.getMap(ROBOTS); return mRobotMap.get(robotId); } @Override public void addRobot(WFCMessage.Robot robot) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mUserMap = hzInstance.getMap(ROBOTS); mUserMap.put(robot.getUid(), robot); } @Override public void destroyRobot(String robotId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mUserMap = hzInstance.getMap(ROBOTS); mUserMap.remove(robotId); } @Override public ErrorCode getUserInfo(String fromUser, List requestList, WFCMessage.PullUserResult.Builder builder) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mUserMap = hzInstance.getMap(USERS); for (WFCMessage.UserRequest request : requestList ) { WFCMessage.User user = mUserMap.get(request.getUid()); if (user == null) { user = databaseStore.getPersistUser(request.getUid()); if (user != null) { mUserMap.set(request.getUid(), user); } } WFCMessage.UserResult.Builder resultBuilder = WFCMessage.UserResult.newBuilder(); if (user == null) { LOG.warn("Get user info, user {} not exist", request.getUid()); user = WFCMessage.User.newBuilder().setUid(request.getUid()).build(); resultBuilder.setUser(user); resultBuilder.setCode(ProtoConstants.UserResultCode.NotFound); } else { LOG.debug("Get user info, user {} userDt {} : request {}",request.getUid(), user.getUpdateDt(), request.getUpdateDt()); if (user.getUpdateDt() > request.getUpdateDt()) { if(!mUserHideProperties.isEmpty() && !user.getUid().equals(fromUser)) { WFCMessage.User.Builder userBuilder = user.toBuilder(); for (Integer i:mUserHideProperties) { if(i == Modify_Gender) { userBuilder.clearGender(); } else if(i == Modify_Mobile) { userBuilder.clearMobile(); } else if(i == Modify_Email) { userBuilder.clearEmail(); } else if(i == Modify_Address) { userBuilder.clearAddress(); } else if(i == Modify_Company) { userBuilder.clearCompany(); } else if(i == Modify_Social) { userBuilder.clearSocial(); } else if(i == Modify_Extra) { userBuilder.clearExtra(); } } user = userBuilder.build(); } resultBuilder.setUser(user); resultBuilder.setCode(ProtoConstants.UserResultCode.Success); } else { user = WFCMessage.User.newBuilder().setUid(request.getUid()).build(); resultBuilder.setUser(user); resultBuilder.setCode(ProtoConstants.UserResultCode.NotModified); } } builder.addResult(resultBuilder.build()); } return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode modifyUserInfo(String userId, WFCMessage.ModifyMyInfoRequest request) throws Exception { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mUserMap = hzInstance.getMap(USERS); WFCMessage.User user = mUserMap.get(userId); if (user == null) { user = databaseStore.getPersistUser(userId); if (user != null) { mUserMap.set(userId, user); } else { return ErrorCode.ERROR_CODE_NOT_EXIST; } } WFCMessage.User.Builder builder = user.toBuilder(); boolean modified = false; for (WFCMessage.InfoEntry entry : request.getEntryList() ) { switch (entry.getType()) { case Modify_DisplayName: if(!StringUtil.isNullOrEmpty(entry.getValue())) { if (!mSensitiveOnlyMessage) { Set matched = handleSensitiveWord(entry.getValue()); if (matched != null && !matched.isEmpty()) { return ErrorCode.ERROR_CODE_SENSITIVE_MATCHED; } } if(!isAllowName(entry.getValue())) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } } builder.setDisplayName(entry.getValue()); modified = true; break; case Modify_Gender: builder.setGender(Integer.parseInt(entry.getValue())); modified = true; break; case Modify_Portrait: builder.setPortrait(entry.getValue()); modified = true; break; //禁止客户端直接修改电话号码,只能通过admin api来修改 // case Modify_Mobile: // builder.setMobile(entry.getValue()); // modified = true; // break; case Modify_Email: builder.setEmail(entry.getValue()); modified = true; break; case Modify_Address: builder.setAddress(entry.getValue()); modified = true; break; case Modify_Company: builder.setCompany(entry.getValue()); modified = true; break; case Modify_Social: builder.setSocial(entry.getValue()); modified = true; break; case Modify_Extra: builder.setExtra(entry.getValue()); modified = true; break; default: break; } } if (modified) { builder.setUpdateDt(System.currentTimeMillis()); user = builder.build(); databaseStore.updateUser(user); mUserMap.set(userId, user); IMHandler.getPublisher().publishNotification(IMTopic.NotifyUserInfoTopic, user.getUid(), 0, null); callbackUserInfoEvent(user); return ErrorCode.ERROR_CODE_SUCCESS; } else { return ErrorCode.ERROR_CODE_NOT_MODIFIED; } } public void forceCleanOnlineStatus(String userId, String clientId) { if (m_Server.isShutdowning()) { return; } if(!mMultiPlatformNotification || m_Server.getStore().sessionsStore().isMultiEndpointSupported()) { WFCMessage.UserSettingEntry pcentry = getUserSetting(userId, kUserSettingPCOnline, "PC"); if (pcentry != null && !StringUtil.isNullOrEmpty(pcentry.getValue()) && pcentry.getValue().contains(clientId)) { updateUserSettings(userId, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("PC").setValue("").build(), clientId); } WFCMessage.UserSettingEntry padentry = getUserSetting(userId, kUserSettingPCOnline, "Pad"); if (padentry != null && !StringUtil.isNullOrEmpty(padentry.getValue()) && padentry.getValue().contains(clientId)) { updateUserSettings(userId, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("Pad").setValue("").build(), clientId); } } } private boolean isOnlineValueEqual(WFCMessage.UserSettingEntry pcentry, String newValue) { if(pcentry == null) { return StringUtil.isNullOrEmpty(newValue); } String oldValue = pcentry.getValue(); if(StringUtil.isNullOrEmpty(oldValue) && StringUtil.isNullOrEmpty(newValue)) { return true; } if(StringUtil.isNullOrEmpty(oldValue) || StringUtil.isNullOrEmpty(newValue)) { return false; } String[] ssOld = oldValue.split("\\|"); String[] ssNew = newValue.split("\\|"); if(ssOld.length != 4 || ssNew.length != 4 || !ssOld[1].equals(ssNew[1]) || !ssOld[2].equals(ssNew[2]) || !ssOld[3].equals(ssNew[3])) { return false; } return true; } @Override public void updateUserOnlineSetting(MemorySessionStore.Session session, boolean online) { if(!mMultiPlatformNotification) { return; } if (m_Server.getStore().sessionsStore().isMultiEndpointSupported()) { return; } if (m_Server.isShutdowning()) { return; } String pcValue = null; String padValue = null; String wearableValue = null; String tvValue = null; for (MemorySessionStore.Session s : m_Server.getStore().sessionsStore().sessionForUser(session.username)) { if (s.getDeleted() != 0 || !m_Server.getConnectionsManager().isConnected(s.getClientID())) { continue; } switch (s.getPlatform()) { case Platform_LINUX: case Platform_Windows: case Platform_OSX: case Platform_HarmonyPC: pcValue = System.currentTimeMillis() + "|" + s.getPlatform() + "|" + s.getClientID() + "|" + s.getPhoneName(); break; case Platform_iPad: case Platform_APad: case Platform_HarmonyPad: padValue = System.currentTimeMillis() + "|" + s.getPlatform() + "|" + s.getClientID() + "|" + s.getPhoneName(); break; case Platform_AndroidWearable: case Platform_HarmonyWearable: wearableValue = System.currentTimeMillis() + "|" + s.getPlatform() + "|" + s.getClientID() + "|" + s.getPhoneName(); break; case Platform_AndroidTV: case Platform_AppleTV: case Platform_HarmonyTV: tvValue = System.currentTimeMillis() + "|" + s.getPlatform() + "|" + s.getClientID() + "|" + s.getPhoneName(); break; default: break; } } WFCMessage.UserSettingEntry pcentry = getUserSetting(session.getUsername(), kUserSettingPCOnline, "PC"); if (!isOnlineValueEqual(pcentry, pcValue)) { updateUserSettings(session.username, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("PC").setValue(pcValue==null?"":pcValue).build(), session.clientID); } WFCMessage.UserSettingEntry padentry = getUserSetting(session.getUsername(), kUserSettingPCOnline, "Pad"); if (!isOnlineValueEqual(padentry, padValue)) { updateUserSettings(session.username, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("Pad").setValue(padValue==null?"":padValue).build(), session.clientID); } WFCMessage.UserSettingEntry wearableEntry = getUserSetting(session.getUsername(), kUserSettingPCOnline, "Wearable"); if (!isOnlineValueEqual(wearableEntry, wearableValue)) { updateUserSettings(session.username, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("Wearable").setValue(wearableValue==null?"":wearableValue).build(), session.clientID); } WFCMessage.UserSettingEntry tvEntry = getUserSetting(session.getUsername(), kUserSettingPCOnline, "TV"); if (!isOnlineValueEqual(tvEntry, tvValue)) { updateUserSettings(session.username, WFCMessage.ModifyUserSettingReq.newBuilder().setScope(kUserSettingPCOnline).setKey("TV").setValue(tvValue==null?"":tvValue).build(), session.clientID); } } @Override public ErrorCode modifyUserStatus(String userId, int status) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mUserMap = hzInstance.getMap(USER_STATUS); if (status == 0) { mUserMap.delete(userId); } else { mUserMap.put(userId, status); } return ErrorCode.ERROR_CODE_SUCCESS; } @Override public int getUserStatus(String userId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mUserMap = hzInstance.getMap(USER_STATUS); Integer status = mUserMap.get(userId); if (status != null) { return status; } return 0; } @Override public List getUserStatusList() { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mUserMap = hzInstance.getMap(USER_STATUS); ArrayList out = new ArrayList<>(); for (Map.Entry entry : mUserMap.entrySet()) { if(entry.getValue() > 0) { out.add(new InputOutputUserBlockStatus(entry.getKey(), entry.getValue())); } } return out; } @Override public ErrorCode updateUserInfo(InputOutputUserInfo userInfo, int flag) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mUserMap = hzInstance.getMap(USERS); WFCMessage.User user = mUserMap.get(userInfo.getUserId()); if(user == null) { return ErrorCode.ERROR_CODE_NOT_EXIST; } WFCMessage.User.Builder builder = user.toBuilder(); if((flag & Update_User_DisplayName) > 0) { builder.setDisplayName(userInfo.getDisplayName() == null ? "" : userInfo.getDisplayName()); } if((flag & Update_User_Portrait) > 0) { builder.setPortrait(userInfo.getPortrait() == null ? "" : userInfo.getPortrait()); } if((flag & Update_User_Gender) > 0) { builder.setGender(userInfo.getGender()); } if((flag & Update_User_Mobile) > 0) { builder.setMobile(userInfo.getMobile() == null ? "" : userInfo.getMobile()); } if((flag & Update_User_Email) > 0) { builder.setEmail(userInfo.getEmail() == null ? "" : userInfo.getEmail()); } if((flag & Update_User_Address) > 0) { builder.setAddress(userInfo.getAddress() == null ? "" : userInfo.getAddress()); } if((flag & Update_User_Company) > 0) { builder.setCompany(userInfo.getCompany() == null ? "" : userInfo.getCompany()); } if((flag & Update_User_Social) > 0) { builder.setSocial(userInfo.getSocial() == null ? "" : userInfo.getSocial()); } if((flag & Update_User_Extra) > 0) { builder.setExtra(userInfo.getExtra() == null ? "" : userInfo.getExtra()); } if((flag & Update_User_Name) > 0) { if(StringUtil.isNullOrEmpty(userInfo.getName())) { LOG.error("Modify user info failure, name not exist!"); return ErrorCode.INVALID_PARAMETER; } builder.setName(userInfo.getName()); } builder.setUpdateDt(System.currentTimeMillis()); user = builder.build(); try { databaseStore.updateUser(user); } catch (Exception e) { e.printStackTrace(); return ErrorCode.ERROR_CODE_SERVER_ERROR; } IMHandler.getPublisher().publishNotification(IMTopic.NotifyUserInfoTopic, user.getUid(), 0, null); mUserMap.put(user.getUid(), user); callbackUserInfoEvent(user); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public void addUserInfo(WFCMessage.User user) throws Exception { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mUserMap = hzInstance.getMap(USERS); if (databaseStore.isUidAndNameConflict(user.getUid(), user.getName())) { throw new Exception("用户名不能重复,必须唯一!!!"); } databaseStore.updateUser(user); mUserMap.put(user.getUid(), user); callbackUserInfoEvent(user); } @Override public void destroyUser(String userId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mUserMap = hzInstance.getMap(USERS); WFCMessage.User us = mUserMap.get(userId); if (us != null) { WFCMessage.User.Builder builder = us.toBuilder().setUpdateDt(System.currentTimeMillis()).setDeleted(1); if(keepFullInfoWhenDestroyUser) { if(!keepMobileWhenDestroyUser) { builder.clearMobile(); } } else { builder.setUid(userId) .setName(userId) .clearAddress() .clearCompany() .clearEmail() .clearExtra() .clearMobile() .clearPortrait() .clearGender() .clearSocial(); if (!keepDisplayNameWhenDestroyUser) { builder.clearDisplayName(); } } us = builder.build(); try { databaseStore.updateUser(us); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } mUserMap.put(userId, us); } } @Override public void updateUserInfo(WFCMessage.User user) throws Exception { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mUserMap = hzInstance.getMap(USERS); if(mUserMap.get(user.getUid()) != null) { databaseStore.updateUser(user); mUserMap.put(user.getUid(), user); } } @Override public WFCMessage.User getUserInfo(String userId) { if (StringUtil.isNullOrEmpty(userId)) { return null; } HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mUserMap = hzInstance.getMap(USERS); WFCMessage.User user = mUserMap.get(userId); return user; } @Override public WFCMessage.User getUserInfoByName(String name) { String userId = databaseStore.getUserIdByName(name); return getUserInfo(userId); } @Override public WFCMessage.User getUserInfoByMobile(String mobile) { String userId = databaseStore.getUserIdByMobile(mobile); return getUserInfo(userId); } @Override public List getUserInfosByEmail(String email) { return databaseStore.getUserInfosByEmail(email); } @Override public List getUserInfoList(int count, int offset) { return databaseStore.getAllUsers(count, offset); } @Override public List getUserRobotIds(String userId) { return databaseStore.getUserRobotIds(userId); } // 电话号码校验正则表达式(支持中国大陆手机号和固话) private static final String PHONE_REGEX = "^\\s*" + // 允许开头空白 "(?:" + "(1[0-9])\\d{9}" + "|" + "((0\\d{2,3})|(\\(0\\d{2,3}\\)))" + "[-\\s.]?" + "\\d{7,8}" + "|" + "\\d{7,8}" + ")\\s*$"; private static final Pattern PHONE_PATTERN = Pattern.compile(PHONE_REGEX); private static final Pattern PHONE_PART_PATTERN = Pattern.compile("^1\\d{0,10}$"); public static boolean isPhoneNumber(String phone) { if (phone == null || phone.trim().isEmpty()) { return false; } Matcher matcher = PHONE_PATTERN.matcher(phone); return matcher.matches(); } public static boolean isPhoneNumberPart(String str) { if (str == null || str.trim().isEmpty()) { return false; } Matcher matcher = PHONE_PART_PATTERN.matcher(str); return matcher.matches(); } @Override public ErrorCode searchUser(String userId, String keyword, int searchType, int userType, int page, List users) { if (mDisableSearch) { return ErrorCode.ERROR_CODE_NOT_IMPLEMENT; } if (mDisableNicknameSearch && searchType == ProtoConstants.SearchUserType.SearchUserType_General) { searchType = ProtoConstants.SearchUserType.SearchUserType_Name_Mobile_UserId; } if(mDisableUserIdSearch && searchType == ProtoConstants.SearchUserType.SearchUserType_Name_Mobile_UserId) { searchType = ProtoConstants.SearchUserType.SearchUserType_Name_Mobile; } if(mDisableUserIdSearch && searchType == ProtoConstants.SearchUserType.SearchUserType_General) { searchType = ProtoConstants.SearchUserType.SearchUserType_Name_Mobile_DisplayName; } if(mDisableUserIdSearch && searchType == ProtoConstants.SearchUserType.SearchUserType_UserId) { return ErrorCode.ERROR_CODE_NOT_IMPLEMENT; } if(mFriendSearchRateLimiter != null && !isPhoneNumberPart(keyword)) { //非电话号码,允许多少次搜索。 if(!mFriendSearchRateLimiter.isGranted(userId)) { LOG.error("User {} search user mobile over frequency, keyword {}, searchType {}", userId, keyword, searchType); return ErrorCode.ERROR_CODE_OVER_FREQUENCY; } } List matchedUsers = databaseStore.searchUserFromDB(keyword, searchType, userType, page); if(mFriendSearchEmpthMobileRateLimiter != null && matchedUsers.isEmpty() && isPhoneNumber(keyword)) { //查电话号码为空 if(!mFriendSearchEmpthMobileRateLimiter.isGranted(userId)) { LOG.error("User {} search user over frequency, keyword {}, searchType {}", userId, keyword, searchType); return ErrorCode.ERROR_CODE_OVER_FREQUENCY; } } users.addAll(matchedUsers); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public boolean updateSystemSetting(int id, String value, String desc) { return databaseStore.updateSystemSetting(id, value, desc); } @Override public SystemSettingPojo getSystemSetting(int id) { return databaseStore.getSystemSetting(id); } @Override public void createChatroom(String chatroomId, WFCMessage.ChatroomInfo chatroomInfo) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap chatroomInfoMap = hzInstance.getMap(CHATROOMS); WFCMessage.ChatroomInfo preInfo = chatroomInfoMap.get(chatroomId); if (preInfo != null) { WFCMessage.ChatroomInfo.Builder builder = preInfo.toBuilder(); if (!StringUtil.isNullOrEmpty(chatroomInfo.getTitle())) { builder.setTitle(chatroomInfo.getTitle()); } if (!StringUtil.isNullOrEmpty(chatroomInfo.getDesc())) { builder.setDesc(chatroomInfo.getDesc()); } if (!StringUtil.isNullOrEmpty(chatroomInfo.getPortrait())) { builder.setPortrait(chatroomInfo.getPortrait()); } if (!StringUtil.isNullOrEmpty(chatroomInfo.getExtra())) { builder.setExtra(chatroomInfo.getExtra()); } builder.setState(chatroomInfo.getState()); chatroomInfo = builder.build(); } chatroomInfoMap.put(chatroomId, chatroomInfo); callbackChatroomInfoUpdateEvent(chatroomId, Chatroom_Event_Create); } @Override public void destoryChatroom(String chatroomId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap chatroomInfoMap = hzInstance.getMap(CHATROOMS); WFCMessage.ChatroomInfo room = chatroomInfoMap.get(chatroomId); if (room != null) { clearChatroomMembers(chatroomId); room = room.toBuilder().setUpdateDt(System.currentTimeMillis()).setState(ProtoConstants.ChatroomState.Chatroom_State_End).build(); chatroomInfoMap.put(chatroomId, room); callbackChatroomInfoUpdateEvent(chatroomId, Chatroom_Event_Destroy); } } @Override public WFCMessage.ChatroomInfo getChatroomInfo(String chatroomId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap chatroomInfoMap = hzInstance.getMap(CHATROOMS); return chatroomInfoMap.get(chatroomId); } @Override public WFCMessage.ChatroomMemberInfo getChatroomMemberInfo(String chatroomId, final int maxMemberCount) { MultiMap chatroomMembers = m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS); Collection members = chatroomMembers.get(chatroomId); if (members != null) { ArrayList memberIds = new ArrayList<>(); if (members.size() <= maxMemberCount) { members.stream().forEach(new Consumer() { @Override public void accept(UserClientEntry userClientEntry) { memberIds.add(userClientEntry.userId); } }); } else { Spliterator p = members.spliterator(); while (p.estimateSize() > 2*maxMemberCount) { p = p.trySplit(); } p.forEachRemaining(new Consumer() { public void accept(UserClientEntry s) { if (memberIds.size() < maxMemberCount) { memberIds.add(s.userId); } } }); } return WFCMessage.ChatroomMemberInfo.newBuilder().setMemberCount(members.size()).addAllMembers(memberIds).build(); } return WFCMessage.ChatroomMemberInfo.newBuilder().setMemberCount(0).build(); } @Override public int getChatroomMemberCount(String chatroomId) { return m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS).valueCount(chatroomId); } @Override public ErrorCode verifyToken(String userId, String token, List serverIPs, List ports) { String tokenUserId = Tokenor.getUserId(token.getBytes()); if (tokenUserId != null) { if (tokenUserId.equals(userId)) { String serverIp = m_Server.getServerIp(); String longPort = m_Server.getLongPort(); String shortPort = m_Server.getShortPort(); if (!StringUtil.isNullOrEmpty(serverIp)) { serverIPs.add(serverIp); } ports.add(Integer.parseInt(longPort)); ports.add(Integer.parseInt(shortPort)); } else { return ErrorCode.ERROR_CODE_TOKEN_ERROR; } } else { return ErrorCode.ERROR_CODE_TOKEN_ERROR; } return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode isAllowUserMessage(String targetUser, String fromUser, int line) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); Collection friendDatas = friendsMap.get(targetUser); if (friendDatas == null || friendDatas.size() == 0) { friendDatas = loadFriend(friendsMap, targetUser); } for (FriendData friendData : friendDatas) { if (friendData.getFriendUid().equals(fromUser)) { if (friendData.getBlacked() == 1) { return ErrorCode.ERROR_CODE_IN_BLACK_LIST; } else { if (friendData.getState() == 0) { return ErrorCode.ERROR_CODE_SUCCESS; } else { break; } } } } if (mDisableStrangerChat) { //在禁止私聊时,是否是允许私聊的用户id if(mAllowStrangerChatSet.contains(targetUser) || mAllowStrangerChatSet.contains(fromUser) || mAllowStrangerLineSet.contains(line)) { return ErrorCode.ERROR_CODE_SUCCESS; } //在禁止私聊时,允许机器人,物联网设备及管理员进行私聊。 IMap mUserMap = hzInstance.getMap(USERS); WFCMessage.User target = mUserMap.get(targetUser); if (target != null && target.getType() != ProtoConstants.UserType.UserType_Normal) { return ErrorCode.ERROR_CODE_SUCCESS; } target = mUserMap.get(fromUser); if (target != null && target.getType() != ProtoConstants.UserType.UserType_Normal) { return ErrorCode.ERROR_CODE_SUCCESS; } //admin的usertype为3,所以不需要hardcode为admin添加例外 // if (targetUser.equals("admin") || fromUser.equals("admin")) { // return ErrorCode.ERROR_CODE_SUCCESS; // } return ErrorCode.ERROR_CODE_NOT_RIGHT; } return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode isBlacked(String fromUser, String userId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); Collection friendDatas = friendsMap.get(fromUser); if (friendDatas == null || friendDatas.size() == 0) { friendDatas = loadFriend(friendsMap, fromUser); } for (FriendData friendData : friendDatas) { if (friendData.getFriendUid().equals(userId)) { if (friendData.getBlacked() == 1) { return ErrorCode.ERROR_CODE_IN_BLACK_LIST; } else { break; } } } return ErrorCode.ERROR_CODE_SUCCESS; } synchronized Collection loadFriend(MultiMap friendsMap, String userId) { Collection friends = databaseStore.getPersistFriends(userId); if (friends != null) { for (FriendData friend : friends) { friendsMap.put(userId, friend); } } else { friends = new ArrayList<>(); } return friends; } synchronized Collection loadFriendRequest(MultiMap requestMap, String userId) { Collection requests = databaseStore.getPersistFriendRequests(userId); if (requests != null) { for (WFCMessage.FriendRequest r : requests ) { requestMap.put(userId, r); } } else { requests = new ArrayList<>(); } return requests; } @Override public List getFriendList(String userId, String clientId, long version) { List out = new ArrayList(); HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); Collection friends = friendsMap.get(userId); if (friends == null || friends.size() == 0) { friends = loadFriend(friendsMap, userId); } boolean needFriendMigrate = false; if (!StringUtil.isNullOrEmpty(clientId)) { MemorySessionStore.Session session = m_Server.getStore().sessionsStore().getSession(clientId); if(session != null && session.getMqttVersion() != null && session.getMqttVersion().protocolLevel() < MqttVersion.Wildfire_2.protocolLevel()) { needFriendMigrate = true; } } for (FriendData friend : friends) { if (friend.getTimestamp() > version) { if (needFriendMigrate) { if (friend.getBlacked() > 0) { friend.setState(2); } out.add(friend); } else { out.add(friend); } } } if(mSyncDataPartSize > 0 && out.size() > mSyncDataPartSize) { out.sort(Comparator.comparingLong(FriendData::getTimestamp)); out = out.subList(0, mSyncDataPartSize); } return out; } @Override public void clearUserFriend(String userId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); Collection friendDatas = friendsMap.get(userId); if (friendDatas == null || friendDatas.size() == 0) { friendDatas = loadFriend(friendsMap, userId); } databaseStore.removeUserFriend(userId); databaseStore.removeUserFriendRequest(userId); MultiMap requestMap = hzInstance.getMultiMap(USER_FRIENDS_REQUEST); requestMap.remove(userId); if (friendDatas != null) { for (FriendData fd : friendDatas) { friendsMap.remove(fd.getFriendUid()); } friendsMap.remove(userId); } } @Override public List getFriendRequestList(String userId, long version) { List out = new ArrayList<>(); HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap requestMap = hzInstance.getMultiMap(USER_FRIENDS_REQUEST); Collection requests = requestMap.get(userId); if (requests == null || requests.size() == 0) { requests = loadFriendRequest(requestMap, userId); } for (WFCMessage.FriendRequest request : requests) { if (request.getUpdateDt() > version) { out.add(request); } } if(mSyncDataPartSize > 0 && out.size() > mSyncDataPartSize) { out.sort(Comparator.comparingLong(WFCMessage.FriendRequest::getUpdateDt)); out = out.subList(0, mSyncDataPartSize); } return out; } @Override public ErrorCode saveAddFriendRequest(String userId, WFCMessage.AddFriendRequest request, long[] head, boolean isAdmin, boolean isRobot) { if (!isAdmin && mDisableFriendRequest) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } if(!isRobot && !isAdmin && mFriendRateLimiter != null) { if(!mFriendRateLimiter.isGranted(userId)) { LOG.error("User {} request add friend over frequency", userId); return ErrorCode.ERROR_CODE_OVER_FREQUENCY; } } HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap requestMap = hzInstance.getMultiMap(USER_FRIENDS_REQUEST); WFCMessage.UserSettingEntry userSettingData = getUserSetting(request.getTargetUid(), kUserSettingAddFriendStrategy, ""); boolean noVerify = userSettingData != null && "1".equals(userSettingData.getValue()); boolean noAllow = userSettingData != null && "2".equals(userSettingData.getValue()); if(noAllow) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } Collection requests = requestMap.get(userId); if (requests == null || requests.size() == 0) { requests = loadFriendRequest(requestMap, userId); } WFCMessage.FriendRequest existRequest = null; for (WFCMessage.FriendRequest tmpRequest : requests) { if (tmpRequest.getToUid().equals(request.getTargetUid())) { existRequest = tmpRequest; break; } } if (!noVerify && existRequest != null && existRequest.getStatus() != ProtoConstants.FriendRequestStatus.RequestStatus_Accepted && !isAdmin) { if (existRequest.getStatus() == ProtoConstants.FriendRequestStatus.RequestStatus_Rejected && System.currentTimeMillis() - existRequest.getUpdateDt() < mFriendRejectDuration) { return ErrorCode.ERROR_CODE_FRIEND_REQUEST_BLOCKED; } if (!(mFriendRequestDuration > 0 && System.currentTimeMillis() - existRequest.getUpdateDt() > mFriendRequestDuration)) { if(System.currentTimeMillis() - existRequest.getUpdateDt() > 5 * 60 * 1000) { return ErrorCode.ERROR_CODE_FRIEND_ALREADY_REQUEST; } else { mWriteLock.lock(); try { String repeatKey = userId + "-" + existRequest.getToUid(); Long lastTime = repeatFriendRequest.get(repeatKey); if(lastTime != null && System.currentTimeMillis() - lastTime < 5 * 60 * 1000) { return ErrorCode.ERROR_CODE_FRIEND_ALREADY_REQUEST; } repeatFriendRequest.put(repeatKey, System.currentTimeMillis()); } finally { mWriteLock.unlock(); } } } } FriendData friendData1 = getFriendData(userId, request.getTargetUid()); if (friendData1 != null && friendData1.getState() == 0) { return ErrorCode.ERROR_CODE_ALREADY_FRIENDS; } FriendData friendData2 = getFriendData(request.getTargetUid(), userId); if (friendData2 != null && friendData2.getBlacked() > 0 && !isAdmin) { return ErrorCode.ERROR_CODE_IN_BLACK_LIST; } WFCMessage.FriendRequest newRequest = WFCMessage.FriendRequest .newBuilder() .setFromUid(userId) .setToUid(request.getTargetUid()) .setReason(request.getReason()) .setExtra(request.getExtra()) .setStatus(ProtoConstants.FriendRequestStatus.RequestStatus_Sent) .setToReadStatus(noVerify) .setUpdateDt(System.currentTimeMillis()) .build(); databaseStore.persistOrUpdateFriendRequest(newRequest); requestMap.remove(userId); requestMap.remove(request.getTargetUid()); if(noVerify) { WFCMessage.HandleFriendRequest handleFriendRequest = WFCMessage.HandleFriendRequest.newBuilder().setTargetUid(userId).setStatus(ProtoConstants.FriendRequestStatus.RequestStatus_Accepted).build(); ServerAPIHelper.sendRequest(request.getTargetUid(), null, IMTopic.HandleFriendRequestTopic, handleFriendRequest.toByteArray(), null, ProtoConstants.RequestSourceType.Request_From_User); } head[0] = newRequest.getUpdateDt(); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode SyncFriendRequestUnread(String userId, long unreadDt, long[] head) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap requestMap = hzInstance.getMultiMap(USER_FRIENDS_REQUEST); long curTS = System.currentTimeMillis(); head[0] = curTS; databaseStore.persistFriendRequestUnreadStatus(userId, unreadDt, curTS); requestMap.remove(userId); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode handleFriendRequest(String userId, WFCMessage.HandleFriendRequest request, WFCMessage.Message.Builder msgBuilder, long[] heads, boolean isAdmin) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); boolean alreadyFriend = false; if(!isAdmin && request.getStatus() == ProtoConstants.FriendRequestStatus.RequestStatus_Accepted) { MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); Collection friends = friendsMap.get(userId); if (friends == null || friends.size() == 0) { friends = loadFriend(friendsMap, userId); } for (FriendData fd : friends) { if (fd.getFriendUid().equals(request.getTargetUid())) { if (fd.getState() == 0) { alreadyFriend = true; } break; } } } if (isAdmin) { MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); FriendData friendData1 = null; Collection friendDatas = friendsMap.get(userId); if (friendDatas == null || friendDatas.size() == 0) { friendDatas = loadFriend(friendsMap, userId); } for (FriendData fd : friendDatas) { if (fd.getFriendUid().equals(request.getTargetUid())) { friendData1 = fd; break; } } if (friendData1 == null) { friendData1 = new FriendData(userId, request.getTargetUid(), "", request.getExtra(), request.getStatus(), 0, System.currentTimeMillis()); } else { friendData1.setState(request.getStatus()); friendData1.setExtra(request.getExtra()); friendData1.setTimestamp(System.currentTimeMillis()); } databaseStore.persistOrUpdateFriendData(friendData1); if (request.getStatus() != 2) { FriendData friendData2 = null; friendDatas = friendsMap.get(request.getTargetUid()); if (friendDatas == null || friendDatas.size() == 0) { friendDatas = loadFriend(friendsMap, request.getTargetUid()); } for (FriendData fd : friendDatas) { if (fd.getFriendUid().equals(userId)) { friendData2 = fd; break; } } if (friendData2 == null) { friendData2 = new FriendData(request.getTargetUid(), userId, "", request.getExtra(), request.getStatus(), 0, friendData1.getTimestamp()); } else { friendsMap.remove(request.getTargetUid(), friendData2); friendData2.setState(request.getStatus()); friendData2.setTimestamp(System.currentTimeMillis()); } databaseStore.persistOrUpdateFriendData(friendData2); heads[0] = friendData2.getTimestamp(); } else { heads[0] = 0; } heads[1] = friendData1.getTimestamp(); friendsMap.remove(userId); friendsMap.remove(request.getTargetUid()); callbackRelationEvent(userId, request.getTargetUid(), 0, request.getStatus() == 0?"1":"0"); return ErrorCode.ERROR_CODE_SUCCESS; } MultiMap requestMap = hzInstance.getMultiMap(USER_FRIENDS_REQUEST); Collection requests = requestMap.get(userId); if (requests == null || requests.size() == 0) { requests = loadFriendRequest(requestMap, userId); } WFCMessage.FriendRequest existRequest = null; for (WFCMessage.FriendRequest tmpRequest : requests) { if (tmpRequest.getFromUid().equals(request.getTargetUid())) { existRequest = tmpRequest; break; } } if (existRequest != null) { if (!alreadyFriend && mFriendRequestExpiration > 0 && System.currentTimeMillis() - existRequest.getUpdateDt() > mFriendRequestExpiration) { return ErrorCode.ERROR_CODE_FRIEND_REQUEST_EXPIRED; } else { existRequest = existRequest.toBuilder().setStatus(request.getStatus()).setUpdateDt(System.currentTimeMillis()).build(); heads[2] = existRequest.getUpdateDt(); heads[3] = existRequest.getUpdateDt(); databaseStore.persistOrUpdateFriendRequest(existRequest); if (request.getStatus() == ProtoConstants.FriendRequestStatus.RequestStatus_Accepted) { Collection targetRequests = requestMap.get(request.getTargetUid()); if (targetRequests == null || targetRequests.size() == 0) { targetRequests = loadFriendRequest(requestMap, request.getTargetUid()); } WFCMessage.FriendRequest existTargetRequest = null; for (WFCMessage.FriendRequest tmpRequest : targetRequests) { if (tmpRequest.getFromUid().equals(userId)) { existTargetRequest = tmpRequest; break; } } if (existTargetRequest != null && existTargetRequest.getStatus() == ProtoConstants.FriendRequestStatus.RequestStatus_Sent) { existTargetRequest = existTargetRequest.toBuilder().setStatus(request.getStatus()).setUpdateDt(existRequest.getUpdateDt()).build(); databaseStore.persistOrUpdateFriendRequest(existTargetRequest); } } if(!alreadyFriend && request.getStatus() == ProtoConstants.FriendRequestStatus.RequestStatus_Accepted){ MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); FriendData friendData1 = new FriendData(userId, request.getTargetUid(), "", request.getExtra(), 0, 0, System.currentTimeMillis()); databaseStore.persistOrUpdateFriendData(friendData1); FriendData friendData2 = new FriendData(request.getTargetUid(), userId, "", request.getExtra(), 0, 0, friendData1.getTimestamp()); databaseStore.persistOrUpdateFriendData(friendData2); requestMap.remove(userId); requestMap.remove(request.getTargetUid()); friendsMap.remove(userId); friendsMap.remove(request.getTargetUid()); heads[0] = friendData2.getTimestamp(); heads[1] = friendData1.getTimestamp(); msgBuilder.setConversation(WFCMessage.Conversation.newBuilder().setTarget(userId).setLine(0).setType(ProtoConstants.ConversationType.ConversationType_Private).build()); msgBuilder.setContent(WFCMessage.MessageContent.newBuilder().setType(1).setSearchableContent(existRequest.getReason()).build()); callbackRelationEvent(userId, request.getTargetUid(), 0, "1"); } if(alreadyFriend) { return ErrorCode.ERROR_CODE_ALREADY_FRIENDS; } return ErrorCode.ERROR_CODE_SUCCESS; } } else { return ErrorCode.ERROR_CODE_NOT_EXIST; } } @Override public ErrorCode blackUserRequest(String fromUser, String targetUserId, int state, long[] heads) { if(state != 0 && state != 1 && state != 2){ return ErrorCode.INVALID_PARAMETER; } if (state == 2) { state = 1; } else { state = 0; } HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); FriendData friendData = null; Collection friends = friendsMap.get(fromUser); if (friends == null || friends.size() == 0) { friends = loadFriend(friendsMap, fromUser); } for (FriendData fd:friends) { if (fd.getFriendUid().equals(targetUserId)) { friendData = fd; break; } } if (friendData == null) { friendData = new FriendData(fromUser, targetUserId, "", "", 1, state, System.currentTimeMillis()); } friendData.setBlacked(state); friendData.setTimestamp(System.currentTimeMillis()); databaseStore.persistOrUpdateFriendData(friendData); friendsMap.remove(fromUser); heads[0] = friendData.getTimestamp(); callbackRelationEvent(fromUser, targetUserId, 2, state+""); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public FriendData getFriendData(String fromUser, String targetUserId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); Collection friends = friendsMap.get(fromUser); if (friends == null || friends.size() == 0) { friends = loadFriend(friendsMap, fromUser); } for (FriendData fd:friends) { if (fd.getFriendUid().equals(targetUserId)) { return fd; } } return null; } @Override public ErrorCode setFriendAliasRequest(String fromUser, String targetUserId, String alias, long[] heads){ HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); FriendData friendData = null; Collection friends = friendsMap.get(fromUser); if (friends == null || friends.size() == 0) { friends = loadFriend(friendsMap, fromUser); } for (FriendData fd:friends) { if (fd.getFriendUid().equals(targetUserId)) { friendData = fd; break; } } if (friendData == null) { friendData = new FriendData(); friendData.setUserId(fromUser); friendData.setFriendUid(targetUserId); } friendData.setAlias(alias); friendData.setTimestamp(System.currentTimeMillis()); databaseStore.persistOrUpdateFriendData(friendData); heads[0] = friendData.getTimestamp(); friendsMap.remove(fromUser); callbackRelationEvent(fromUser, targetUserId, 1, alias); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode setFriendExtraRequest(String fromUser, String targetUserId, String extra, long[] heads){ HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); FriendData friendData = null; Collection friends = friendsMap.get(fromUser); if (friends == null || friends.size() == 0) { friends = loadFriend(friendsMap, fromUser); } for (FriendData fd:friends) { if (fd.getFriendUid().equals(targetUserId)) { friendData = fd; break; } } if (friendData == null) { friendData = new FriendData(); friendData.setUserId(fromUser); friendData.setFriendUid(targetUserId); } friendData.setExtra(extra); friendData.setTimestamp(System.currentTimeMillis()); databaseStore.persistOrUpdateFriendData(friendData); heads[0] = friendData.getTimestamp(); friendsMap.remove(fromUser); callbackRelationEvent(fromUser, targetUserId, 3, extra); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public boolean isAllowName(String name) { if(StringUtil.isNullOrEmpty(name)) { return true; } name = name.trim(); SystemSettingPojo notAllowNameSetting = getSystemSetting(ProtoConstants.SystemSettingType.NOT_ALLOW_USER_NAMES); if (notAllowNameSetting != null && !StringUtil.isNullOrEmpty(notAllowNameSetting.value)) { String[] ss = notAllowNameSetting.value.split(","); for (String s : ss) { if(name.contains(s.trim())) { return false; } } } return true; } @Override public ErrorCode handleJoinChatroom(String userId, String clientId, String chatroomId) { IMap chatroomInfoMap = m_Server.getHazelcastInstance().getMap(CHATROOMS); if (chatroomInfoMap == null || chatroomInfoMap.get(chatroomId) == null || chatroomInfoMap.get(chatroomId).getState() == ProtoConstants.ChatroomState.Chatroom_State_End) { if(mChatroomCreateWhenNotExist) { WFCMessage.ChatroomInfo.Builder builder = WFCMessage.ChatroomInfo.newBuilder().setTitle(chatroomId); createChatroom(chatroomId, builder.build()); } else { return ErrorCode.ERROR_CODE_NOT_EXIST; } } MultiMap chatroomMembers = m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS); String alreadyInChatroom = (String) m_Server.getHazelcastInstance().getMap(USER_CHATROOM).get(userId); if(alreadyInChatroom != null) { for (UserClientEntry userClientEntry : chatroomMembers.get(alreadyInChatroom)) { if(userClientEntry.userId.equals(userId)) { if(!chatroomId.equals(alreadyInChatroom) || !userClientEntry.clientId.equals(clientId)) { if(mChatroomKickoffOtherPlatform) { handleQuitChatroom(userId, userClientEntry.clientId, chatroomId); } else { return ErrorCode.ERROR_CODE_OTHER_CLIENT_ALREADY_IN_CHATROOM; } } } } } m_Server.getStore().sessionsStore().getSession(clientId).refreshLastChatroomActiveTime(); m_Server.getHazelcastInstance().getMap(USER_CHATROOM).put(userId, chatroomId); chatroomMembers.put(chatroomId, new UserClientEntry(userId, clientId)); mWriteLock.lock(); chatroomMessages.put(userId, new TreeMap<>()); mWriteLock.unlock(); callbackChatroomMemberEvent(userId, chatroomId, Arrays.asList(userId), Chatroom_Member_Event_Join); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode handleQuitChatroom(String userId, String clientId, String chatroomId) { m_Server.getHazelcastInstance().getMap(USER_CHATROOM).remove(userId); m_Server.getHazelcastInstance().getMultiMap(CHATROOM_MEMBER_IDS).remove(chatroomId, new UserClientEntry(userId, clientId)); mWriteLock.lock(); chatroomMessages.remove(userId); mWriteLock.unlock(); callbackChatroomMemberEvent(userId, chatroomId, Arrays.asList(userId), Chatroom_Member_Event_Leave); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public boolean checkChatroomParticipantIdelTime(MemorySessionStore.Session session) { if (session == null) { return false; } if(mChatroomParticipantIdleTime > 0 && System.currentTimeMillis() - session.getLastChatroomActiveTime() > mChatroomParticipantIdleTime) { return false; } return true; } private String ensureSecretLength(String secret) { while ( secret.length() < AES.keyLen) { secret += "w"; secret += secret; } return secret; } @Override public String getApplicationAuthCode(String fromUser, String applicationId, int type, String host) { String secret = null; if(type == ProtoConstants.ApplicationType.ApplicationType_Robot) { WFCMessage.Robot robotData = getRobot(applicationId); if(robotData != null && !StringUtil.isNullOrEmpty(robotData.getCallback()) && !StringUtil.isNullOrEmpty(robotData.getSecret())) { try { URL url = new URL(robotData.getCallback()); if(url.getHost() == null) { LOG.error("get application auth code error, application callback is invalid url"); } else if(url.getHost().equals(host)) { secret = robotData.getSecret(); } else { LOG.error("get application auth code error, request host is not the same host with callback host"); } } catch (MalformedURLException e) { e.printStackTrace(); } } else { String errorReason; if(robotData == null) { errorReason = "Robot not exist."; } else if(StringUtil.isNullOrEmpty(robotData.getCallback())) { errorReason = "Robot no callback address"; } else { errorReason = "Robot no secret"; } LOG.warn("get application auth code error, reason {}", errorReason); } } else if(type == ProtoConstants.ApplicationType.ApplicationType_Channel) { WFCMessage.ChannelInfo channelData = getChannelInfo(applicationId); if(channelData != null && !StringUtil.isNullOrEmpty(channelData.getCallback()) && !StringUtil.isNullOrEmpty(channelData.getSecret())) { try { URL url = new URL(channelData.getCallback()); if(url.getHost() == null) { LOG.error("get application auth code error, application callback is invalid url"); } else if(url.getHost().equals(host)) { secret = channelData.getSecret(); } else { LOG.error("get application auth code error, request host is not the same host with callback host"); } } catch (MalformedURLException e) { e.printStackTrace(); } } else { String errorReason; if(channelData == null) { errorReason = "Channel not exist."; } else if(StringUtil.isNullOrEmpty(channelData.getCallback())) { errorReason = "Channel no callback address"; } else { errorReason = "Channel no secret"; } LOG.warn("get application auth code error, reason {}", errorReason); } } else if(type == ProtoConstants.ApplicationType.ApplicationType_Admin) { secret = AdminAction.getSecretKey(); applicationId = "wfadmin"; } if(!StringUtil.isNullOrEmpty(secret)) { secret = ensureSecretLength(secret); byte[] token = AES.AESEncrypt(fromUser + "?|?" + System.currentTimeMillis() + "?|?" + applicationId + "?|?" + type, secret); return new String(Base64.getEncoder().encode(token)); } return null; } @Override public String verifyApplicationAuthCode(String authCode, String applicationId, int type) { String secret = null; if(type == ProtoConstants.ApplicationType.ApplicationType_Robot) { WFCMessage.Robot robotData = getRobot(applicationId); if(robotData != null && !StringUtil.isNullOrEmpty(robotData.getCallback()) && !StringUtil.isNullOrEmpty(robotData.getSecret())) { secret = robotData.getSecret(); } } else if(type == ProtoConstants.ApplicationType.ApplicationType_Channel) { WFCMessage.ChannelInfo channelData = getChannelInfo(applicationId); if(channelData != null && !StringUtil.isNullOrEmpty(channelData.getCallback()) && !StringUtil.isNullOrEmpty(channelData.getSecret())) { secret = channelData.getSecret(); } } else if(type == ProtoConstants.ApplicationType.ApplicationType_Admin) { secret = AdminAction.getSecretKey(); applicationId = "wfadmin"; } secret = ensureSecretLength(secret); byte[] data = Base64.getDecoder().decode(authCode); data = AES.AESDecrypt(data, secret, true); if (data == null || data.length == 0) { return null; } else { String str = new String(data); String[] strArr = str.split("\\?\\|\\?"); if (strArr.length == 4) { if (applicationId.equals(strArr[2])) { long timestamp= Long.parseLong(strArr[1]); if(System.currentTimeMillis() - timestamp > 60*1000) { return null; } return strArr[0]; } } } return null; } @Override public ErrorCode configApplication(String appId, int appType, long timestamp, String nonce, String signature) { String secret; if(System.currentTimeMillis()/1000 - timestamp > 300) { return ErrorCode.ERROR_CODE_SIGN_EXPIRED; } if(appType == ProtoConstants.ApplicationType.ApplicationType_Robot) { WFCMessage.Robot robotData = getRobot(appId); if(robotData != null) { secret = robotData.getSecret(); } else { return ErrorCode.ERROR_CODE_NOT_EXIST; } } else if(appType == ProtoConstants.ApplicationType.ApplicationType_Channel) { WFCMessage.ChannelInfo channelData = getChannelInfo(appId); if(channelData != null) { secret = channelData.getSecret(); } else { return ErrorCode.ERROR_CODE_NOT_EXIST; } } else { LOG.error("Config application type only support 0 or 1"); return ErrorCode.INVALID_PARAMETER; } String str = nonce + "|" + appId + "|" + timestamp + "|" + secret; String sign = DigestUtils.sha1Hex(str); if(sign.equals(signature)) { return ErrorCode.ERROR_CODE_SUCCESS; } return ErrorCode.ERROR_CODE_AUTH_FAILURE; } @Override public ErrorCode deleteFriend(String userId, String friendUid, long[] head) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); Collection user1Friends = friendsMap.get(userId); if (user1Friends == null || user1Friends.size() == 0) { user1Friends = loadFriend(friendsMap, userId); } for (FriendData data : user1Friends) { if (data.getFriendUid().equals(friendUid)) { long ts = System.currentTimeMillis(); head[0] = ts; data.setState(1); data.setTimestamp(ts); databaseStore.persistOrUpdateFriendData(data); break; } } Collection user2Friends = friendsMap.get(friendUid); if (user2Friends == null || user2Friends.size() == 0) { user2Friends = loadFriend(friendsMap, friendUid); } for (FriendData data : user2Friends) { if (data.getFriendUid().equals(userId)) { data.setState(1); long ts = System.currentTimeMillis(); head[1] = ts; data.setTimestamp(ts); databaseStore.persistOrUpdateFriendData(data); break; } } friendsMap.remove(userId); friendsMap.remove(friendUid); callbackRelationEvent(userId, friendUid, 0, "0"); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode getUserSettings(String userId, long version, WFCMessage.GetUserSettingResult.Builder builder) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap userSettingMap = hzInstance.getMultiMap(USER_SETTING); IMap mGroups = hzInstance.getMap(GROUPS_MAP); IMap mChannels = hzInstance.getMap(CHANNELS); Collection entries; try { mUserSettingLock.lock(); entries = userSettingMap.get(userId); if (entries == null || entries.size() == 0) { entries = loadPersistedUserSettings(userId, userSettingMap); } } finally { mUserSettingLock.unlock(); } ErrorCode ec = ErrorCode.ERROR_CODE_NOT_MODIFIED; Calendar c = Calendar.getInstance(); c.setTime(new Date()); c.add(Calendar.MONTH, -1); long monthAgo = c.getTimeInMillis(); if (entries != null) { for (WFCMessage.UserSettingEntry entry : entries ) { if (entry.getUpdateDt() > version) { ec = ErrorCode.ERROR_CODE_SUCCESS; boolean skip = false; if (version == 0 && entry.getUpdateDt() > monthAgo) { if (entry.getScope() == UserSettingScope.kUserSettingConversationSync) { try { String key = entry.getKey(); int pos1 = key.indexOf('-'); String typeStr = key.substring(0, pos1); int type = Integer.parseInt(typeStr); if (type == ProtoConstants.ConversationType.ConversationType_Group || type == ProtoConstants.ConversationType.ConversationType_Channel) { int pos2 = key.indexOf('-', pos1 + 1); String target = key.substring(pos2 + 1); if (type == ProtoConstants.ConversationType.ConversationType_Group) { WFCMessage.GroupInfo groupInfo = mGroups.get(target); if (groupInfo == null) { skip = true; } } else { WFCMessage.ChannelInfo channelInfo = mChannels.get(target); if (channelInfo == null) { skip = true; } } } } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } } if (!skip) { builder.addEntry(entry); } } } } if(mSyncDataPartSize > 0 && ec == ErrorCode.ERROR_CODE_SUCCESS && builder.getEntryCount() > mSyncDataPartSize) { List list = new ArrayList<>(builder.getEntryList()); list.sort(Comparator.comparingLong(WFCMessage.UserSettingEntry::getUpdateDt)); list = list.subList(0, mSyncDataPartSize); builder.clearEntry().addAllEntry(list); } return ec; } private List loadPersistedUserSettings(String userId, MultiMap userSettingMap) { List datas = databaseStore.getPersistUserSetting(userId); for (WFCMessage.UserSettingEntry data : datas ) { userSettingMap.put(userId, data); } return datas; } @Override public WFCMessage.UserSettingEntry getUserSetting(String userId, int scope, String key) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap userSettingMap = hzInstance.getMultiMap(USER_SETTING); try { mUserSettingLock.lock(); Collection entries = userSettingMap.get(userId); if (entries == null || entries.size() == 0) { entries = loadPersistedUserSettings(userId, userSettingMap); } if (entries != null) { for (WFCMessage.UserSettingEntry entry : entries) { if (entry.getScope() == scope && (key== null || key.equals(entry.getKey()))) { return entry; } } } } finally { mUserSettingLock.unlock(); } return null; } @Override public List getUserSetting(String userId, int scope) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap userSettingMap = hzInstance.getMultiMap(USER_SETTING); List result; try { mUserSettingLock.lock(); Collection entries = userSettingMap.get(userId); if (entries == null || entries.size() == 0) { entries = loadPersistedUserSettings(userId, userSettingMap); } result = new ArrayList<>(); if (entries != null) { for (WFCMessage.UserSettingEntry entry : entries ) { if (entry.getScope() == scope) { result.add(entry); } } } } finally { mUserSettingLock.unlock(); } return result; } @Override public long updateUserSettings(String userId, WFCMessage.ModifyUserSettingReq request, String clientId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap userSettingMap = hzInstance.getMultiMap(USER_SETTING); long updateDt = 0; try { mUserSettingLock.lock(); Collection entries = userSettingMap.get(userId); if (entries == null || entries.size() == 0) { entries = loadPersistedUserSettings(userId, userSettingMap); if (entries == null) { entries = new ArrayList<>(); } } updateDt = System.currentTimeMillis(); WFCMessage.UserSettingEntry settingEntry = WFCMessage.UserSettingEntry.newBuilder().setScope(request.getScope()).setKey(request.getKey()).setValue(request.getValue()).setUpdateDt(updateDt).build(); databaseStore.persistUserSetting(userId, settingEntry); for (WFCMessage.UserSettingEntry entry : entries ) { if (entry.getScope() == request.getScope() && entry.getKey().equals(request.getKey())) { userSettingMap.remove(userId, entry); userSettingMap.put(userId, settingEntry); break; } } userSettingMap.put(userId, settingEntry); } finally { mUserSettingLock.unlock(); } if(request.getScope() == UserSettingScope.kUserSettingConversationSilent) { int firstSplit = request.getKey().indexOf("-"); int type = Integer.parseInt(request.getKey().substring(0, firstSplit)); int secondSplit = request.getKey().indexOf("-", firstSplit+1); int line = Integer.parseInt(request.getKey().substring(firstSplit+1, secondSplit)); String target = request.getKey().substring(secondSplit+1); String key = userId + "|" + type + "|" + target + "|" + line; userConvSlientMap.remove(key); } else if(request.getScope() == UserSettingScope.kUserSettingGlobalSilent) { userGlobalSlientMap.remove(userId); } else if(request.getScope() == UserSettingScope.kUserSettingVoipSilent) { userVoipSlientMap.remove(userId); } else if(request.getScope() == UserSettingScope.kUserSettingHiddenNotificationDetail) { userPushHiddenDetail.remove(userId); } IMHandler.getPublisher().publishNotification(IMTopic.NotifyUserSettingTopic, userId, updateDt, clientId); return updateDt; } @Override public void clearUserSettings(String userId) { databaseStore.clearUserSetting(userId); HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); try { mUserSettingLock.lock(); MultiMap userSettingMap = hzInstance.getMultiMap(USER_SETTING); userSettingMap.remove(userId); } finally { mUserSettingLock.unlock(); } } @Override public boolean isLocked(String userId, String clientId) { WFCMessage.UserSettingEntry lockSetting = getUserSetting(userId, UserSettingScopeLockPC, clientId); if(lockSetting != null && "1".equals(lockSetting.getValue())) { return true; } return false; } @Override public boolean getUserGlobalSilent(String userId) { Boolean slient = userGlobalSlientMap.get(userId); if (slient == null) { WFCMessage.UserSettingEntry entry = getUserSetting(userId, UserSettingScope.kUserSettingGlobalSilent, null); if (entry == null || !entry.getValue().equals("1")) { slient = false; } else { slient = true; } userGlobalSlientMap.put(userId, slient); } return slient; } @Override public boolean getUserVoipSilent(String userId) { Boolean slient = userVoipSlientMap.get(userId); if (slient == null) { WFCMessage.UserSettingEntry entry = getUserSetting(userId, UserSettingScope.kUserSettingVoipSilent, null); if (entry == null || !entry.getValue().equals("1")) { slient = false; } else { slient = true; } userVoipSlientMap.put(userId, slient); } return slient; } @Override public boolean getUserPushHiddenDetail(String userId) { Boolean hidden = userPushHiddenDetail.get(userId); if (hidden == null) { WFCMessage.UserSettingEntry entry = getUserSetting(userId, UserSettingScope.kUserSettingHiddenNotificationDetail, null); if (entry == null || !entry.getValue().equals("1")) { hidden = false; } else { hidden = true; } userPushHiddenDetail.put(userId, hidden); } return hidden; } @Override public boolean getUserConversationSilent(String userId, WFCMessage.Conversation conversation) { String key = userId + "|" + conversation.getType() + "|" + conversation.getTarget() + "|" + conversation.getLine(); Boolean slient = userConvSlientMap.get(key); if (slient == null) { String convSlientKey = conversation.getType() + "-" + conversation.getLine() + "-" + conversation.getTarget(); WFCMessage.UserSettingEntry entry = getUserSetting(userId, UserSettingScope.kUserSettingConversationSilent, convSlientKey); if (entry == null || !entry.getValue().equals("1")) { slient = false; } else { slient = true; } userConvSlientMap.put(key, slient); } return slient; } @Override public boolean getSilentWhenPcOnline(String userId) { WFCMessage.UserSettingEntry entry = getUserSetting(userId, UserSettingScope.kUserSettingMuteWhenPCOnline, null); if (entry != null && "1".equals(entry.getValue())) { return !mMobileDefaultSilentWhenPCOnline; } else { return mMobileDefaultSilentWhenPCOnline; } } private Date getTodayDate() { Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("GMT")); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH); int day = calendar.get(Calendar.DATE); calendar.set(year, month, day, 0, 0, 0); return calendar.getTime(); } @Override public boolean isUserNoDisturbing(String userId) { WFCMessage.UserSettingEntry entry = getUserSetting(userId, UserSettingScope.kUserSettingNoDisturbing, ""); if (entry != null && !StringUtil.isNullOrEmpty(entry.getValue())) { String[] arr = entry.getValue().split("\\|"); if (arr.length == 2) { int nowMins = (int)((System.currentTimeMillis() - getTodayDate().getTime())/1000/60); try { int startMins = Integer.parseInt(arr[0]); int endMins = Integer.parseInt(arr[1]); if (endMins > startMins) { if (endMins > nowMins && nowMins > startMins) { return true; } } else { if (endMins > nowMins || nowMins > startMins) { return true; } } } catch (NumberFormatException e) { e.printStackTrace(); } } } return false; } @Override public ErrorCode createChannel(String operator, WFCMessage.ChannelInfo channelInfo) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(CHANNELS); mIMap.put(channelInfo.getTargetId(), channelInfo); callbackChannelInfoUpdateEvent(operator, channelInfo.getTargetId(), Channel_Event_Create); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public void clearUserChannels(String userId) { databaseStore.getUserChannels(userId).forEach(s -> listenChannel(userId, s, false)); } @Override public ErrorCode modifyChannelInfo(String operator, String channelId, int modifyType, String value) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(CHANNELS); WFCMessage.ChannelInfo oldInfo = mIMap.get(channelId); if (oldInfo == null) { return ErrorCode.ERROR_CODE_NOT_EXIST; } if (oldInfo.getOwner() == null || !oldInfo.getOwner().equals(operator)) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } WFCMessage.ChannelInfo.Builder newInfoBuilder = oldInfo.toBuilder(); if (modifyType == Modify_Channel_Name) newInfoBuilder.setName(value); else if(modifyType == Modify_Channel_Portrait) newInfoBuilder.setPortrait(value); else if(modifyType == Modify_Channel_Desc) newInfoBuilder.setDesc(value); else if(modifyType == Modify_Channel_Extra) newInfoBuilder.setExtra(value); else if(modifyType == Modify_Channel_Secret) newInfoBuilder.setSecret(value); else if(modifyType == Modify_Channel_Callback) newInfoBuilder.setCallback(value); else if(modifyType == Modify_Channel_OnlyCallback) { try { newInfoBuilder.setAutomatic(Integer.parseInt(value)); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } else if(modifyType == Modify_Channel_Menu) { OutputGetChannelInfo.OutputMenuList outputMenuButtons = GsonUtil.gson.fromJson(value, OutputGetChannelInfo.OutputMenuList.class); if (!outputMenuButtons.isEmpty()) { for (PojoChannelMenu outputMenuButton : outputMenuButtons) { newInfoBuilder.addMenu(outputMenuButton.toPbInfo()); } } } newInfoBuilder.setUpdateDt(System.currentTimeMillis()); mIMap.put(channelId, newInfoBuilder.build()); callbackChannelInfoUpdateEvent(operator, channelId, Channel_Event_Update); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode transferChannel(String operator, String channelId, String newOwner) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(CHANNELS); WFCMessage.ChannelInfo oldInfo = mIMap.get(channelId); if (oldInfo == null) { return ErrorCode.ERROR_CODE_NOT_EXIST; } if (oldInfo.getOwner() == null || !oldInfo.getOwner().equals(operator)) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } WFCMessage.ChannelInfo.Builder newInfoBuilder = oldInfo.toBuilder(); newInfoBuilder.setOwner(newOwner); newInfoBuilder.setUpdateDt(System.currentTimeMillis()); mIMap.put(channelId, newInfoBuilder.build()); callbackChannelInfoUpdateEvent(operator, channelId, Channel_Event_Transfer); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ErrorCode destroyChannel(String operator, String channelId, boolean isAdmin) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(CHANNELS); WFCMessage.ChannelInfo oldInfo = mIMap.get(channelId); if (oldInfo == null) { return ErrorCode.ERROR_CODE_NOT_EXIST; } if ((oldInfo.getOwner() == null || !oldInfo.getOwner().equals(operator)) && !isAdmin) { return ErrorCode.ERROR_CODE_NOT_RIGHT; } WFCMessage.ChannelInfo.Builder newInfoBuilder = oldInfo.toBuilder(); newInfoBuilder.setStatus(oldInfo.getStatus() | Channel_State_Mask_Deleted); newInfoBuilder.setUpdateDt(System.currentTimeMillis()); mIMap.put(channelId, newInfoBuilder.build()); databaseStore.clearChannelListener(channelId); hzInstance.getMultiMap(CHANNEL_LISTENERS).remove(channelId); callbackChannelInfoUpdateEvent(operator, channelId, Channel_Event_Destroy); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public List searchChannel(String keyword, boolean buzzy, int page) { return databaseStore.searchChannelFromDB(keyword, buzzy, page); } @Override public List getListenedChannels(String userId) { return databaseStore.getUserChannels(userId); } @Override public ErrorCode listenChannel(String operator, String channelId, boolean listen) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap listeners = hzInstance.getMultiMap(CHANNEL_LISTENERS); IMap mIMap = hzInstance.getMap(CHANNELS); WFCMessage.ChannelInfo channelInfo = mIMap.get(channelId); if(channelInfo != null && (channelInfo.getStatus() & ProtoConstants.ChannelState.Channel_State_Mask_Private) > 0) { return ErrorCode.ERROR_CODE_NOT_EXIST; } try { mWriteLock.lock(); databaseStore.updateChannelListener(channelId, operator, listen); listeners.remove(channelId); } finally { mWriteLock.unlock(); } IMHandler.getPublisher().notifyChannelListenStatusChanged(channelInfo, operator, listen); return ErrorCode.ERROR_CODE_SUCCESS; } private Collection getChannelListener(String channelId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap listeners = hzInstance.getMultiMap(CHANNEL_LISTENERS); Collection result = listeners.get(channelId); if (result.isEmpty()) { try { mWriteLock.lock(); result = databaseStore.getChannelListener(channelId); for (String userId : result) { listeners.put(channelId, userId); } } finally { mWriteLock.unlock(); } } return result; } @Override public WFCMessage.ChannelInfo getChannelInfo(String channelId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(CHANNELS); return mIMap.get(channelId); } @Override public boolean canSendMessageInChannel(String user, String channelId) { IMap mIMap = m_Server.getHazelcastInstance().getMap(CHANNELS); WFCMessage.ChannelInfo info = mIMap.get(channelId); if(info == null || info.getStatus() == Channel_State_Mask_Deleted) { return false; } if(user.equals(info.getOwner())) { return true; } if((info.getStatus() & Channel_State_Mask_Global) > 0 || (info.getStatus() & Channel_State_Mask_Message_Unsubscribed) > 0) { return true; } Collection channelMembers = getChannelListener(channelId); if (channelMembers == null || !channelMembers.contains(user)) { return false; } return true; } @Override public boolean checkUserInChannel(String user, String channelId) { Collection channelMembers = getChannelListener(channelId); if (channelMembers == null) { return false; } if(!channelMembers.contains(user)) { IMap mIMap = m_Server.getHazelcastInstance().getMap(CHANNELS); WFCMessage.ChannelInfo info = mIMap.get(channelId); if (info == null || !info.getOwner().equals(user)) { return false; } } return true; } @Override public Collection getChannelSubscriber(String channelId) { return getChannelListener(channelId); } @Override public int getOnlineUserCount() { return m_Server.getProcessor().getConnectionDescriptors().getActiveConnectionsNo(); } @Override public GetOnlineUserResult getOnlineUsers(int offset, int count) { List onlineUserIds = new ArrayList<>(m_Server.getProcessor().getConnectionDescriptors().getConnectedClientIds()); GetOnlineUserResult result = new GetOnlineUserResult(); result.userClients = new ArrayList<>(); result.totalCount = onlineUserIds.size(); result.offset = offset; if(onlineUserIds.size() > offset) { List clientIds = onlineUserIds.subList(offset, Math.min(offset+count, onlineUserIds.size())); for (String clientId : clientIds) { MemorySessionStore.Session session = m_Server.getStore().sessionsStore().getSession(clientId); if(session != null) { GetOnlineUserResult.UserClient userClient = new GetOnlineUserResult.UserClient(); userClient.userId = session.getUsername(); userClient.clientId = session.getClientID(); userClient.platform = session.getPlatform(); result.userClients.add(userClient); } } } return result; } @Override public Set handleSensitiveWord(String message) { updateSensitiveWord(); return mSensitiveFilter.getSensitiveWords(message, SensitiveFilter.MatchType.MAX_MATCH); } @Override public boolean addSensitiveWords(List words) { for (String word : words) { databaseStore.persistSensitiveWord(word.toLowerCase()); } lastUpdateSensitiveTime = 0; return true; } @Override public boolean removeSensitiveWords(List words) { for (String word : words) { databaseStore.deleteSensitiveWord(word); } lastUpdateSensitiveTime = 0; return true; } @Override public List getAllSensitiveWords() { return new ArrayList<>(databaseStore.getSensitiveWord()); } @Override public boolean isSensitiveOnlyMessage() { return mSensitiveOnlyMessage; } @Override public WFCMessage.Message getMessage(long messageId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); IMap mIMap = hzInstance.getMap(MESSAGES_MAP); MessageBundle bundle = mIMap.get(messageId); if (bundle != null) { return bundle.getMessage(); } return null; } @Override public boolean isAllowClientCustomGroupNotification() { return mGroupAllowClientCustomOperationNotification; } @Override public boolean isAllowRobotCustomGroupNotification() { return mGroupAllowRobotCustomOperationNotification; } @Override public int getVisibleQuitKickoffNotification() { return mGroupVisibleQuitKickoffNotification; } @Override public boolean isGroupAllowPartSuccess() { return mGroupAllowPartSuccess; } @Override public int getGroupForbiddenClientOperation() { return mGroupForbiddenClientOperation; } @Override public boolean isForwardMessageWithClientInfo() { return mForwardMessageWithClientInfo; } @Override public boolean isForwardMessageWithSenderInfo() { return mForwardMessageWithSenderInfo; } @Override public boolean isForwardMessageWithTargetInfo() { return mForwardMessageWithTargetInfo; } @Override public boolean isRobotCallbackWithClientInfo() { return mRobotCallbackWithClientInfo; } @Override public boolean isRobotCallbackWithSenderInfo() { return mRobotCallbackWithSenderInfo; } @Override public boolean isRobotCallbackWithTargetInfo() { return mRobotCallbackWithTargetInfo; } @Override public boolean isRobotMentionExternalRobot() { return mRobotMentionExternalRobot; } @Override public int getRobotGetUserInfoMask() { return mRobotGetUserInfoMask; } @Override public boolean isChannelCallbackWithClientInfo() { return mChannelCallbackWithClientInfo; } @Override public boolean isChannelCallbackWithSenderInfo() { return mChannelCallbackWithSenderInfo; } @Override public boolean isChannelCallbackWithTargetInfo() { return mChannelCallbackWithTargetInfo; } @Override public boolean isChannelNewCallbackFeature() { return mChannelNewCallbackFeature; } @Override public boolean isRobotAutoAcceptFriendRequest() { return mFriendRobotAutoAccept; } @Override public long getPushExpiredTimes() { return mPushExpiredTimes; } @Override public Set getForcePushTypes() { return mForcePushTypes; } @Override public List getClientForbiddenSendTypes() { return mForbiddenClientSendTypes; } @Override public List getBlackListExceptionTypes() { return mBlackListExceptionTypes; } @Override public List getGroupMuteExceptionTypes() { return mGroupMuteExceptionTypes; } @Override public List getGlobalMuteExceptionTypes() { return mGlobalMuteExceptionTypes; } @Override public long getMessageHead(String user) { TreeMap maps = userMessages.get(user); if (maps == null) { loadUserMessages(user); } mReadLock.lock(); try { maps = userMessages.get(user); Map.Entry lastEntry = maps.lastEntry(); if (lastEntry != null) { return lastEntry.getKey(); } } finally { mReadLock.unlock(); } return 0; } private void loadUserMessages(String user) { mWriteLock.lock(); try { TreeMap maps = userMessages.get(user); if (maps == null) { maps = databaseStore.reloadUserMessageMaps(user); userMessages.put(user, maps); } } finally { mWriteLock.unlock(); } } @Override public long getFriendHead(String userId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap friendsMap = hzInstance.getMultiMap(USER_FRIENDS); Collection friends = friendsMap.get(userId); if (friends == null || friends.size() == 0) { friends = loadFriend(friendsMap, userId); } long max = 0; if (friends != null && friends.size() > 0) { for (FriendData friend : friends) { if (friend.getTimestamp() > max) max = friend.getTimestamp(); } } return max; } @Override public long getFriendRqHead(String userId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap friendsReqMap = hzInstance.getMultiMap(USER_FRIENDS_REQUEST); Collection friendsReq = friendsReqMap.get(userId); long max = 0; if (friendsReq == null || friendsReq.size() == 0) { friendsReq = loadFriendRequest(friendsReqMap, userId); } if (friendsReq != null && friendsReq.size() > 0) { for (WFCMessage.FriendRequest request : friendsReq) { if (request.getUpdateDt() > max) max = request.getUpdateDt(); } } return max; } @Override public long getSettingHead(String userId) { HazelcastInstance hzInstance = m_Server.getHazelcastInstance(); MultiMap userSettingMap = hzInstance.getMultiMap(USER_SETTING); Collection entries = userSettingMap.get(userId); if (entries == null || entries.size() == 0) { return 0L; } long max = 0; for (WFCMessage.UserSettingEntry entry : entries ) { if (entry.getUpdateDt() > max) { max = entry.getUpdateDt(); } } return max; } @Override public String getShortUUID(){ if(!mIDUseUUID) { int id = databaseStore.getGeneratedId(); if (id > 0) { return IDUtils.toUid(id); } } return UUIDGenerator.getUUID(); } @Override public boolean checkSignature(String signature) { if(mClientSignatureSet.isEmpty()) { return true; } if(StringUtil.isNullOrEmptyAfterTrim(signature)) { if(mRejectEmptySignature) { LOG.info("Failed check signature, no signature"); return false; } else { return true; } } else { if(mClientSignatureSet.contains(signature)) { return true; } else { LOG.info("Failed check signature, signature no matched"); return false; } } } @Override public boolean existSignatures() { return !mClientSignatureSet.isEmpty(); } @Override public void storeRetained(Topic topic, StoredMessage storedMessage) { LOG.debug("Store retained message for topic={}, CId={}", topic, storedMessage.getClientID()); if (storedMessage.getClientID() == null) { throw new IllegalArgumentException("Message to be persisted must have a not null client ID"); } m_retainedStore.put(topic, storedMessage); } @Override public Collection searchMatching(IMatchingCondition condition) { LOG.debug("searchMatching scanning all retained messages, presents are {}", m_retainedStore.size()); List results = new ArrayList<>(); for (Map.Entry entry : m_retainedStore.entrySet()) { StoredMessage storedMsg = entry.getValue(); if (condition.match(entry.getKey())) { results.add(storedMsg); } } return results; } @Override public void cleanRetained(Topic topic) { m_retainedStore.remove(topic); } public static String getName(int[] bytes) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < bytes.length; i++) { char ch = (char)(bytes[i]+17); sb.append(ch); } return sb.toString(); } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/MemorySessionStore.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.persistence; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.util.StringUtil; import io.moquette.BrokerConstants; import io.moquette.server.Constants; import io.moquette.server.Server; import io.moquette.spi.ClientSession; import io.moquette.spi.ISessionsStore; import io.moquette.spi.IMessagesStore.StoredMessage; import io.netty.handler.codec.mqtt.MqttVersion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.Utility; import java.util.*; import java.util.concurrent.*; public class MemorySessionStore implements ISessionsStore { private static int dumy = 1; private static final Logger LOG = LoggerFactory.getLogger(MemorySessionStore.class); private boolean supportMultiEndpoint = false; private boolean supportMultiPCEndpoint = false; private boolean supportMultiPadEndpoint = false; private boolean supportMultiWearableEndpoint = false; private boolean supportMultiTVEndpoint = false; private boolean clientSupportKickoff = false; public static class Session implements Comparable{ final String clientID; String username; private String appName; private String deviceToken; private String voipDeviceToken; private String secret; private String dbSecret; private long lastActiveTime; private long lastChatroomActiveTime; private volatile int unReceivedMsgs; private int deleted; private boolean pullHistoryMsg; private String ip; public int getDeleted() { return deleted; } public void setDeleted(int deleted) { this.deleted = deleted; } private MqttVersion mqttVersion = MqttVersion.MQTT_3_1_1; public long getLastActiveTime() { return lastActiveTime; } public long getLastChatroomActiveTime() { return lastChatroomActiveTime; } public void refreshLastChatroomActiveTime() { this.lastChatroomActiveTime = System.currentTimeMillis(); } public void refreshLastActiveTime() { this.lastActiveTime = System.currentTimeMillis(); } public int getUnReceivedMsgs() { return unReceivedMsgs; } public boolean isPcClient() { return platform == ProtoConstants.Platform.Platform_Windows || platform == ProtoConstants.Platform.Platform_OSX || platform == ProtoConstants.Platform.Platform_LINUX; } public boolean isPadClient() { return platform == ProtoConstants.Platform.Platform_iPad || platform == ProtoConstants.Platform.Platform_APad || platform == ProtoConstants.Platform.Platform_HarmonyPad; } public boolean isTVClient() { return platform == ProtoConstants.Platform.Platform_AppleTV || platform == ProtoConstants.Platform.Platform_AndroidTV || platform == ProtoConstants.Platform.Platform_HarmonyTV; } public int getPushType() { return pushType; } public void setPushType(int pushType) { this.pushType = pushType; } public String getDeviceName() { return deviceName; } public void setDeviceName(String deviceName) { this.deviceName = deviceName; } public String getDeviceVersion() { return deviceVersion; } public void setDeviceVersion(String deviceVersion) { this.deviceVersion = deviceVersion; } public String getPhoneName() { return phoneName; } public void setPhoneName(String phoneName) { this.phoneName = phoneName; } public String getLanguage() { return language; } public void setLanguage(String language) { this.language = language; } public String getCarrierName() { return carrierName; } public void setCarrierName(String carrierName) { this.carrierName = carrierName; } public boolean isPullHistoryMsg() { return pullHistoryMsg; } public void setPullHistoryMsg(boolean pullHistoryMsg) { this.pullHistoryMsg = pullHistoryMsg; } public long getUpdateDt() { return updateDt; } public void setUpdateDt(long updateDt) { this.updateDt = updateDt; if (this.lastActiveTime == 0) { this.lastActiveTime = updateDt; } } public String getIp() { return ip; } public void setIp(String ip) { this.ip = ip; } private int pushType; private int platform; private String deviceName; private String deviceVersion; private String phoneName; private String language; private String carrierName; private long updateDt; final ClientSession clientSession; final BlockingQueue queue = new ArrayBlockingQueue<>(Constants.MAX_MESSAGE_QUEUE); final Map secondPhaseStore = new ConcurrentHashMap<>(); final Map outboundFlightMessages = Collections.synchronizedMap(new HashMap()); final Map inboundFlightMessages = new ConcurrentHashMap<>(); public Session(String username, String clientID, ClientSession clientSession) { this.clientID = clientID; this.clientSession = clientSession; this.username = username; } public String getAppName() { return appName; } public void setAppName(String appName) { this.appName = appName; } public String getDeviceToken() { return deviceToken; } public void setDeviceToken(String deviceToken) { this.deviceToken = deviceToken; } public int getPlatform() { return platform; } public void setPlatform(int platform) { this.platform = platform; } public String getClientID() { return clientID; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public ClientSession getClientSession() { return clientSession; } public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } public String getDbSecret() { return dbSecret; } public void setDbSecret(String dbSecret) { this.dbSecret = dbSecret; } public String getVoipDeviceToken() { return voipDeviceToken; } public void setVoipDeviceToken(String voipDeviceToken) { this.voipDeviceToken = voipDeviceToken; } @Override public int compareTo(Session o) { // TODO Auto-generated method stub if (clientID.equals(o.clientID) && username.equals(o.username)) { return 0; } if (clientID.equals(o.clientID)) { return username.compareTo(o.username); } else { return clientID.compareTo(o.clientID); } } public MqttVersion getMqttVersion() { return mqttVersion; } public void setMqttVersion(MqttVersion mqttVersion) { this.mqttVersion = mqttVersion; } } private final Map sessions = new ConcurrentHashMap<>(); private final Map> userSessions = new ConcurrentHashMap<>(); private final Server mServer; private final DatabaseStore databaseStore; public MemorySessionStore(Server server, DatabaseStore databaseStore) { mServer = server; this.databaseStore = databaseStore; try { supportMultiEndpoint = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.SERVER_MULTI_ENDPOINT, "false")); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } try { supportMultiPCEndpoint = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.SERVER_MULTI_PC_ENDPOINT, "false")); } catch (Exception e) { } try { supportMultiPadEndpoint = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.SERVER_MULTI_PAD_ENDPOINT, "false")); } catch (Exception e) { } try { supportMultiWearableEndpoint = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.SERVER_MULTI_WEARABLE_ENDPOINT, "false")); } catch (Exception e) { } try { supportMultiTVEndpoint = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.SERVER_MULTI_TV_ENDPOINT, "false")); } catch (Exception e) { } try { clientSupportKickoff = Boolean.parseBoolean(server.getConfig().getProperty(BrokerConstants.SERVER_CLIENT_SUPPORT_KICKOFF_EVENT, "false")); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } @Override public Session getSession(String clientID) { if (StringUtil.isNullOrEmpty(clientID)) { return null; } Session session = sessions.get(clientID); if (session == null) { LOG.error("Can't find the session for client <{}>", clientID); } return session; } @Override public void cleanDuplatedToken(String cid, int pushType, String token, boolean isVoip, String packageName) { if (StringUtil.isNullOrEmpty(token) || isVoip) { return; } Iterator> it = sessions.entrySet().iterator(); while (it.hasNext()) { Session session = it.next().getValue(); if (!session.getClientID().equals(cid) && (session.pushType == pushType && token.equals(session.deviceToken)) && (!StringUtil.isNullOrEmpty(packageName) && packageName.equals(session.getAppName()))) { session.deviceToken = null; } } } @Override public void initStore() { } @Override public boolean contains(String clientID) { return sessions.containsKey(clientID); } @Override public void updateSessionToken(Session session, boolean voip) { databaseStore.updateSessionToken(session.getUsername(), session.getClientID(), voip ? session.getVoipDeviceToken() : session.getDeviceToken(), session.getPushType(), voip); } @Override public void clearUserSession(String username) { LOG.info("Fooooooooo <{}>", username); databaseStore.clearUserSessions(username); ConcurrentSkipListSet sessionSet = getUserSessionSet(username); for (String clientID : sessionSet) { Session s = sessions.remove(clientID); mServer.getProcessor().kickoffSession(s); } userSessions.remove(username); } @Override public Session updateOrCreateUserSession(String username, String clientID, int platform) { LOG.debug("createUserSession for client <{}>, user <{}>", clientID, username); Session session = sessions.get(clientID); if (session != null && !session.username.equals(username)) { if (userSessions.get(session.username) != null) { userSessions.get(session.username).remove(clientID); } session = null; } ClientSession clientSession = new ClientSession(clientID, this); if(session == null) { session = databaseStore.getSession(username, clientID, clientSession); if (session == null) { session = databaseStore.createSession(username, clientID, clientSession, platform); } } sessions.put(clientID, session); ConcurrentSkipListSet sessionSet = getUserSessionSet(username); sessionSet.add(clientID); if (session.getDeleted() > 0) { session.setDeleted(0); databaseStore.updateSessionDeleted(username, clientID, 0); } if (session.getPlatform() != platform) { session.setPlatform(platform); databaseStore.updateSessionPlatform(username, clientID, platform); } databaseStore.clearMultiUser(username, clientID); if (!supportMultiEndpoint && platform > 0 && !(platform == ProtoConstants.Platform.Platform_Windows && supportMultiPCEndpoint) && !(platform == ProtoConstants.Platform.Platform_LINUX && supportMultiPCEndpoint) && !(platform == ProtoConstants.Platform.Platform_OSX && supportMultiPCEndpoint) && !(platform == ProtoConstants.Platform.Platform_HarmonyPC && supportMultiPCEndpoint) && !(platform == ProtoConstants.Platform.Platform_iPad && supportMultiPadEndpoint) && !(platform == ProtoConstants.Platform.Platform_APad && supportMultiPadEndpoint) && !(platform == ProtoConstants.Platform.Platform_HarmonyPad && supportMultiPadEndpoint) && !(platform == ProtoConstants.Platform.Platform_AndroidWearable && supportMultiWearableEndpoint) && !(platform == ProtoConstants.Platform.Platform_HarmonyWearable && supportMultiWearableEndpoint) && !(platform == ProtoConstants.Platform.Platform_AndroidTV && supportMultiTVEndpoint) && !(platform == ProtoConstants.Platform.Platform_AppleTV && supportMultiTVEndpoint) && !(platform == ProtoConstants.Platform.Platform_HarmonyTV && supportMultiTVEndpoint) ) { databaseStore.clearMultiEndpoint(username, clientID, platform); if (userSessions.get(username) != null) { Iterator it = userSessions.get(username).iterator(); while (it.hasNext()) { String c = it.next(); if (!clientID.equals(c)) { Session s = sessions.get(c); if (s == null) { it.remove(); continue; } boolean remove = false; if (platform == ProtoConstants.Platform.Platform_Android || platform == ProtoConstants.Platform.Platform_iOS || platform == ProtoConstants.Platform.Platform_Harmony) { if (s.getPlatform() == ProtoConstants.Platform.Platform_Android || s.getPlatform() == ProtoConstants.Platform.Platform_iOS || s.getPlatform() == ProtoConstants.Platform.Platform_Harmony) { remove = true; } } else if(platform == ProtoConstants.Platform.Platform_iPad || platform == ProtoConstants.Platform.Platform_APad || platform == ProtoConstants.Platform.Platform_HarmonyPad) { if (s.getPlatform() == ProtoConstants.Platform.Platform_iPad || s.getPlatform() == ProtoConstants.Platform.Platform_APad || s.getPlatform() == ProtoConstants.Platform.Platform_HarmonyPad) { remove = true; } } else if(platform == ProtoConstants.Platform.Platform_OSX || platform == ProtoConstants.Platform.Platform_Windows || platform == ProtoConstants.Platform.Platform_LINUX || platform == ProtoConstants.Platform.Platform_HarmonyPC) { if (s.getPlatform() == ProtoConstants.Platform.Platform_OSX || s.getPlatform() == ProtoConstants.Platform.Platform_Windows || s.getPlatform() == ProtoConstants.Platform.Platform_LINUX || s.getPlatform() == ProtoConstants.Platform.Platform_HarmonyPC) { remove = true; } } else if(platform == ProtoConstants.Platform.Platform_AndroidWearable || platform == ProtoConstants.Platform.Platform_HarmonyWearable) { if (s.getPlatform() == ProtoConstants.Platform.Platform_AndroidWearable || s.getPlatform() == ProtoConstants.Platform.Platform_HarmonyWearable) { remove = true; } } else if(platform == ProtoConstants.Platform.Platform_AndroidTV || platform == ProtoConstants.Platform.Platform_AppleTV || platform == ProtoConstants.Platform.Platform_HarmonyTV) { if (s.getPlatform() == ProtoConstants.Platform.Platform_AndroidTV || s.getPlatform() == ProtoConstants.Platform.Platform_AppleTV || s.getPlatform() == ProtoConstants.Platform.Platform_HarmonyTV) { remove = true; } } else { //web, microapp if (s.getPlatform() ==platform) { remove = true; } } if (remove) { sessions.remove(c); it.remove(); mServer.getProcessor().kickoffSession(s); } } } } } return session; } @Override public void kickoffUserClient(String username, String cid) { List clientIds = new ArrayList<>(); if(StringUtil.isNullOrEmpty(cid)) { ConcurrentSkipListSet sessionSet = getUserSessionSet(username); clientIds.addAll(sessionSet); } else { clientIds.add(cid); } for (String clientID: clientIds) { Session session = sessions.get(clientID); if(session == null) { ClientSession clientSession = new ClientSession(clientID, this); session = databaseStore.getSession(username, clientID, clientSession); if (session == null || session.getDeleted() > 0) { continue; } sessions.put(clientID, session); } if (session.getDeleted() == 0) { session.setDeleted(1); databaseStore.updateSessionDeleted(username, clientID, 1); mServer.getProcessor().kickoffSession(session); } } } @Override public ErrorCode loadActiveSession(String username, String clientID) { LOG.debug("createNewSession for client <{}>", clientID); Session session = sessions.get(clientID); if (session != null && session.getDeleted() == 0) { LOG.error("already exists a session for client <{}>, bad condition", clientID); return ErrorCode.ERROR_CODE_SUCCESS; } if (session != null && session.getDeleted() > 0) { if(clientSupportKickoff) { return ErrorCode.ERROR_CODE_KICKED_OFF; } else { return ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH; } } ClientSession clientSession = new ClientSession(clientID, this); session = databaseStore.getSession(username, clientID, clientSession); if (session == null) { return ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH; } if(session.getDeleted() > 0) { if(clientSupportKickoff) { return ErrorCode.ERROR_CODE_KICKED_OFF; } else { return ErrorCode.ERROR_CODE_SECRECT_KEY_MISMATCH; } } sessions.put(clientID, session); ConcurrentSkipListSet sessionSet = getUserSessionSet(username); sessionSet.add(clientID); return ErrorCode.ERROR_CODE_SUCCESS; } @Override public ClientSession updateExistSession(String username, String clientID, WFCMessage.RouteRequest endpoint, boolean cleanSession) { LOG.debug("updateExistSession for client <{}>", clientID); Session session = sessions.get(clientID); if (session == null) { LOG.error("already exists a session for client <{}>, bad condition", clientID); throw new IllegalArgumentException("Can't create a session with the ID of an already existing" + clientID); } if (!session.getUsername().equals(username)) { ConcurrentSkipListSet sessionSet = userSessions.get(session.getUsername()); if(sessionSet != null) { sessionSet.remove(clientID); } } session.setUsername(username); sessions.put(clientID, session); ConcurrentSkipListSet sessionSet = getUserSessionSet(username); sessionSet.add(clientID); if (endpoint != null) { databaseStore.updateSession(username, clientID, session, endpoint); } return session.clientSession; } @Override public void updateSessionIp(String username, String clientID, String ip) { Session session = getSession(clientID); if(session != null && session.getDeleted() == 0) { session.setIp(ip); databaseStore.updateSessionIp(username, clientID, ip); } } @Override public Session sessionForClientAndUser(String username, String clientID) { Session session = sessions.get(clientID); if (session != null) { if (session.getUsername().equals(username)) { return session; } else { cleanSession(null, clientID); } } return null; } @Override public ClientSession sessionForClient(String clientID) { if (!sessions.containsKey(clientID)) { LOG.error("Can't find the session for client <{}>", clientID); return null; } Session session = sessions.get(clientID); return session.getClientSession(); } @Override public void loadUserSession(String username, String clientID) { if (sessions.containsKey(clientID)) { ConcurrentSkipListSet sessionSet = getUserSessionSet(username); sessionSet.add(clientID); return; } Session session = databaseStore.getSession(username, clientID, new ClientSession(clientID, this)); if (session != null) { sessions.put(clientID, session); ConcurrentSkipListSet sessionSet = getUserSessionSet(username); sessionSet.add(clientID); } } private ConcurrentSkipListSet getUserSessionSet(String username) { ConcurrentSkipListSet sessionSet = userSessions.get(username); if (sessionSet == null) { sessionSet = new ConcurrentSkipListSet(); List ss = databaseStore.getUserActivedSessions(username); for (Session s : ss) { sessionSet.add(s.getClientID()); sessions.put(s.getClientID(), s); } userSessions.put(username, sessionSet); } sessionSet = userSessions.get(username); return sessionSet; } @Override public Collection sessionForUser(String username) { ConcurrentSkipListSet sessionSet = getUserSessionSet(username); ArrayList out = new ArrayList<>(); for (String clientId : sessionSet ) { Session session = sessions.get(clientId); if (session != null && session.getUsername().equals(username)) { out.add(session); } } return out; } @Override public Collection getAllSessions() { Collection result = new ArrayList<>(); for (Session entry : sessions.values()) { result.add(new ClientSession(entry.clientID, this)); } return result; } @Override public boolean isClientOnline(String clientId) { return mServer.getProcessor().getConnectionDescriptors().isConnected(clientId); } @Override public StoredMessage inFlightAck(String clientID, int messageID) { return getSession(clientID).outboundFlightMessages.remove(messageID); } @Override public void inFlight(String clientID, int messageID, StoredMessage msg) { Session session = sessions.get(clientID); if (session == null) { LOG.error("Can't find the session for client <{}>", clientID); return; } session.outboundFlightMessages.put(messageID, msg); } /** * Return the next valid packetIdentifier for the given client session. */ @Override public int nextPacketID(String clientID) { if (!sessions.containsKey(clientID)) { LOG.error("Can't find the session for client <{}>", clientID); return -1; } Map m = sessions.get(clientID).outboundFlightMessages; int maxId = m.keySet().isEmpty() ? 0 : Collections.max(m.keySet()); int nextPacketId = (maxId + 1) % 0xFFFF; m.put(nextPacketId, null); return nextPacketId; } @Override public BlockingQueue queue(String clientID) { if (!sessions.containsKey(clientID)) { LOG.error("Can't find the session for client <{}>", clientID); return null; } return sessions.get(clientID).queue; } @Override public void dropQueue(String clientID) { if (sessions.get(clientID) != null) { sessions.get(clientID).queue.clear(); } } @Override public void moveInFlightToSecondPhaseAckWaiting(String clientID, int messageID, StoredMessage msg) { LOG.info("Moving msg inflight second phase store, clientID <{}> messageID {}", clientID, messageID); Session session = sessions.get(clientID); if (session == null) { LOG.error("Can't find the session for client <{}>", clientID); return; } session.secondPhaseStore.put(messageID, msg); session.outboundFlightMessages.put(messageID, msg); } @Override public StoredMessage secondPhaseAcknowledged(String clientID, int messageID) { LOG.info("Acknowledged message in second phase, clientID <{}> messageID {}", clientID, messageID); return getSession(clientID).secondPhaseStore.remove(messageID); } @Override public int getInflightMessagesNo(String clientID) { Session session = sessions.get(clientID); if (session == null) { LOG.error("Can't find the session for client <{}>", clientID); return 0; } return session.inboundFlightMessages.size() + session.secondPhaseStore.size() + session.outboundFlightMessages.size(); } @Override public StoredMessage inboundInflight(String clientID, int messageID) { return getSession(clientID).inboundFlightMessages.get(messageID); } @Override public void markAsInboundInflight(String clientID, int messageID, StoredMessage msg) { if (!sessions.containsKey(clientID)) LOG.error("Can't find the session for client <{}>", clientID); sessions.get(clientID).inboundFlightMessages.put(messageID, msg); } @Override public int getPendingPublishMessagesNo(String clientID) { if (!sessions.containsKey(clientID)) { LOG.error("Can't find the session for client <{}>", clientID); return 0; } return sessions.get(clientID).queue.size(); } @Override public int getSecondPhaseAckPendingMessages(String clientID) { if (!sessions.containsKey(clientID)) { LOG.error("Can't find the session for client <{}>", clientID); return 0; } return sessions.get(clientID).secondPhaseStore.size(); } @Override public ErrorCode kickoffPCClient(String operator, String pcClientId) { Session session = sessions.get(pcClientId); if (session != null) { if(!operator.equals(session.getUsername())) { LOG.error("kickoffPCClient failure, user {} don't have client {}", operator, pcClientId); mServer.getProcessor().getMessagesStore().forceCleanOnlineStatus(operator, pcClientId); return ErrorCode.ERROR_CODE_SUCCESS; } if (session.getPlatform() == ProtoConstants.Platform.Platform_LINUX || session.getPlatform() == ProtoConstants.Platform.Platform_WEB || session.getPlatform() == ProtoConstants.Platform.Platform_Windows || session.getPlatform() == ProtoConstants.Platform.Platform_OSX || session.getPlatform() == ProtoConstants.Platform.Platform_HarmonyPC || session.getPlatform() == ProtoConstants.Platform.Platform_iPad || session.getPlatform() == ProtoConstants.Platform.Platform_APad || session.getPlatform() == ProtoConstants.Platform.Platform_HarmonyPad ) { databaseStore.updateSessionDeleted(operator, pcClientId, 1); sessions.remove(pcClientId); mServer.getProcessor().kickoffSession(session); } else { LOG.error("session {} is not pc client:{}", pcClientId, session.getPlatform()); return ErrorCode.ERROR_CODE_NOT_RIGHT; } } else { LOG.error("Can't find the session for client <{}>", pcClientId); mServer.getProcessor().getMessagesStore().forceCleanOnlineStatus(operator, pcClientId); } return ErrorCode.ERROR_CODE_SUCCESS; } @Override public void disableSession(String userId, String clientId) { Session session = sessions.get(clientId); if (session != null && session.getDeleted() == 0 && (userId == null || session.getUsername().equals(userId))) { mServer.getProcessor().processOffline(session, true, () -> { databaseStore.updateSessionDeleted(session.getUsername(), clientId, 1); ConcurrentSkipListSet sessionSet = getUserSessionSet(session.username); sessionSet.remove(clientId); sessions.remove(clientId); }); } } @Override public void cleanSession(String userId, String clientID) { LOG.info("Fooooooooo <{}>", clientID); Session session = sessions.get(clientID); if (session == null) { LOG.error("Can't find the session for client <{}>", clientID); return; } if(userId != null && !session.getUsername().equals(userId)) { return; } mServer.getProcessor().processOffline(session, true, () -> { ConcurrentSkipListSet sessionSet = getUserSessionSet(session.username); sessionSet.remove(clientID); // remove also the messages stored of type QoS1/2 LOG.info("Removing stored messages with QoS 1 and 2. ClientId={}", clientID); session.secondPhaseStore.clear(); session.outboundFlightMessages.clear(); session.inboundFlightMessages.clear(); LOG.info("Wiping existing subscriptions. ClientId={}", clientID); //remove also the enqueued messages dropQueue(clientID); // TODO this missing last step breaks the junit test sessions.remove(clientID); }); } @Override public boolean isMultiEndpointSupported() { return supportMultiEndpoint; } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/MemoryStorageService.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.persistence; import cn.wildfirechat.server.ThreadPoolExecutorWrapper; import io.moquette.server.Server; import io.moquette.server.config.IConfig; import io.moquette.spi.IMessagesStore; import io.moquette.spi.ISessionsStore; import io.moquette.spi.IStore; import java.util.concurrent.ScheduledExecutorService; public class MemoryStorageService implements IStore { private MemorySessionStore m_sessionsStore; private MemoryMessagesStore m_messagesStore; public MemoryStorageService(IConfig props, ThreadPoolExecutorWrapper scheduler, Server server) { DatabaseStore databaseStore = new DatabaseStore(scheduler); m_messagesStore = new MemoryMessagesStore(server, databaseStore); m_sessionsStore = new MemorySessionStore(server, databaseStore); } @Override public IMessagesStore messagesStore() { return m_messagesStore; } @Override public ISessionsStore sessionsStore() { return m_sessionsStore; } @Override public void initStore() { m_messagesStore.initStore(); m_sessionsStore.initStore(); } @Override public void close() { } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/MessageLoader.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.persistence; import com.hazelcast.core.MapStore; import io.moquette.server.Server; import win.liyufan.im.MessageBundle; import java.util.Collection; import java.util.Map; public class MessageLoader implements MapStore { private DatabaseStore getDatabaseStore() { return Server.getServer().getStore().messagesStore().getDatabaseStore(); } /** * Loads the value of a given key. If distributed map doesn't contain the value * for the given key then Hazelcast will call implementation's load (key) method * to obtain the value. Implementation can use any means of loading the given key; * such as an O/R mapping tool, simple SQL or reading a file etc. * * @param key@return value of the key, value cannot be null */ @Override public MessageBundle load(Long key) { return getDatabaseStore().getMessage(key); } /** * Loads given keys. This is batch load operation so that implementation can * optimize the multiple loads. *

* For any key in the input keys, there should be a single mapping in the resulting map. Also the resulting * map should not have any keys that are not part of the input keys. *

* The given collection should not contain any null keys. * The returned Map should not contain any null keys or values. * * @param keys keys of the values entries to load * @return map of loaded key-value pairs. */ @Override public Map loadAll(Collection keys) { return getDatabaseStore().getMessages(keys); } /** * Loads all of the keys from the store. The returned {@link Iterable} may return the keys lazily * by loading them in batches. The {@link Iterator} of this {@link Iterable} may implement the * {@link Closeable} interface in which case it will be closed once iteration is over. * This is intended for releasing resources such as closing a JDBC result set. *

* The returned Iterable should not contain any null keys. * * @return all the keys. Keys inside the Iterable cannot be null. */ @Override public Iterable loadAllKeys() { return null; } @Override public void store(Long aLong, MessageBundle messageBundle) { getDatabaseStore().persistMessage(messageBundle.getMessage(), false); } @Override public void storeAll(Map map) { } @Override public void delete(Long aLong) { } @Override public void deleteAll(Collection collection) { } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/RobotLoader.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.persistence; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.core.MapStore; import io.moquette.server.Server; import java.util.Collection; import java.util.Map; public class RobotLoader implements MapStore { @Override public void store(String s, WFCMessage.Robot robot) { getDatabaseStore().updateRobot(robot); } @Override public void storeAll(Map map) { } @Override public void delete(String s) { getDatabaseStore().deleteRobot(s); } @Override public void deleteAll(Collection collection) { } private DatabaseStore getDatabaseStore() { return Server.getServer().getStore().messagesStore().getDatabaseStore(); } @Override public WFCMessage.Robot load(String key) { return getDatabaseStore().getRobot(key); } @Override public Map loadAll(Collection keys) { return null; } @Override public Iterable loadAllKeys() { return null; } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/ServerAPIHelper.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.persistence; import cn.wildfirechat.proto.ProtoConstants; import io.moquette.persistence.remote.*; import io.moquette.server.Server; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import cn.wildfirechat.common.ErrorCode; import java.util.concurrent.*; import java.util.concurrent.atomic.AtomicInteger; public class ServerAPIHelper { private static final Logger LOG = LoggerFactory.getLogger(ServerAPIHelper.class); public static final String CHECK_USER_ONLINE_REQUEST = "check_user_online"; public static final String KICKOFF_USER_REQUEST = "kickoff_user"; private static Server server; public static ConcurrentHashMap requestMap = new ConcurrentHashMap<>(); private static AtomicInteger aiRequestId = new AtomicInteger(1); public static ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(2); public static void init(Server s) { server = s; } public interface Callback { void onSuccess(byte[] response); void onError(ErrorCode errorCode); void onTimeout(); Executor getResponseExecutor(); } public static void sendRequest(String fromUser, String clientId, String request, byte[] message, Callback callback, ProtoConstants.RequestSourceType requestSourceType) { int requestId = 0; if (callback != null) { requestId = aiRequestId.incrementAndGet(); if (requestId == Integer.MAX_VALUE) { if(!aiRequestId.compareAndSet(Integer.MAX_VALUE, 1)) { requestId = aiRequestId.incrementAndGet(); } } requestMap.put(requestId, new RequestInfo(fromUser, clientId, callback, message, requestId, request)); } server.onApiMessage(fromUser, clientId, message, requestId, "", request, requestSourceType); } public static void sendResponse(int errorCode, byte[] message, String toUuid, int requestId) { LOG.debug("send async reponse to {} with requestId {}", toUuid, requestId); if (requestId > 0) { RequestInfo info = requestMap.remove(requestId); LOG.debug("receive async reponse requestId {}, errorCode {}", requestId, errorCode); if(info != null) { info.future.cancel(true); if (info.callback != null) { info.callback.getResponseExecutor().execute(() -> { if (errorCode == 0 || errorCode == ErrorCode.ERROR_CODE_SUCCESS_GZIPED.getCode()) { info.callback.onSuccess(message); } else { info.callback.onError(ErrorCode.fromCode(errorCode)); } }); } else { } } } } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/UserClientEntry.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.persistence; import java.io.Serializable; public class UserClientEntry implements Serializable { public UserClientEntry(String userId, String clientId) { this.userId = userId; this.clientId = clientId; } public String userId; public String clientId; } ================================================ FILE: broker/src/main/java/io/moquette/persistence/UserLoader.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.persistence; import cn.wildfirechat.proto.WFCMessage; import com.hazelcast.core.MapLoader; import com.hazelcast.core.MapStore; import io.moquette.server.Server; import java.util.Collection; import java.util.Map; public class UserLoader implements MapStore { @Override public void store(String s, WFCMessage.User user) { // getDatabaseStore().updateUser(user); } @Override public void storeAll(Map map) { } @Override public void delete(String s) { getDatabaseStore().deleteUser(s); } @Override public void deleteAll(Collection collection) { } private DatabaseStore getDatabaseStore() { return Server.getServer().getStore().messagesStore().getDatabaseStore(); } @Override public WFCMessage.User load(String key) { return getDatabaseStore().getPersistUser(key); } @Override public Map loadAll(Collection keys) { return null; } @Override public Iterable loadAllKeys() { return null; } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/UserStatusLoader.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.persistence; import com.hazelcast.core.MapStore; import io.moquette.server.Server; import java.util.Collection; import java.util.Map; public class UserStatusLoader implements MapStore { @Override public void store(String s, Integer status) { getDatabaseStore().updateUserStatus(s, status); } @Override public void storeAll(Map map) { } @Override public void delete(String s) { getDatabaseStore().deleteUserStatus(s); } @Override public void deleteAll(Collection collection) { } private DatabaseStore getDatabaseStore() { return Server.getServer().getStore().messagesStore().getDatabaseStore(); } @Override public Integer load(String key) { return getDatabaseStore().getUserStatus(key); } @Override public Map loadAll(Collection keys) { return null; } @Override public Iterable loadAllKeys() { return null; } } ================================================ FILE: broker/src/main/java/io/moquette/persistence/remote/RequestInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package io.moquette.persistence.remote; import io.moquette.persistence.ServerAPIHelper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; public class RequestInfo { private static final Logger LOG = LoggerFactory.getLogger(RequestInfo.class); public final ServerAPIHelper.Callback callback; final byte[] message; final int requestId; final String fromUser; final String request; final String clientId; public final ScheduledFuture future; public RequestInfo(String fromUser, String clientId, ServerAPIHelper.Callback callback, byte[] message, int requestId, String request) { this.callback = callback; this.message = message; this.requestId = requestId; this.fromUser = fromUser; this.clientId = clientId; this.request = request; this.future = ServerAPIHelper.scheduledExecutorService.schedule(() -> { RequestInfo info = ServerAPIHelper.requestMap.remove(requestId); if (info != null) { LOG.error("Request timeout. fromUser {}, cliendId {}, requestId {}, request {}", fromUser, clientId, requestId, request); info.callback.getResponseExecutor().execute(() -> { info.callback.onTimeout(); }); } }, 5, TimeUnit.SECONDS); } } ================================================ FILE: broker/src/main/java/io/moquette/server/ConnectionDescriptor.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server; import java.util.NoSuchElementException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import io.moquette.server.netty.AutoFlushHandler; import io.moquette.server.netty.NettyUtils; import io.moquette.server.netty.metrics.BytesMetrics; import io.moquette.server.netty.metrics.BytesMetricsHandler; import io.moquette.server.netty.metrics.MessageMetrics; import io.moquette.server.netty.metrics.MessageMetricsHandler; import io.netty.channel.Channel; /** * Value object to maintain the information of single connection, like ClientID, Channel, and clean * session flag. */ public class ConnectionDescriptor { private static final Logger LOG = LoggerFactory.getLogger(ConnectionDescriptor.class); public enum ConnectionState { // Connection states DISCONNECTED, SENDACK, SESSION_CREATED, MESSAGES_REPUBLISHED, ESTABLISHED, // Disconnection states MESSAGES_DROPPED, INTERCEPTORS_NOTIFIED; } public final String clientID; private final Channel channel; private final AtomicReference channelState = new AtomicReference<>(ConnectionState.DISCONNECTED); public ConnectionDescriptor(String clientID, Channel session) { this.clientID = clientID; this.channel = session; } public void writeAndFlush(Object payload) { this.channel.writeAndFlush(payload); } public void setupAutoFlusher(int flushIntervalMs) { try { this.channel.pipeline().addAfter( "idleEventHandler", "autoFlusher", new AutoFlushHandler(flushIntervalMs, TimeUnit.MILLISECONDS)); } catch (NoSuchElementException nseex) { // the idleEventHandler is not present on the pipeline this.channel.pipeline() .addFirst("autoFlusher", new AutoFlushHandler(flushIntervalMs, TimeUnit.MILLISECONDS)); } } public boolean doesNotUseChannel(Channel channel) { return !(this.channel.equals(channel)); } public boolean close() { LOG.info("Closing connection descriptor. MqttClientId = {}.", clientID); final boolean success = assignState(ConnectionState.INTERCEPTORS_NOTIFIED, ConnectionState.DISCONNECTED); if (!success) { return false; } this.channel.close(); return true; } public String getUsername() { return NettyUtils.userName(this.channel); } public void abort() { LOG.info("Closing connection descriptor. MqttClientId = {}.", clientID); // try { // this.channel.disconnect().sync(); this.channel.close(); // .sync(); // } catch (InterruptedException e) { // e.printStackTrace(); // } } public boolean assignState(ConnectionState expected, ConnectionState newState) { LOG.debug( "Updating state of connection descriptor. MqttClientId = {}, expectedState = {}, newState = {}.", clientID, expected, newState); boolean retval = channelState.compareAndSet(expected, newState); if (!retval) { LOG.error( "Unable to update state of connection descriptor." + " MqttclientId = {}, expectedState = {}, newState = {}.", clientID, expected, newState); } return retval; } @Override public String toString() { return "ConnectionDescriptor{" + "clientID=" + clientID + ", state=" + channelState.get() + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ConnectionDescriptor that = (ConnectionDescriptor) o; if (clientID != null ? !clientID.equals(that.clientID) : that.clientID != null) return false; return !(channel != null ? !channel.equals(that.channel) : that.channel != null); } public BytesMetrics getBytesMetrics() { return BytesMetricsHandler.getBytesMetrics(channel); } public MessageMetrics getMessageMetrics() { return MessageMetricsHandler.getMessageMetrics(channel); } @Override public int hashCode() { int result = clientID != null ? clientID.hashCode() : 0; result = 31 * result + (channel != null ? channel.hashCode() : 0); return result; } public Channel getChannel() { return channel; } } ================================================ FILE: broker/src/main/java/io/moquette/server/ConnectionDescriptorStore.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server; import io.moquette.connections.IConnectionsManager; import io.moquette.connections.MqttConnectionMetrics; import io.moquette.connections.MqttSession; import io.moquette.server.netty.metrics.BytesMetrics; import io.moquette.server.netty.metrics.MessageMetrics; import io.moquette.spi.ClientSession; import io.moquette.spi.ISessionsStore; import io.netty.handler.codec.mqtt.MqttMessage; import io.netty.handler.codec.mqtt.MqttMessageType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import cn.wildfirechat.common.ErrorCode; import java.util.ArrayList; import java.util.Collection; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; public class ConnectionDescriptorStore implements IConnectionsManager { private static final Logger LOG = LoggerFactory.getLogger(ConnectionDescriptorStore.class); private final ConcurrentMap connectionDescriptors; private final ISessionsStore sessionsStore; public ConnectionDescriptorStore(ISessionsStore sessionsStore) { this.connectionDescriptors = new ConcurrentHashMap<>(); this.sessionsStore = sessionsStore; } public boolean sendMessage(MqttMessage message, Integer messageID, String clientID, ErrorCode errorCode) { final MqttMessageType messageType = message.fixedHeader().messageType(); try { if (messageID != null) { LOG.info("Sending {} message CId=<{}>, messageId={}, errorCode={}", messageType, clientID, messageID, errorCode); } else { LOG.debug("Sending {} message CId=<{}>", messageType, clientID); } ConnectionDescriptor descriptor = connectionDescriptors.get(clientID); if (descriptor == null) { if (messageID != null) { LOG.error("Client has just disconnected. {} message could not be sent. CId=<{}>, messageId={}", messageType, clientID, messageID); } else { LOG.error("Client has just disconnected. {} could not be sent. CId=<{}>", messageType, clientID); } /* * If the client has just disconnected, its connection descriptor will be null. We * don't have to make the broker crash: we'll just discard the PUBACK message. */ return false; } descriptor.writeAndFlush(message); return true; } catch (Throwable e) { String errorMsg = "Unable to send " + messageType + " message. CId=<" + clientID + ">"; if (messageID != null) { errorMsg += ", messageId=" + messageID; } LOG.error(errorMsg, e); return false; } } public ConnectionDescriptor addConnection(ConnectionDescriptor descriptor) { return connectionDescriptors.putIfAbsent(descriptor.clientID, descriptor); } public boolean removeConnection(ConnectionDescriptor descriptor) { return connectionDescriptors.remove(descriptor.clientID, descriptor); } public ConnectionDescriptor getConnection(String clientID) { return connectionDescriptors.get(clientID); } @Override public boolean isConnected(String clientID) { return connectionDescriptors.containsKey(clientID); } @Override public int getActiveConnectionsNo() { return connectionDescriptors.size(); } @Override public Collection getConnectedClientIds() { return connectionDescriptors.keySet(); } @Override public boolean closeConnection(String clientID, boolean closeImmediately) { ConnectionDescriptor descriptor = connectionDescriptors.get(clientID); if (descriptor == null) { LOG.error("Connection descriptor doesn't exist. MQTT connection cannot be closed. CId=<{}>, " + "closeImmediately={}", clientID, closeImmediately); return false; } if (closeImmediately) { descriptor.abort(); return true; } else { return descriptor.close(); } } @Override public MqttSession getSessionStatus(String clientID) { LOG.info("Retrieving status of session. CId=<{}>", clientID); ClientSession session = sessionsStore.sessionForClient(clientID); if (session == null) { LOG.error("MQTT client ID doesn't have an associated session. CId=<{}>", clientID); return null; } return buildMqttSession(session); } @Override public Collection getSessions() { LOG.info("Retrieving status of all sessions."); Collection result = new ArrayList<>(); for (ClientSession session : sessionsStore.getAllSessions()) { result.add(buildMqttSession(session)); } return result; } private MqttSession buildMqttSession(ClientSession session) { MqttSession result = new MqttSession(); result.setCleanSession(true); ConnectionDescriptor descriptor = this.getConnection(session.clientID); if (descriptor != null) { result.setConnectionEstablished(true); BytesMetrics bytesMetrics = descriptor.getBytesMetrics(); MessageMetrics messageMetrics = descriptor.getMessageMetrics(); result.setConnectionMetrics(new MqttConnectionMetrics(bytesMetrics.readBytes(), bytesMetrics.wroteBytes(), messageMetrics.messagesRead(), messageMetrics.messagesWrote())); } else { result.setConnectionEstablished(false); } result.setPendingPublishMessagesNo(session.getPendingPublishMessagesNo()); result.setSecondPhaseAckPendingMessages(session.getSecondPhaseAckPendingMessages()); result.setInflightMessages(session.getInflightMessagesNo()); return result; } } ================================================ FILE: broker/src/main/java/io/moquette/server/Constants.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server; /** * Server constants keeper */ public final class Constants { public static final String ATTR_CLIENTID = "ClientID"; public static final String CLEAN_SESSION = "cleanSession"; public static final String KEEP_ALIVE = "keepAlive"; public static int MAX_MESSAGE_QUEUE = 1024; // number of messages public static int MAX_CHATROOM_MESSAGE_QUEUE = 256; // number of chatroom messages private Constants() { } } ================================================ FILE: broker/src/main/java/io/moquette/server/DefaultMoquetteSslContextCreator.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server; import io.moquette.BrokerConstants; import io.moquette.server.config.IConfig; import io.moquette.spi.security.ISslContextCreator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.net.ssl.KeyManagerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.TrustManager; import javax.net.ssl.TrustManagerFactory; import java.io.*; import java.net.URL; import java.security.*; import java.security.cert.CertificateException; /** * Moquette server implementation to load SSL certificate from local filesystem path configured in * config file. */ public class DefaultMoquetteSslContextCreator implements ISslContextCreator { private static final Logger LOG = LoggerFactory.getLogger(DefaultMoquetteSslContextCreator.class); private IConfig props; public DefaultMoquetteSslContextCreator(IConfig props) { this.props = props; } @Override public SSLContext initSSLContext() { LOG.info("Checking SSL configuration properties..."); final String jksPath = props.getProperty(BrokerConstants.JKS_PATH_PROPERTY_NAME); LOG.info("Initializing SSL context. KeystorePath = {}.", jksPath); if (jksPath == null || jksPath.isEmpty()) { // key_store_password or key_manager_password are empty LOG.warn("The keystore path is null or empty. The SSL context won't be initialized."); return null; } // if we have the port also the jks then keyStorePassword and keyManagerPassword // has to be defined final String keyStorePassword = props.getProperty(BrokerConstants.KEY_STORE_PASSWORD_PROPERTY_NAME); final String keyManagerPassword = props.getProperty(BrokerConstants.KEY_MANAGER_PASSWORD_PROPERTY_NAME); if (keyStorePassword == null || keyStorePassword.isEmpty()) { // key_store_password or key_manager_password are empty LOG.warn("The keystore password is null or empty. The SSL context won't be initialized."); return null; } if (keyManagerPassword == null || keyManagerPassword.isEmpty()) { // key_manager_password or key_manager_password are empty LOG.warn("The key manager password is null or empty. The SSL context won't be initialized."); return null; } // if client authentification is enabled a trustmanager needs to be // added to the ServerContext String sNeedsClientAuth = props.getProperty(BrokerConstants.NEED_CLIENT_AUTH, "false"); boolean needsClientAuth = Boolean.valueOf(sNeedsClientAuth); try { LOG.info("Loading keystore. KeystorePath = {}.", jksPath); InputStream jksInputStream = jksDatastore(jksPath); SSLContext serverContext = SSLContext.getInstance("TLS"); final KeyStore ks = KeyStore.getInstance("JKS"); ks.load(jksInputStream, keyStorePassword.toCharArray()); LOG.info("Initializing key manager..."); final KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); kmf.init(ks, keyManagerPassword.toCharArray()); TrustManager[] trustManagers = null; if (needsClientAuth) { LOG.warn( "Client authentication is enabled. " + "The keystore will be used as a truststore. KeystorePath = {}.", jksPath); // use keystore as truststore, as server needs to trust certificates signed by the // server certificates TrustManagerFactory tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); tmf.init(ks); trustManagers = tmf.getTrustManagers(); } // init sslContext LOG.info("Initializing SSL context..."); serverContext.init(kmf.getKeyManagers(), trustManagers, null); LOG.info("The SSL context has been initialized successfully."); return serverContext; } catch (NoSuchAlgorithmException | UnrecoverableKeyException | CertificateException | KeyStoreException | KeyManagementException | IOException ex) { LOG.error( "Unable to initialize SSL context. Cause = {}, errorMessage = {}.", ex.getCause(), ex.getMessage()); return null; } } private InputStream jksDatastore(String jksPath) throws FileNotFoundException { URL jksUrl = getClass().getClassLoader().getResource(jksPath); if (jksUrl != null) { LOG.info("Starting with jks at {}, jks normal {}", jksUrl.toExternalForm(), jksUrl); return getClass().getClassLoader().getResourceAsStream(jksPath); } LOG.warn("No keystore has been found in the bundled resources. Scanning filesystem..."); File jksFile = new File(jksPath); if (jksFile.exists()) { LOG.info("Loading external keystore. Url = {}.", jksFile.getAbsolutePath()); return new FileInputStream(jksFile); } LOG.warn("The keystore file does not exist. Url = {}.", jksFile.getAbsolutePath()); return null; } } ================================================ FILE: broker/src/main/java/io/moquette/server/Server.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.push.PushServer; import cn.wildfirechat.server.ThreadPoolExecutorWrapper; import com.hazelcast.config.ClasspathXmlConfig; import com.hazelcast.config.Config; import com.hazelcast.config.FileSystemXmlConfig; import com.hazelcast.core.*; import com.xiaoleilu.loServer.LoServer; import com.xiaoleilu.loServer.ServerSetting; import com.xiaoleilu.loServer.action.Action; import com.xiaoleilu.loServer.action.admin.AdminAction; import io.moquette.BrokerConstants; import io.moquette.persistence.*; import io.moquette.connections.IConnectionsManager; import io.moquette.interception.*; import io.moquette.server.config.*; import io.moquette.server.netty.NettyAcceptor; import io.moquette.spi.IStore; import io.moquette.spi.impl.ProtocolProcessor; import io.moquette.spi.impl.ProtocolProcessorBootstrapper; import io.moquette.spi.impl.security.AES; import io.moquette.spi.security.IAuthenticator; import io.moquette.spi.security.IAuthorizator; import io.moquette.spi.security.ISslContextCreator; import io.moquette.spi.security.Tokenor; import io.netty.util.ResourceLeakDetector; import io.netty.util.internal.StringUtil; import win.liyufan.im.DBUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.MessageShardingUtil; import win.liyufan.im.Utility; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.util.Collections; import java.util.List; import java.util.Properties; import java.util.concurrent.Executors; import static io.moquette.BrokerConstants.*; import static io.moquette.logging.LoggingUtils.getInterceptorIds; /** * Launch a configured version of the server. */ public class Server { private final static String BANNER = " _ _ _ __ _ _ _ \n" + " __ __(_)| | __| | / _|(_) _ __ ___ ___ | |__ __ _ | |_ \n" + " \\ \\ /\\ / /| || | / _` || |_ | || '__|/ _ \\ / __|| '_ \\ / _` || __|\n" + " \\ V V / | || || (_| || _|| || | | __/ | (__ | | | || (_| || |_ \n" + " \\_/\\_/ |_||_| \\__,_||_| |_||_| \\___| \\___||_| |_| \\__,_| \\__|\n"; private static final Logger LOG = LoggerFactory.getLogger(Server.class); private static Server instance; public static Server getServer() { return instance; } private ServerAcceptor m_acceptor; private long startTime; private boolean m_shutdowning = false; public volatile boolean m_initialized; private ProtocolProcessor m_processor; private HazelcastInstance hazelcastInstance; private ProtocolProcessorBootstrapper m_processorBootstrapper; private ThreadPoolExecutorWrapper dbScheduler; private ThreadPoolExecutorWrapper imBusinessScheduler; private ThreadPoolExecutorWrapper callbackScheduler; private IConfig mConfig; private IStore m_store; static { System.out.println(BANNER); } public Server() { startTime = System.currentTimeMillis(); } public static void start(String[] args) throws IOException { instance = new Server(); final IConfig config = defaultConfig(); System.setProperty("hazelcast.logging.type", "none" ); instance.mConfig = config; ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.ADVANCED); instance.startServer(config); int httpLocalPort = Integer.parseInt(config.getProperty(BrokerConstants.HTTP_LOCAL_PORT)); int httpAdminPort = Integer.parseInt(config.getProperty(BrokerConstants.HTTP_ADMIN_PORT)); AdminAction.setSecretKey(config.getProperty(HTTP_SERVER_SECRET_KEY)); AdminAction.setNoCheckTime(config.getProperty(HTTP_SERVER_API_NO_CHECK_TIME)); final LoServer httpServer = new LoServer(httpLocalPort, httpAdminPort, instance.m_processor.getMessagesStore(), instance.m_store.sessionsStore()); try { httpServer.start(); } catch (InterruptedException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } final PushServer pushServer = PushServer.getServer(); pushServer.init(config, instance.getStore().sessionsStore()); //Bind a shutdown hook Runtime.getRuntime().addShutdownHook(new Thread(instance::stopServer)); Runtime.getRuntime().addShutdownHook(new Thread(httpServer::shutdown)); System.out.println("Wildfire IM server start success."); } /** * Starts Moquette bringing the configuration from the file located at m_config/wildfirechat.conf * * @throws IOException * in case of any IO error. */ public void startServer() throws IOException { final IConfig config = defaultConfig(); startServer(config); } public static IConfig defaultConfig() { File defaultConfigurationFile = defaultConfigFile(); LOG.info("Starting Moquette server. Configuration file path={}", defaultConfigurationFile.getAbsolutePath()); IResourceLoader filesystemLoader = new FileResourceLoader(defaultConfigurationFile); return new ResourceLoaderConfig(filesystemLoader); } private static File defaultConfigFile() { String configPath = System.getProperty("wildfirechat.path", null); return new File(configPath, IConfig.DEFAULT_CONFIG); } /** * Starts Moquette bringing the configuration from the given file * * @param configFile * text file that contains the configuration. * @throws IOException * in case of any IO Error. */ public void startServer(File configFile) throws IOException { LOG.info("Starting Moquette server. Configuration file path={}", configFile.getAbsolutePath()); IResourceLoader filesystemLoader = new FileResourceLoader(configFile); final IConfig config = new ResourceLoaderConfig(filesystemLoader); startServer(config); } /** * Starts the server with the given properties. * * * @param configProps * the properties map to use as configuration. * @throws IOException * in case of any IO Error. */ public void startServer(Properties configProps) throws IOException { LOG.info("Starting Moquette server using properties object"); final IConfig config = new MemoryConfig(configProps); startServer(config); } /** * Starts Moquette bringing the configuration files from the given Config implementation. * * @param config * the configuration to use to start the broker. * @throws IOException * in case of any IO Error. */ public void startServer(IConfig config) throws IOException { LOG.info("Starting Moquette server using IConfig instance..."); startServer(config, null); } /** * Starts Moquette with config provided by an implementation of IConfig class and with the set * of InterceptHandler. * * @param config * the configuration to use to start the broker. * @param handlers * the handlers to install in the broker. * @throws IOException * in case of any IO Error. */ public void startServer(IConfig config, List handlers) throws IOException { LOG.info("Starting moquette server using IConfig instance and intercept handlers"); startServer(config, handlers, null, null, null); } public void startServer(IConfig config, List handlers, ISslContextCreator sslCtxCreator, IAuthenticator authenticator, IAuthorizator authorizator) throws IOException { if (handlers == null) { handlers = Collections.emptyList(); } DBUtil.init(config); LOG.info("Starting Moquette Server. MQTT message interceptors={}", getInterceptorIds(handlers)); int threadNum = Runtime.getRuntime().availableProcessors() * 2; dbScheduler = new ThreadPoolExecutorWrapper(Executors.newScheduledThreadPool(threadNum), threadNum, "db"); imBusinessScheduler = new ThreadPoolExecutorWrapper(Executors.newScheduledThreadPool(threadNum), threadNum, "business"); callbackScheduler = new ThreadPoolExecutorWrapper(Executors.newScheduledThreadPool(1), 1, "callback"); final String handlerProp = System.getProperty(BrokerConstants.INTERCEPT_HANDLER_PROPERTY_NAME); if (handlerProp != null) { config.setProperty(BrokerConstants.INTERCEPT_HANDLER_PROPERTY_NAME, handlerProp); } initMediaServerConfig(config); Action.init(config); String monitorEventAddress = config.getProperty(MONITOR_Exception_Event_Address); Utility.setMonitorEventAddress(monitorEventAddress); final String persistencePath = config.getProperty(BrokerConstants.PERSISTENT_STORE_PROPERTY_NAME); LOG.info("Configuring Using persistent store file, path={}", persistencePath); m_store = initStore(config, this); m_processorBootstrapper = new ProtocolProcessorBootstrapper(); boolean configured = configureCluster(config); m_store.initStore(); final ProtocolProcessor processor = m_processorBootstrapper.init(config, handlers, authenticator, authorizator, this, m_store); LOG.info("Initialized MQTT protocol processor"); if (sslCtxCreator == null) { LOG.warn("Using default SSL context creator"); sslCtxCreator = new DefaultMoquetteSslContextCreator(config); } m_processor = processor; LOG.info("Binding server to the configured ports"); m_acceptor = new NettyAcceptor(); m_acceptor.initialize(processor, config, sslCtxCreator); LOG.info("Moquette server has been initialized successfully"); m_initialized = configured; } private IStore initStore(IConfig props, Server server) { LOG.info("Initializing messages and sessions stores..."); IStore store = instantiateConfiguredStore(props, server.getDbScheduler(), server); if (store == null) { throw new IllegalArgumentException("Can't start the persistence layer"); } return store; } private IStore instantiateConfiguredStore(IConfig props, ThreadPoolExecutorWrapper scheduledExecutor, Server server) { return new MemoryStorageService(props, scheduledExecutor, server); } public IStore getStore() { return m_store; } private void initMediaServerConfig(IConfig config) { MediaServerConfig.QINIU_ACCESS_KEY = config.getProperty(BrokerConstants.QINIU_ACCESS_KEY, MediaServerConfig.QINIU_ACCESS_KEY); MediaServerConfig.QINIU_SECRET_KEY = config.getProperty(BrokerConstants.QINIU_SECRET_KEY, MediaServerConfig.QINIU_SECRET_KEY); MediaServerConfig.QINIU_SERVER_URL = config.getProperty(BrokerConstants.QINIU_SERVER_URL, MediaServerConfig.QINIU_SERVER_URL); if (MediaServerConfig.QINIU_SERVER_URL.contains("//")) { MediaServerConfig.QINIU_SERVER_URL = MediaServerConfig.QINIU_SERVER_URL.substring(MediaServerConfig.QINIU_SERVER_URL.indexOf("//") + 2); } MediaServerConfig.QINIU_BUCKET_GENERAL_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_GENERAL_NAME); MediaServerConfig.QINIU_BUCKET_GENERAL_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_GENERAL_DOMAIN); MediaServerConfig.QINIU_BUCKET_IMAGE_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_IMAGE_NAME); MediaServerConfig.QINIU_BUCKET_IMAGE_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_IMAGE_DOMAIN); MediaServerConfig.QINIU_BUCKET_VOICE_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_VOICE_NAME); MediaServerConfig.QINIU_BUCKET_VOICE_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_VOICE_DOMAIN); MediaServerConfig.QINIU_BUCKET_VIDEO_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_VIDEO_NAME); MediaServerConfig.QINIU_BUCKET_VIDEO_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_VIDEO_DOMAIN); MediaServerConfig.QINIU_BUCKET_FILE_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_FILE_NAME); MediaServerConfig.QINIU_BUCKET_FILE_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_FILE_DOMAIN); MediaServerConfig.QINIU_BUCKET_STICKER_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_STICKER_NAME); MediaServerConfig.QINIU_BUCKET_STICKER_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_STICKER_DOMAIN); MediaServerConfig.QINIU_BUCKET_MOMENTS_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_MOMENTS_NAME); MediaServerConfig.QINIU_BUCKET_MOMENTS_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_MOMENTS_DOMAIN); MediaServerConfig.QINIU_BUCKET_PORTRAIT_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_PORTRAIT_NAME); MediaServerConfig.QINIU_BUCKET_PORTRAIT_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_PORTRAIT_DOMAIN); MediaServerConfig.QINIU_BUCKET_FAVORITE_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_FAVORITE_NAME); MediaServerConfig.QINIU_BUCKET_FAVORITE_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_FAVORITE_DOMAIN); MediaServerConfig.QINIU_BUCKET_CUSTOM1_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_CUSTOM1_NAME); MediaServerConfig.QINIU_BUCKET_CUSTOM1_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_CUSTOM1_DOMAIN); MediaServerConfig.QINIU_BUCKET_CUSTOM2_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_CUSTOM2_NAME); MediaServerConfig.QINIU_BUCKET_CUSTOM2_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_CUSTOM2_DOMAIN); MediaServerConfig.QINIU_BUCKET_CUSTOM3_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_CUSTOM3_NAME); MediaServerConfig.QINIU_BUCKET_CUSTOM3_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_CUSTOM3_DOMAIN); MediaServerConfig.QINIU_BUCKET_PAN_NAME = config.getProperty(BrokerConstants.QINIU_BUCKET_PAN_NAME); MediaServerConfig.QINIU_BUCKET_PAN_DOMAIN = config.getProperty(BrokerConstants.QINIU_BUCKET_PAN_DOMAIN); MediaServerConfig.SERVER_IP = getServerIp(config); MediaServerConfig.HTTP_SERVER_PORT = Integer.parseInt(config.getProperty(BrokerConstants.HTTP_SERVER_PORT)); MediaServerConfig.FILE_STROAGE_ROOT = config.getProperty(BrokerConstants.FILE_STORAGE_ROOT, MediaServerConfig.FILE_STROAGE_ROOT); File file = new File(MediaServerConfig.FILE_STROAGE_ROOT); if (!file.exists()) { file.mkdirs(); } ServerSetting.setRoot(file); MediaServerConfig.FILE_STROAGE_REMOTE_SERVER_URL = config.getProperty(FILE_STORAGE_REMOTE_SERVER_URL); MediaServerConfig.USER_QINIU = Integer.parseInt(config.getProperty(BrokerConstants.USER_QINIU)) > 0; if(MediaServerConfig.USER_QINIU) { if(MediaServerConfig.QINIU_SERVER_URL.split(":").length == 2) { String error = "媒体存储服务只能填上Host,不能带端口"; System.out.println(error); LOG.error(error); } } } private String getServerIp(IConfig config) { String serverIp = config.getProperty(BrokerConstants.SERVER_IP_PROPERTY_NAME); if (serverIp == null || serverIp.equals("0.0.0.0")) { if(Utility.getLocalAddress() != null) { serverIp = Utility.getLocalAddress().getHostAddress(); } else { serverIp = "0.0.0.0"; } } return serverIp; } private boolean configureCluster(IConfig config) throws FileNotFoundException { LOG.info("Configuring embedded Hazelcast instance"); serverIp = getServerIp(config); String hzConfigPath = System.getProperty("hazelcast.configuration", "config/hazelcast.xml"); if (hzConfigPath != null) { boolean isHzConfigOnClasspath = this.getClass().getClassLoader().getResource(hzConfigPath) != null; Config hzconfig = isHzConfigOnClasspath ? new ClasspathXmlConfig(hzConfigPath) : new FileSystemXmlConfig(hzConfigPath); LOG.info("Starting Hazelcast instance. ConfigurationFile={}", hzconfig); hazelcastInstance = Hazelcast.newHazelcastInstance(hzconfig); } else { LOG.info("Starting Hazelcast instance with default configuration"); hazelcastInstance = Hazelcast.newHazelcastInstance(); } longPort = config.getProperty(BrokerConstants.PORT_PROPERTY_NAME); shortPort = config.getProperty(BrokerConstants.HTTP_SERVER_PORT); boolean aes256 = Boolean.parseBoolean(config.getProperty(ENCRYPT_AES256, "false")); MessageShardingUtil.setNodeId(1); Tokenor.setKey(config.getProperty(BrokerConstants.TOKEN_SECRET_KEY)); AES.useAes256(aes256); String expirTimeStr = config.getProperty(TOKEN_EXPIRE_TIME); if (!StringUtil.isNullOrEmpty(expirTimeStr)) { try { Tokenor.setExpiredTime(Long.parseLong(expirTimeStr)); } catch (NumberFormatException e) { e.printStackTrace(); } } ServerAPIHelper.init(this); return true; } private String serverIp; private String longPort; private String shortPort; public String getServerIp() { return serverIp; } public String getLongPort() { return longPort; } public String getShortPort() { return shortPort; } public HazelcastInstance getHazelcastInstance() { return hazelcastInstance; } public void onApiMessage(String fromUser, String clientId, byte[] message, int messageId, String from, String request, ProtoConstants.RequestSourceType requestSourceType) { LOG.debug("onApiMessage"); m_processor.onApiMessage(fromUser, clientId, message, messageId, from, request, requestSourceType); } public boolean isShutdowning() { return m_shutdowning; } public void stopServer() { System.out.println("Server will flush data to db before shutting down, please wait 5 seconds!"); LOG.info("Unbinding server from the configured ports"); m_shutdowning = true; DBUtil.SystemExiting = true; m_acceptor.close(); LOG.trace("Stopping MQTT protocol processor"); m_processorBootstrapper.shutdown(); m_initialized = false; if (hazelcastInstance != null) { LOG.trace("Stopping embedded Hazelcast instance"); try { hazelcastInstance.shutdown(); } catch (HazelcastInstanceNotActiveException e) { LOG.warn("embedded Hazelcast instance is already shut down."); } } dbScheduler.shutdown(); imBusinessScheduler.shutdown(); callbackScheduler.shutdown(); LOG.info("Moquette server has been stopped."); } /** * SPI method used by Broker embedded applications to add intercept handlers. * * @param interceptHandler * the handler to add. */ public void addInterceptHandler(InterceptHandler interceptHandler) { if (!m_initialized) { LOG.error("Moquette is not started, MQTT message interceptor cannot be added. InterceptorId={}", interceptHandler.getID()); throw new IllegalStateException("Can't register interceptors on a server that is not yet started"); } LOG.info("Adding MQTT message interceptor. InterceptorId={}", interceptHandler.getID()); m_processor.addInterceptHandler(interceptHandler); } /** * SPI method used by Broker embedded applications to remove intercept handlers. * * @param interceptHandler * the handler to remove. */ public void removeInterceptHandler(InterceptHandler interceptHandler) { if (!m_initialized) { LOG.error("Moquette is not started, MQTT message interceptor cannot be removed. InterceptorId={}", interceptHandler.getID()); throw new IllegalStateException("Can't deregister interceptors from a server that is not yet started"); } LOG.info("Removing MQTT message interceptor. InterceptorId={}", interceptHandler.getID()); m_processor.removeInterceptHandler(interceptHandler); } public IConfig getConfig() { return mConfig; } /** * Returns the connections manager of this broker. * * @return IConnectionsManager the instance used bt the broker. */ public IConnectionsManager getConnectionsManager() { return m_processorBootstrapper.getConnectionDescriptors(); } public ProtocolProcessor getProcessor() { return m_processor; } public ThreadPoolExecutorWrapper getDbScheduler() { return dbScheduler; } public ThreadPoolExecutorWrapper getImBusinessScheduler() { return imBusinessScheduler; } public ThreadPoolExecutorWrapper getCallbackScheduler() { return callbackScheduler; } public long getRunTime() { return (System.currentTimeMillis() - startTime)/1000; } } ================================================ FILE: broker/src/main/java/io/moquette/server/ServerAcceptor.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server; import java.io.IOException; import io.moquette.server.config.IConfig; import io.moquette.spi.impl.ProtocolProcessor; import io.moquette.spi.security.ISslContextCreator; public interface ServerAcceptor { void initialize(ProtocolProcessor processor, IConfig props, ISslContextCreator sslCtxCreator) throws IOException; void close(); } ================================================ FILE: broker/src/main/java/io/moquette/server/config/ClasspathResourceLoader.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.config; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class ClasspathResourceLoader implements IResourceLoader { private static final Logger LOG = LoggerFactory.getLogger(ClasspathResourceLoader.class); private final String defaultResource; private final ClassLoader classLoader; public ClasspathResourceLoader() { this(IConfig.DEFAULT_CONFIG); } public ClasspathResourceLoader(String defaultResource) { this(defaultResource, Thread.currentThread().getContextClassLoader()); } public ClasspathResourceLoader(String defaultResource, ClassLoader classLoader) { this.defaultResource = defaultResource; this.classLoader = classLoader; } @Override public Reader loadDefaultResource() { return loadResource(defaultResource); } @Override public Reader loadResource(String relativePath) { LOG.info("Loading resource. RelativePath = {}.", relativePath); InputStream is = this.classLoader.getResourceAsStream(relativePath); return is != null ? new InputStreamReader(is) : null; } @Override public String getName() { return "classpath resource"; } } ================================================ FILE: broker/src/main/java/io/moquette/server/config/ConfigurationParser.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.io.Reader; import java.text.ParseException; import java.util.Properties; /** * Mosquitto configuration parser. * * A line that at the very first has # is a comment Each line has key value format, where the * separator used it the space. */ class ConfigurationParser { private static final Logger LOG = LoggerFactory.getLogger(ConfigurationParser.class); private Properties m_properties = new Properties(); /** * Parse the configuration from file. */ void parse(File file) throws ParseException { if (file == null) { LOG.warn("parsing NULL file, so fallback on default configuration!"); return; } if (!file.exists()) { LOG.warn( String.format( "parsing not existing file %s, so fallback on default configuration!", file.getAbsolutePath())); return; } try { FileReader reader = new FileReader(file); parse(reader); } catch (FileNotFoundException fex) { LOG.warn( String.format( "parsing not existing file %s, so fallback on default configuration!", file.getAbsolutePath()), fex); return; } } /** * Parse the configuration * * @throws ParseException * if the format is not compliant. */ void parse(Reader reader) throws ParseException { if (reader == null) { // just log and return default properties LOG.warn("parsing NULL reader, so fallback on default configuration!"); return; } BufferedReader br = new BufferedReader(reader); String line; try { while ((line = br.readLine()) != null) { line = line.trim(); int commentMarker = line.indexOf('#'); if (commentMarker != -1) { if (commentMarker == 0) { // skip its a comment continue; } else { String[] ss = line.split(" "); if(ss.length != 2) { throw new ParseException(line, commentMarker); } } } else { if (line.isEmpty() || line.matches("^\\s*$")) { // skip it's a black line continue; } } // split till the first space int delimiterIdx = line.indexOf(' '); String key; String value = ""; if (delimiterIdx > 0) { key = line.substring(0, delimiterIdx).trim(); value = line.substring(delimiterIdx).trim(); } else { key = line.trim(); } m_properties.put(key, value); } } catch (IOException ex) { throw new ParseException("Failed to read", 1); } finally { try { reader.close(); } catch (IOException e) { // ignore } } } Properties getProperties() { return m_properties; } } ================================================ FILE: broker/src/main/java/io/moquette/server/config/FileResourceLoader.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.config; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.Reader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class FileResourceLoader implements IResourceLoader { private static final Logger LOG = LoggerFactory.getLogger(FileResourceLoader.class); private final File defaultFile; private final String parentPath; public FileResourceLoader() { this((File) null); } public FileResourceLoader(File defaultFile) { this(defaultFile, System.getProperty("wildfirechat.path", null)); } public FileResourceLoader(String parentPath) { this(null, parentPath); } public FileResourceLoader(File defaultFile, String parentPath) { this.defaultFile = defaultFile; this.parentPath = parentPath; } @Override public Reader loadDefaultResource() { if (defaultFile != null) { return loadResource(defaultFile); } else { throw new IllegalArgumentException("Default file not set!"); } } @Override public Reader loadResource(String relativePath) { return loadResource(new File(parentPath, relativePath)); } public Reader loadResource(File f) { LOG.info("Loading file. Path = {}.", f.getAbsolutePath()); if (f.isDirectory()) { LOG.error("The given file is a directory. Path = {}.", f.getAbsolutePath()); throw new ResourceIsDirectoryException("File \"" + f + "\" is a directory!"); } try { return new FileReader(f); } catch (FileNotFoundException e) { LOG.error("The file does not exist. Path = {}.", f.getAbsolutePath()); return null; } } @Override public String getName() { return "file"; } } ================================================ FILE: broker/src/main/java/io/moquette/server/config/IConfig.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.config; import io.moquette.BrokerConstants; /** * Base interface for all configuration implementations (filesystem, memory or classpath) */ public abstract class IConfig { public static final String DEFAULT_CONFIG = "config/wildfirechat.conf"; public static final String LICENSE_PATH = "config/wildfirechat.license"; public abstract void setProperty(String name, String value); public abstract String getProperty(String name); public abstract String getProperty(String name, String defaultValue); void assignDefaults() { setProperty(BrokerConstants.PORT_PROPERTY_NAME, Integer.toString(BrokerConstants.PORT)); setProperty(BrokerConstants.HOST_PROPERTY_NAME, BrokerConstants.HOST); setProperty(BrokerConstants.AUTHORIZATOR_CLASS_NAME, ""); } public abstract IResourceLoader getResourceLoader(); } ================================================ FILE: broker/src/main/java/io/moquette/server/config/IResourceLoader.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.config; import java.io.Reader; public interface IResourceLoader { Reader loadDefaultResource(); Reader loadResource(String relativePath); String getName(); class ResourceIsDirectoryException extends RuntimeException { private static final long serialVersionUID = -6969292229582764176L; public ResourceIsDirectoryException(String message) { super(message); } } } ================================================ FILE: broker/src/main/java/io/moquette/server/config/MediaServerConfig.java ================================================ package io.moquette.server.config; public class MediaServerConfig { public static String QINIU_SERVER_URL = "up.qbox.me"; public static String QINIU_ACCESS_KEY = "tU3vdBK5BL5j4N7jI5N5uZgq_HQDo170w5C9Amnn"; public static String QINIU_SECRET_KEY = "YfQIJdgp5YGhwEw14vGpaD2HJZsuJldWtqens7i5"; public static String QINIU_BUCKET_GENERAL_NAME; public static String QINIU_BUCKET_GENERAL_DOMAIN; public static String QINIU_BUCKET_IMAGE_NAME; public static String QINIU_BUCKET_IMAGE_DOMAIN; public static String QINIU_BUCKET_VOICE_NAME; public static String QINIU_BUCKET_VOICE_DOMAIN; public static String QINIU_BUCKET_VIDEO_NAME; public static String QINIU_BUCKET_VIDEO_DOMAIN; public static String QINIU_BUCKET_FILE_NAME; public static String QINIU_BUCKET_FILE_DOMAIN; public static String QINIU_BUCKET_STICKER_NAME; public static String QINIU_BUCKET_STICKER_DOMAIN; public static String QINIU_BUCKET_MOMENTS_NAME; public static String QINIU_BUCKET_MOMENTS_DOMAIN; public static String QINIU_BUCKET_PORTRAIT_NAME; public static String QINIU_BUCKET_PORTRAIT_DOMAIN; public static String QINIU_BUCKET_FAVORITE_NAME; public static String QINIU_BUCKET_FAVORITE_DOMAIN; public static String QINIU_BUCKET_CUSTOM1_NAME; public static String QINIU_BUCKET_CUSTOM1_DOMAIN; public static String QINIU_BUCKET_CUSTOM2_NAME; public static String QINIU_BUCKET_CUSTOM2_DOMAIN; public static String QINIU_BUCKET_CUSTOM3_NAME; public static String QINIU_BUCKET_CUSTOM3_DOMAIN; public static String QINIU_BUCKET_PAN_NAME; public static String QINIU_BUCKET_PAN_DOMAIN; public static String SERVER_IP = "localhost"; public static int HTTP_SERVER_PORT = 8080; public static String FILE_STROAGE_ROOT = "fs"; public static String FILE_STROAGE_REMOTE_SERVER_URL; public static boolean USER_QINIU = false; } ================================================ FILE: broker/src/main/java/io/moquette/server/config/MemoryConfig.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.config; import java.util.Map; import java.util.Properties; /** * Configuration backed by memory. */ public class MemoryConfig extends IConfig { private final Properties m_properties = new Properties(); public MemoryConfig(Properties properties) { assignDefaults(); for (Map.Entry entrySet : properties.entrySet()) { m_properties.put(entrySet.getKey(), entrySet.getValue()); } } @Override public void setProperty(String name, String value) { m_properties.setProperty(name, value); } @Override public String getProperty(String name) { return m_properties.getProperty(name); } @Override public String getProperty(String name, String defaultValue) { return m_properties.getProperty(name, defaultValue); } @Override public IResourceLoader getResourceLoader() { return new FileResourceLoader(); } } ================================================ FILE: broker/src/main/java/io/moquette/server/config/ResourceLoaderConfig.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.Reader; import java.text.ParseException; import java.util.Properties; /** * Configuration that loads config stream from a {@link IResourceLoader} instance. */ public class ResourceLoaderConfig extends IConfig { private static final Logger LOG = LoggerFactory.getLogger(ResourceLoaderConfig.class); private final Properties m_properties; private final IResourceLoader resourceLoader; public ResourceLoaderConfig(IResourceLoader resourceLoader) { this(resourceLoader, null); } public ResourceLoaderConfig(IResourceLoader resourceLoader, String configName) { LOG.info("Loading configuration. ResourceLoader = {}, configName = {}.", resourceLoader.getName(), configName); this.resourceLoader = resourceLoader; /* * If we use a conditional operator, the loadResource() and the loadDefaultResource() * methods will be always called. This makes the log traces confusing. */ Reader configReader; if (configName != null) { configReader = resourceLoader.loadResource(configName); } else { configReader = resourceLoader.loadDefaultResource(); } if (configReader == null) { LOG.error( "The resource loader returned no configuration reader. ResourceLoader = {}, configName = {}.", resourceLoader.getName(), configName); throw new IllegalArgumentException("Can't locate " + resourceLoader.getName() + " \"" + configName + "\""); } LOG.info( "Parsing configuration properties. ResourceLoader = {}, configName = {}.", resourceLoader.getName(), configName); ConfigurationParser confParser = new ConfigurationParser(); m_properties = confParser.getProperties(); assignDefaults(); try { confParser.parse(configReader); } catch (ParseException pex) { LOG.warn( "Unable to parse configuration properties. Using default configuration. " + "ResourceLoader = {}, configName = {}, cause = {}, errorMessage = {}.", resourceLoader.getName(), configName, pex.getCause(), pex.getMessage()); } } @Override public void setProperty(String name, String value) { m_properties.setProperty(name, value); } @Override public String getProperty(String name) { return m_properties.getProperty(name); } @Override public String getProperty(String name, String defaultValue) { return m_properties.getProperty(name, defaultValue); } @Override public IResourceLoader getResourceLoader() { return resourceLoader; } } ================================================ FILE: broker/src/main/java/io/moquette/server/netty/AutoFlushHandler.java ================================================ /* * Copyright (c) 2012-2016 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.netty; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.util.concurrent.EventExecutor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; /** * Auto-flush data on channel after a read timeout. It's inspired by IdleStateHandler but it's * specialized version, just flushing data after no read is done on the channel after a period. It's * used to avoid aggressively flushing from the ProtocolProcessor. */ public class AutoFlushHandler extends ChannelDuplexHandler { private static final Logger LOG = LoggerFactory.getLogger(AutoFlushHandler.class); private static final long MIN_TIMEOUT_NANOS = TimeUnit.MILLISECONDS.toNanos(1); private final long writerIdleTimeNanos; volatile ScheduledFuture writerIdleTimeout; volatile long lastWriteTime; // private boolean firstWriterIdleEvent = true; private volatile int state; // 0 - none, 1 - initialized, 2 - destroyed public AutoFlushHandler(long writerIdleTime, TimeUnit unit) { if (unit == null) { throw new NullPointerException("unit"); } writerIdleTimeNanos = Math.max(unit.toNanos(writerIdleTime), MIN_TIMEOUT_NANOS); } @Override public void handlerAdded(ChannelHandlerContext ctx) throws Exception { if (ctx.channel().isActive() && ctx.channel().isRegistered()) { // channelActive() event has been fired already, which means this.channelActive() will // not be invoked. We have to initialize here instead. initialize(ctx); } else { // channelActive() event has not been fired yet. this.channelActive() will be invoked // and initialization will occur there. } } @Override public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { destroy(); } @Override public void channelRegistered(ChannelHandlerContext ctx) throws Exception { // Initialize early if channel is active already. if (ctx.channel().isActive()) { initialize(ctx); } super.channelRegistered(ctx); } @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { // This method will be invoked only if this handler was added // before channelActive() event is fired. If a user adds this handler // after the channelActive() event, initialize() will be called by beforeAdd(). initialize(ctx); super.channelActive(ctx); } @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { destroy(); super.channelInactive(ctx); } // @Override // public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { // if (writerrIdleTimeNanos > 0) { // reading = true; // firstReaderIdleEvent = true; // } // ctx.fireChannelRead(msg); // } // // @Override // public void channelReadComplete(ChannelHandlerContext ctx) throws Exception { // if (writerrIdleTimeNanos > 0) { // lastReadTime = System.nanoTime(); // reading = false; // } // ctx.fireChannelReadComplete(); // } private void initialize(ChannelHandlerContext ctx) { // Avoid the case where destroy() is called before scheduling timeouts. // See: https://github.com/netty/netty/issues/143 if (LOG.isDebugEnabled()) { LOG.debug("Initializing autoflush handler. MqttClientId = {}.", NettyUtils.clientID(ctx.channel())); } switch (state) { case 1: case 2: return; } state = 1; EventExecutor loop = ctx.executor(); lastWriteTime = System.nanoTime(); writerIdleTimeout = loop.schedule(new WriterIdleTimeoutTask(ctx), writerIdleTimeNanos, TimeUnit.NANOSECONDS); } private void destroy() { state = 2; if (writerIdleTimeout != null) { writerIdleTimeout.cancel(false); writerIdleTimeout = null; } } /** * Is called when the write timeout expire. * * @param ctx * the channel context. * @throws Exception * in case of any IO error. */ protected void channelIdle(ChannelHandlerContext ctx/* , IdleStateEvent evt */) throws Exception { // ctx.fireUserEventTriggered(evt); if (LOG.isDebugEnabled()) { LOG.debug("Flushing idle Netty channel. MqttClientId = {}.", NettyUtils.clientID(ctx.channel())); } ctx.channel().flush(); } private final class WriterIdleTimeoutTask implements Runnable { private final ChannelHandlerContext ctx; WriterIdleTimeoutTask(ChannelHandlerContext ctx) { this.ctx = ctx; } @Override public void run() { if (!ctx.channel().isOpen()) { return; } // long lastWriteTime = IdleStateHandler.this.lastWriteTime; // long lastWriteTime = lastWriteTime; long nextDelay = writerIdleTimeNanos - (System.nanoTime() - lastWriteTime); if (nextDelay <= 0) { // Writer is idle - set a new timeout and notify the callback. writerIdleTimeout = ctx.executor().schedule(this, writerIdleTimeNanos, TimeUnit.NANOSECONDS); try { /* * IdleStateEvent event; if (firstWriterIdleEvent) { firstWriterIdleEvent = * false; event = IdleStateEvent.FIRST_WRITER_IDLE_STATE_EVENT; } else { event = * IdleStateEvent.WRITER_IDLE_STATE_EVENT; } */ channelIdle(ctx/* , event */); } catch (Throwable t) { ctx.fireExceptionCaught(t); } } else { // Write occurred before the timeout - set a new timeout with shorter delay. writerIdleTimeout = ctx.executor().schedule(this, nextDelay, TimeUnit.NANOSECONDS); } } } } ================================================ FILE: broker/src/main/java/io/moquette/server/netty/MoquetteIdleTimeoutHandler.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.netty; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.timeout.IdleState; import io.netty.handler.timeout.IdleStateEvent; @Sharable class MoquetteIdleTimeoutHandler extends ChannelDuplexHandler { private static final Logger LOG = LoggerFactory.getLogger(MoquetteIdleTimeoutHandler.class); @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof IdleStateEvent) { IdleState e = ((IdleStateEvent) evt).state(); if (e == IdleState.READER_IDLE) { LOG.info("Firing channel inactive event. MqttClientId = {}.", NettyUtils.clientID(ctx.channel())); // fire a channelInactive to trigger publish of Will ctx.fireChannelInactive(); ctx.close(); } } else { if (LOG.isDebugEnabled()) { LOG.debug( "Firing Netty event. MqttClientId = {}, eventClass = {}.", NettyUtils.clientID(ctx.channel()), evt.getClass().getName()); } super.userEventTriggered(ctx, evt); } } } ================================================ FILE: broker/src/main/java/io/moquette/server/netty/NettyAcceptor.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.netty; import io.moquette.BrokerConstants; import io.moquette.server.ServerAcceptor; import io.moquette.server.config.IConfig; import io.moquette.server.netty.metrics.*; import io.moquette.spi.impl.ProtocolProcessor; import io.moquette.spi.security.ISslContextCreator; import io.netty.bootstrap.ServerBootstrap; import io.netty.buffer.ByteBuf; import io.netty.channel.*; import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.epoll.EpollServerSocketChannel; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.ServerSocketChannel; import io.netty.channel.socket.SocketChannel; import io.netty.channel.socket.nio.NioServerSocketChannel; import io.netty.handler.codec.MessageToMessageDecoder; import io.netty.handler.codec.MessageToMessageEncoder; import io.netty.handler.codec.http.HttpObjectAggregator; import io.netty.handler.codec.http.HttpRequestDecoder; import io.netty.handler.codec.http.HttpResponseEncoder; import io.netty.handler.codec.http.HttpServerCodec; import io.netty.handler.codec.http.websocketx.BinaryWebSocketFrame; import io.netty.handler.codec.http.websocketx.WebSocketServerProtocolHandler; import io.netty.handler.codec.mqtt.MqttDecoder; import io.netty.handler.codec.mqtt.MqttEncoder; import io.netty.handler.ssl.SslHandler; import io.netty.handler.timeout.IdleStateHandler; import io.netty.util.concurrent.Future; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLEngine; import java.io.IOException; import java.net.BindException; import java.util.List; import java.util.Optional; import java.util.concurrent.TimeUnit; import static io.moquette.BrokerConstants.*; import static io.netty.channel.ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE; public class NettyAcceptor implements ServerAcceptor { abstract class PipelineInitializer { abstract void init(ChannelPipeline pipeline) throws Exception; } private static final Logger LOG = LoggerFactory.getLogger(NettyAcceptor.class); EventLoopGroup m_bossGroup; EventLoopGroup m_workerGroup; BytesMetricsCollector m_bytesMetricsCollector = new BytesMetricsCollector(); MessageMetricsCollector m_metricsCollector = new MessageMetricsCollector(); private Optional metrics; private Optional errorsCather; private int nettySoBacklog; private boolean nettySoReuseaddr; private boolean nettyTcpNodelay; private boolean nettySoKeepalive; private int nettyChannelTimeoutSeconds; private Class channelClass; @Override public void initialize(ProtocolProcessor processor, IConfig props, ISslContextCreator sslCtxCreator) throws IOException { LOG.info("Initializing Netty acceptor..."); nettySoBacklog = Integer.parseInt(props.getProperty(BrokerConstants.NETTY_SO_BACKLOG_PROPERTY_NAME, "128")); nettySoReuseaddr = Boolean .parseBoolean(props.getProperty(BrokerConstants.NETTY_SO_REUSEADDR_PROPERTY_NAME, "true")); nettyTcpNodelay = Boolean .parseBoolean(props.getProperty(BrokerConstants.NETTY_TCP_NODELAY_PROPERTY_NAME, "true")); nettySoKeepalive = Boolean .parseBoolean(props.getProperty(BrokerConstants.NETTY_SO_KEEPALIVE_PROPERTY_NAME, "true")); nettyChannelTimeoutSeconds = Integer .parseInt(props.getProperty(BrokerConstants.NETTY_CHANNEL_TIMEOUT_SECONDS_PROPERTY_NAME, "10")); boolean epoll = Boolean.parseBoolean(props.getProperty(BrokerConstants.NETTY_EPOLL_PROPERTY_NAME, "false")); if (epoll) { // 由于目前只支持TCP MQTT, 所以bossGroup的线程数配置为1 LOG.info("Netty is using Epoll"); m_bossGroup = new EpollEventLoopGroup(1); m_workerGroup = new EpollEventLoopGroup(); channelClass = EpollServerSocketChannel.class; } else { LOG.info("Netty is using NIO"); m_bossGroup = new NioEventLoopGroup(1); m_workerGroup = new NioEventLoopGroup(); channelClass = NioServerSocketChannel.class; } final NettyMQTTHandler mqttHandler = new NettyMQTTHandler(processor); this.metrics = Optional.empty(); this.errorsCather = Optional.empty(); initializePlainTCPTransport(mqttHandler, props); } private void initFactory(String host, int port, String protocol, final PipelineInitializer pipeliner) { LOG.info("Initializing server. Protocol={}", protocol); ServerBootstrap b = new ServerBootstrap(); b.group(m_bossGroup, m_workerGroup).channel(channelClass) .childHandler(new ChannelInitializer() { @Override public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); try { pipeliner.init(pipeline); } catch (Throwable th) { LOG.error("Severe error during pipeline creation", th); throw th; } } }) .option(ChannelOption.SO_BACKLOG, nettySoBacklog) .option(ChannelOption.SO_REUSEADDR, nettySoReuseaddr) .childOption(ChannelOption.TCP_NODELAY, nettyTcpNodelay) .childOption(ChannelOption.SO_KEEPALIVE, nettySoKeepalive); try { LOG.info("Binding server. host={}, port={}", host, port); // Bind and start to accept incoming connections. ChannelFuture f = b.bind(host, port); LOG.info("Server has been bound. host={}, port={}", host, port); f.sync().addListener(FIRE_EXCEPTION_ON_FAILURE); } catch (InterruptedException ex) { LOG.error("An interruptedException was caught while initializing server. Protocol={}", protocol, ex); } catch (Exception e) { e.printStackTrace(); LOG.error("端口 {} 已经被占用或者无权限使用。如果无权限使用,请以root权限运行;如果被占用,请检查该端口被那个程序占用,找到程序停掉。\n查找端口被那个程序占用的命令是: netstat -tunlp | grep {}", port, port); System.out.println("端口 " + port + " 已经被占用或者无权限使用。如果无权限使用,请以root权限运行;如果被占用,请检查该端口被那个程序占用,找到程序停掉。\n查找端口被那个程序占用的命令是: netstat -tunlp | grep " + port); System.exit(-1); } } private void initializePlainTCPTransport(final NettyMQTTHandler handler, IConfig props) throws IOException { LOG.info("Configuring TCP MQTT transport"); final MoquetteIdleTimeoutHandler timeoutHandler = new MoquetteIdleTimeoutHandler(); String host = props.getProperty(BrokerConstants.HOST_PROPERTY_NAME, "0.0.0.0"); String tcpPortProp = props.getProperty(PORT_PROPERTY_NAME, DISABLED_PORT_BIND); if (DISABLED_PORT_BIND.equals(tcpPortProp)) { LOG.info("Property {} has been set to {}. TCP MQTT will be disabled", BrokerConstants.PORT_PROPERTY_NAME, DISABLED_PORT_BIND); return; } int port = Integer.parseInt(tcpPortProp); initFactory(host, port, "TCP MQTT", new PipelineInitializer() { @Override void init(ChannelPipeline pipeline) { pipeline.addFirst("idleStateHandler", new IdleStateHandler(nettyChannelTimeoutSeconds, 0, 0)); pipeline.addAfter("idleStateHandler", "idleEventHandler", timeoutHandler); // pipeline.addLast("logger", new LoggingHandler("Netty", LogLevel.ERROR)); if (errorsCather.isPresent()) { pipeline.addLast("bugsnagCatcher", errorsCather.get()); } pipeline.addFirst("bytemetrics", new BytesMetricsHandler(m_bytesMetricsCollector)); pipeline.addLast("decoder", new MqttDecoder()); pipeline.addLast("encoder", MqttEncoder.INSTANCE); pipeline.addLast("metrics", new MessageMetricsHandler(m_metricsCollector)); pipeline.addLast("messageLogger", new MQTTMessageLogger()); if (metrics.isPresent()) { pipeline.addLast("wizardMetrics", metrics.get()); } pipeline.addLast("handler", handler); } }); } public void close() { LOG.info("Closing Netty acceptor..."); if (m_workerGroup == null || m_bossGroup == null) { LOG.error("Netty acceptor is not initialized"); throw new IllegalStateException("Invoked close on an Acceptor that wasn't initialized"); } Future workerWaiter = m_workerGroup.shutdownGracefully(); Future bossWaiter = m_bossGroup.shutdownGracefully(); /* * We shouldn't raise an IllegalStateException if we are interrupted. If we did so, the * broker is not shut down properly. */ LOG.info("Waiting for worker and boss event loop groups to terminate..."); try { workerWaiter.await(10, TimeUnit.SECONDS); bossWaiter.await(10, TimeUnit.SECONDS); } catch (InterruptedException iex) { LOG.warn("An InterruptedException was caught while waiting for event loops to terminate..."); } if (!m_workerGroup.isTerminated()) { LOG.warn("Forcing shutdown of worker event loop..."); m_workerGroup.shutdownGracefully(0L, 0L, TimeUnit.MILLISECONDS); } if (!m_bossGroup.isTerminated()) { LOG.warn("Forcing shutdown of boss event loop..."); m_bossGroup.shutdownGracefully(0L, 0L, TimeUnit.MILLISECONDS); } LOG.info("Collecting message metrics..."); MessageMetrics metrics = m_metricsCollector.computeMetrics(); LOG.info("Metrics have been collected. Read messages={}, written messages={}", metrics.messagesRead(), metrics.messagesWrote()); LOG.info("Collecting bytes metrics..."); BytesMetrics bytesMetrics = m_bytesMetricsCollector.computeMetrics(); LOG.info("Bytes metrics have been collected. Read bytes={}, written bytes={}", bytesMetrics.readBytes(), bytesMetrics.wroteBytes()); } private ChannelHandler createSslHandler(SSLContext sslContext, boolean needsClientAuth) { SSLEngine sslEngine = sslContext.createSSLEngine(); sslEngine.setUseClientMode(false); if (needsClientAuth) { sslEngine.setNeedClientAuth(true); } return new SslHandler(sslEngine); } } ================================================ FILE: broker/src/main/java/io/moquette/server/netty/NettyMQTTHandler.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.netty; import io.moquette.spi.impl.ProtocolProcessor; import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.handler.codec.mqtt.*; import io.netty.util.ReferenceCountUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static io.netty.handler.codec.mqtt.MqttQoS.AT_MOST_ONCE; @Sharable public class NettyMQTTHandler extends ChannelInboundHandlerAdapter { private static final Logger LOG = LoggerFactory.getLogger(NettyMQTTHandler.class); private final ProtocolProcessor m_processor; public NettyMQTTHandler(ProtocolProcessor processor) { m_processor = processor; } @Override public void channelRead(ChannelHandlerContext ctx, Object message) { try { if (!(message instanceof MqttMessage)) { LOG.error("Unknown mqtt message type {}, {}", message.getClass().getName(), message); return; } MqttMessage msg = (MqttMessage) message; MqttMessageType messageType = msg.fixedHeader().messageType(); LOG.info("Processing MQTT message, type={}", messageType); switch (messageType) { case CONNECT: m_processor.processConnect(ctx.channel(), (MqttConnectMessage) msg); break; case SUBSCRIBE: m_processor.processSubscribe(ctx.channel(), (MqttSubscribeMessage) msg); break; case UNSUBSCRIBE: m_processor.processUnsubscribe(ctx.channel(), (MqttUnsubscribeMessage) msg); break; case PUBLISH: m_processor.processPublish(ctx.channel(), (MqttPublishMessage) msg); break; case PUBREC: m_processor.processPubRec(ctx.channel(), msg); break; case PUBCOMP: m_processor.processPubComp(ctx.channel(), msg); break; case PUBREL: m_processor.processPubRel(ctx.channel(), msg); break; case DISCONNECT: m_processor.processDisconnect(ctx.channel(), msg.fixedHeader().isDup(), msg.fixedHeader().isRetain()); break; case PUBACK: m_processor.processPubAck(ctx.channel(), (MqttPubAckMessage) msg); break; case PINGREQ: MqttFixedHeader pingHeader = new MqttFixedHeader( MqttMessageType.PINGRESP, false, AT_MOST_ONCE, false, 0); MqttMessage pingResp = new MqttMessage(pingHeader); ctx.writeAndFlush(pingResp); break; default: LOG.error("Unkonwn MessageType:{}", messageType); break; } } catch (Throwable ex) { LOG.error("Exception was caught while processing MQTT message, " + ex.getCause(), ex); ctx.fireExceptionCaught(ex); ctx.close(); } finally { ReferenceCountUtil.release(message); } } @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { String clientID = NettyUtils.clientID(ctx.channel()); if (clientID != null && !clientID.isEmpty()) { LOG.info("Notifying connection lost event. MqttClientId = {}.", clientID); m_processor.processConnectionLost(clientID, ctx.channel(), false); } ctx.close(); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { LOG.error("An unexpected exception was caught while processing MQTT message. Closing Netty channel. CId={}, " + "cause={}, errorMessage={}", NettyUtils.clientID(ctx.channel()), cause.getCause(), cause.getMessage()); for (StackTraceElement ste : cause.getStackTrace()) { LOG.error(ste.toString()); } ctx.close(); } @Override public void channelWritabilityChanged(ChannelHandlerContext ctx) throws Exception { if (ctx.channel().isWritable()) { m_processor.notifyChannelWritable(ctx.channel()); } ctx.fireChannelWritabilityChanged(); } } ================================================ FILE: broker/src/main/java/io/moquette/server/netty/NettyUtils.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.netty; import io.moquette.server.Constants; import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.util.Attribute; import io.netty.util.AttributeKey; /** * Some Netty's channels utilities. */ public final class NettyUtils { public static final String ATTR_USERNAME = "username"; public static final String ATTR_SESSION_STOLEN = "sessionStolen"; public static final String ATTR_CHANNEL_STATUS = "channelStatus"; private static final AttributeKey ATTR_KEY_KEEPALIVE = AttributeKey.valueOf(Constants.KEEP_ALIVE); private static final AttributeKey ATTR_KEY_CLEANSESSION = AttributeKey.valueOf(Constants.CLEAN_SESSION); private static final AttributeKey ATTR_KEY_CLIENTID = AttributeKey.valueOf(Constants.ATTR_CLIENTID); private static final AttributeKey ATTR_KEY_USERNAME = AttributeKey.valueOf(ATTR_USERNAME); public static Object getAttribute(ChannelHandlerContext ctx, AttributeKey key) { Attribute attr = ctx.channel().attr(key); return attr.get(); } public static void keepAlive(Channel channel, int keepAlive) { channel.attr(NettyUtils.ATTR_KEY_KEEPALIVE).set(keepAlive); } public static void cleanSession(Channel channel, boolean cleanSession) { channel.attr(NettyUtils.ATTR_KEY_CLEANSESSION).set(cleanSession); } public static boolean cleanSession(Channel channel) { return (Boolean) channel.attr(NettyUtils.ATTR_KEY_CLEANSESSION).get(); } public static void clientID(Channel channel, String clientID) { channel.attr(NettyUtils.ATTR_KEY_CLIENTID).set(clientID); } public static String clientID(Channel channel) { return (String) channel.attr(NettyUtils.ATTR_KEY_CLIENTID).get(); } public static void userName(Channel channel, String username) { channel.attr(NettyUtils.ATTR_KEY_USERNAME).set(username); } public static String userName(Channel channel) { return (String) channel.attr(NettyUtils.ATTR_KEY_USERNAME).get(); } private NettyUtils() { } } ================================================ FILE: broker/src/main/java/io/moquette/server/netty/metrics/BytesMetrics.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.netty.metrics; public class BytesMetrics { private long m_readBytes; private long m_wroteBytes; void incrementRead(long numBytes) { m_readBytes += numBytes; } void incrementWrote(long numBytes) { m_wroteBytes += numBytes; } public long readBytes() { return m_readBytes; } public long wroteBytes() { return m_wroteBytes; } } ================================================ FILE: broker/src/main/java/io/moquette/server/netty/metrics/BytesMetricsCollector.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.netty.metrics; import java.util.concurrent.atomic.AtomicLong; /** * Collects all the metrics from the various pipeline. */ public class BytesMetricsCollector { private AtomicLong readBytes = new AtomicLong(); private AtomicLong wroteBytes = new AtomicLong(); public BytesMetrics computeMetrics() { BytesMetrics allMetrics = new BytesMetrics(); allMetrics.incrementRead(readBytes.get()); allMetrics.incrementWrote(wroteBytes.get()); return allMetrics; } public void sumReadBytes(long count) { readBytes.getAndAdd(count); } public void sumWroteBytes(long count) { wroteBytes.getAndAdd(count); } } ================================================ FILE: broker/src/main/java/io/moquette/server/netty/metrics/BytesMetricsHandler.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.netty.metrics; import io.moquette.server.netty.NettyUtils; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; import io.netty.util.Attribute; import io.netty.util.AttributeKey; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static io.moquette.server.netty.NettyUtils.ATTR_USERNAME; public class BytesMetricsHandler extends ChannelDuplexHandler { private static final Logger LOG = LoggerFactory.getLogger(BytesMetricsHandler.class); private static final AttributeKey ATTR_KEY_METRICS = AttributeKey.valueOf("BytesMetrics"); private static final AttributeKey ATTR_KEY_USERNAME = AttributeKey.valueOf(ATTR_USERNAME); private BytesMetricsCollector m_collector; public BytesMetricsHandler(BytesMetricsCollector collector) { m_collector = collector; } @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { Attribute attr = ctx.channel().attr(ATTR_KEY_METRICS); attr.set(new BytesMetrics()); super.channelActive(ctx); } @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { BytesMetrics metrics = ctx.channel().attr(ATTR_KEY_METRICS).get(); metrics.incrementRead(((ByteBuf) msg).readableBytes()); ctx.fireChannelRead(msg); } @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { BytesMetrics metrics = ctx.channel().attr(ATTR_KEY_METRICS).get(); metrics.incrementWrote(((ByteBuf) msg).writableBytes()); ctx.write(msg, promise); } @Override public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception { BytesMetrics metrics = ctx.channel().attr(ATTR_KEY_METRICS).get(); String userId = ctx.channel().attr(ATTR_KEY_USERNAME).get(); if (userId == null) { userId = ""; } LOG.info("channel<{}> closing after read {} bytes and wrote {} bytes", userId, metrics.readBytes(), metrics.wroteBytes()); m_collector.sumReadBytes(metrics.readBytes()); m_collector.sumWroteBytes(metrics.wroteBytes()); super.close(ctx, promise); } public static BytesMetrics getBytesMetrics(Channel channel) { return channel.attr(ATTR_KEY_METRICS).get(); } } ================================================ FILE: broker/src/main/java/io/moquette/server/netty/metrics/MQTTMessageLogger.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.netty.metrics; import io.moquette.server.netty.NettyUtils; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; import io.netty.handler.codec.mqtt.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; import static io.moquette.spi.impl.Utils.messageId; /** * * @author andrea */ @Sharable public class MQTTMessageLogger extends ChannelDuplexHandler { private static final Logger LOG = LoggerFactory.getLogger("messageLogger"); @Override public void channelRead(ChannelHandlerContext ctx, Object message) { logMQTTMessage(ctx, message, "C->B"); ctx.fireChannelRead(message); } private void logMQTTMessage(ChannelHandlerContext ctx, Object message, String direction) { if (!(message instanceof MqttMessage)) { return; } MqttMessage msg = (MqttMessage) message; String clientID = NettyUtils.clientID(ctx.channel()); MqttMessageType messageType = msg.fixedHeader().messageType(); switch (messageType) { case CONNECT: case CONNACK: case PINGREQ: case PINGRESP: case DISCONNECT: LOG.info("{} {} <{}>", direction, messageType, clientID); break; case SUBSCRIBE: MqttSubscribeMessage subscribe = (MqttSubscribeMessage) msg; LOG.info("{} SUBSCRIBE <{}> to topics {}", direction, clientID, subscribe.payload().topicSubscriptions()); break; case UNSUBSCRIBE: MqttUnsubscribeMessage unsubscribe = (MqttUnsubscribeMessage) msg; LOG.info("{} UNSUBSCRIBE <{}> to topics <{}>", direction, clientID, unsubscribe.payload().topics()); break; case PUBLISH: MqttPublishMessage publish = (MqttPublishMessage) msg; LOG.info("{} PUBLISH <{}> to topics <{}>", direction, clientID, publish.variableHeader().topicName()); break; case PUBREC: case PUBCOMP: case PUBREL: case PUBACK: case UNSUBACK: LOG.info("{} {} <{}> packetID <{}>", direction, messageType, clientID, messageId(msg)); break; case SUBACK: MqttSubAckMessage suback = (MqttSubAckMessage) msg; final List grantedQoSLevels = suback.payload().grantedQoSLevels(); LOG.info("{} SUBACK <{}> packetID <{}>, grantedQoses {}", direction, clientID, messageId(msg), grantedQoSLevels); break; } } @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { String clientID = NettyUtils.clientID(ctx.channel()); if (clientID != null && !clientID.isEmpty()) { LOG.info("Channel closed <{}>", clientID); } ctx.fireChannelInactive(); } @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { logMQTTMessage(ctx, msg, "C<-B"); ctx.write(msg, promise); } } ================================================ FILE: broker/src/main/java/io/moquette/server/netty/metrics/MessageMetrics.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.netty.metrics; public class MessageMetrics { private long m_messagesRead; private long m_messageWrote; void incrementRead(long numMessages) { m_messagesRead += numMessages; } void incrementWrote(long numMessages) { m_messageWrote += numMessages; } public long messagesRead() { return m_messagesRead; } public long messagesWrote() { return m_messageWrote; } } ================================================ FILE: broker/src/main/java/io/moquette/server/netty/metrics/MessageMetricsCollector.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.netty.metrics; import java.util.concurrent.atomic.AtomicLong; /** * Collects all the metrics from the various pipeline. */ public class MessageMetricsCollector { private AtomicLong readMsgs = new AtomicLong(); private AtomicLong wroteMsgs = new AtomicLong(); public MessageMetrics computeMetrics() { MessageMetrics allMetrics = new MessageMetrics(); allMetrics.incrementRead(readMsgs.get()); allMetrics.incrementWrote(wroteMsgs.get()); return allMetrics; } public void sumReadMessages(long count) { readMsgs.getAndAdd(count); } public void sumWroteMessages(long count) { wroteMsgs.getAndAdd(count); } } ================================================ FILE: broker/src/main/java/io/moquette/server/netty/metrics/MessageMetricsHandler.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.server.netty.metrics; import io.netty.channel.Channel; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelPromise; import io.netty.util.Attribute; import io.netty.util.AttributeKey; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static io.moquette.server.netty.NettyUtils.ATTR_USERNAME; public class MessageMetricsHandler extends ChannelDuplexHandler { private static final Logger LOG = LoggerFactory.getLogger(MessageMetricsHandler.class); private static final AttributeKey ATTR_KEY_METRICS = AttributeKey.valueOf("MessageMetrics"); private static final AttributeKey ATTR_KEY_USERNAME = AttributeKey.valueOf(ATTR_USERNAME); private MessageMetricsCollector m_collector; public MessageMetricsHandler(MessageMetricsCollector collector) { m_collector = collector; } @Override public void channelActive(ChannelHandlerContext ctx) throws Exception { Attribute attr = ctx.channel().attr(ATTR_KEY_METRICS); attr.set(new MessageMetrics()); super.channelActive(ctx); } @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { MessageMetrics metrics = ctx.channel().attr(ATTR_KEY_METRICS).get(); metrics.incrementRead(1); ctx.fireChannelRead(msg); } @Override public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception { MessageMetrics metrics = ctx.channel().attr(ATTR_KEY_METRICS).get(); metrics.incrementWrote(1); ctx.write(msg, promise); } @Override public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws Exception { MessageMetrics metrics = ctx.channel().attr(ATTR_KEY_METRICS).get(); String userId = ctx.channel().attr(ATTR_KEY_USERNAME).get(); if (userId == null) { userId = ""; } LOG.info("channel<{}> closing after read {} messages and wrote {} messages", userId, metrics.messagesRead(), metrics.messagesWrote()); m_collector.sumReadMessages(metrics.messagesRead()); m_collector.sumWroteMessages(metrics.messagesWrote()); super.close(ctx, promise); } public static MessageMetrics getMessageMetrics(Channel channel) { return channel.attr(ATTR_KEY_METRICS).get(); } } ================================================ FILE: broker/src/main/java/io/moquette/spi/ClientSession.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi; import cn.wildfirechat.proto.WFCMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.HashSet; import java.util.Queue; import java.util.Set; /** * Model a Session like describe on page 25 of MQTT 3.1.1 specification: * The Session state in the Server consists of: *
    *
  • The existence of a Session, even if the rest of the Session state is empty.
  • *
  • The Client’s subscriptions.
  • *
  • QoS 1 and QoS 2 messages which have been sent to the Client, but have not been * completely acknowledged.
  • *
  • QoS 1 and QoS 2 messages pending transmission to the Client.
  • *
  • QoS 2 messages which have been received from the Client, but have not been * completely acknowledged.
  • *
  • Optionally, QoS 0 messages pending transmission to the Client.
  • *
*/ public class ClientSession { class OutboundFlightZone { /** * Save the binding messageID, clientID - message * * @param messageID the packet ID used in transmission * @param msg the message to put in flight zone */ void waitingAck(int messageID, IMessagesStore.StoredMessage msg) { if (LOG.isTraceEnabled()) { LOG.trace("Adding to inflight {}, guid <{}>", messageID, msg.getGuid()); } m_sessionsStore.inFlight(ClientSession.this.clientID, messageID, msg); } IMessagesStore.StoredMessage acknowledged(int messageID) { if (LOG.isTraceEnabled()) LOG.trace("Acknowledging inflight, clientID <{}> messageID {}", ClientSession.this.clientID, messageID); return m_sessionsStore.inFlightAck(ClientSession.this.clientID, messageID); } } class InboundFlightZone { public IMessagesStore.StoredMessage lookup(int messageID) { return m_sessionsStore.inboundInflight(clientID, messageID); } public void waitingRel(int messageID, IMessagesStore.StoredMessage msg) { m_sessionsStore.markAsInboundInflight(clientID, messageID, msg); } } private static final Logger LOG = LoggerFactory.getLogger(ClientSession.class); public final String clientID; private final ISessionsStore m_sessionsStore; // private BlockingQueue m_queueToPublish = new // ArrayBlockingQueue<>(Constants.MAX_MESSAGE_QUEUE); private final OutboundFlightZone outboundFlightZone; private final InboundFlightZone inboundFlightZone; public ClientSession(String clientID, ISessionsStore sessionsStore) { this.clientID = clientID; this.m_sessionsStore = sessionsStore; this.outboundFlightZone = new OutboundFlightZone(); this.inboundFlightZone = new InboundFlightZone(); } /** * Return the list of persisted publishes for the given clientID. For QoS1 and QoS2 with clean * session flag, this method return the list of missed publish events while the client was * disconnected. * * @return the list of messages to be delivered for client related to the session. */ public Queue queue() { LOG.info("Retrieving enqueued messages. CId={}", clientID); return this.m_sessionsStore.queue(clientID); } @Override public String toString() { return "ClientSession{clientID='" + clientID + '\'' + "}"; } public void disconnect(String userId, boolean cleanSession, boolean disableSession) { if (cleanSession) { LOG.info("Client disconnected. Removing its subscriptions. ClientId={}", clientID); // cleanup topic subscriptions cleanSession(userId); } else if(disableSession) { LOG.info("Client disconnected. disable session. ClientId={}", clientID); m_sessionsStore.disableSession(userId, this.clientID); } } public void cleanSession(String userId) { m_sessionsStore.cleanSession(userId, this.clientID); } public int nextPacketId() { return this.m_sessionsStore.nextPacketID(this.clientID); } public IMessagesStore.StoredMessage inFlightAcknowledged(int messageID) { return outboundFlightZone.acknowledged(messageID); } /** * Mark the message identified by guid as publish in flight. * * @return the packetID for the message in flight. * */ public int inFlightAckWaiting(IMessagesStore.StoredMessage msg) { LOG.debug("Adding message ot inflight zone. ClientId={}", clientID); int messageId = ClientSession.this.nextPacketId(); outboundFlightZone.waitingAck(messageId, msg); return messageId; } public IMessagesStore.StoredMessage secondPhaseAcknowledged(int messageID) { return m_sessionsStore.secondPhaseAcknowledged(clientID, messageID); } /** * Enqueue a message to be sent to the client. * * @param message * the message to enqueue. */ public void enqueue(IMessagesStore.StoredMessage message) { this.m_sessionsStore.queue(this.clientID).add(message); } public IMessagesStore.StoredMessage inboundInflight(int messageID) { return inboundFlightZone.lookup(messageID); } public void markAsInboundInflight(int messageID, IMessagesStore.StoredMessage msg) { inboundFlightZone.waitingRel(messageID, msg); } public void moveInFlightToSecondPhaseAckWaiting(int messageID, IMessagesStore.StoredMessage msg) { m_sessionsStore.moveInFlightToSecondPhaseAckWaiting(this.clientID, messageID, msg); } public int getPendingPublishMessagesNo() { return m_sessionsStore.getPendingPublishMessagesNo(clientID); } public int getSecondPhaseAckPendingMessages() { return m_sessionsStore.getSecondPhaseAckPendingMessages(clientID); } public int getInflightMessagesNo() { return m_sessionsStore.getInflightMessagesNo(clientID); } } ================================================ FILE: broker/src/main/java/io/moquette/spi/IMatchingCondition.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi; import io.moquette.spi.impl.subscriptions.Topic; public interface IMatchingCondition { boolean match(Topic key); } ================================================ FILE: broker/src/main/java/io/moquette/spi/IMessagesStore.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi; import cn.wildfirechat.pojos.*; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.xiaoleilu.loServer.model.FriendData; import io.moquette.persistence.DatabaseStore; import io.moquette.persistence.MemorySessionStore; import io.moquette.persistence.UserClientEntry; import io.moquette.spi.impl.subscriptions.Topic; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.mqtt.MqttQoS; import cn.wildfirechat.common.ErrorCode; import java.util.*; /** * Defines the SPI to be implemented by a StorageService that handle persistence of messages */ public interface IMessagesStore { class StoredMessage { final MqttQoS m_qos; final byte[] m_payload; final String m_topic; private boolean m_retained; private String m_clientID; private MessageGUID m_guid; public StoredMessage(byte[] message, MqttQoS qos, String topic) { m_qos = qos; m_payload = message; m_topic = topic; } public MqttQoS getQos() { return m_qos; } public String getTopic() { return m_topic; } public void setGuid(MessageGUID guid) { this.m_guid = guid; } public MessageGUID getGuid() { return m_guid; } public String getClientID() { return m_clientID; } public void setClientID(String m_clientID) { this.m_clientID = m_clientID; } public ByteBuf getPayload() { return Unpooled.copiedBuffer(m_payload); } public void setRetained(boolean retained) { this.m_retained = retained; } public boolean isRetained() { return m_retained; } @Override public String toString() { return "PublishEvent{clientID='" + m_clientID + '\'' + ", m_retain=" + m_retained + ", m_qos=" + m_qos + ", m_topic='" + m_topic + '\'' + '}'; } } DatabaseStore getDatabaseStore(); WFCMessage.Message storeMessage(String fromUser, String fromClientId, WFCMessage.Message message); void storeSensitiveMessage(WFCMessage.Message message); int getNotifyReceivers(String fromUser, WFCMessage.Message.Builder message, Set notifyReceivers, ProtoConstants.RequestSourceType requestSourceType); Set getAllEnds(); WFCMessage.PullMessageResult fetchMessage(String user, String exceptClientId, long fromMessageId, int pullType); WFCMessage.PullMessageResult loadRemoteMessages(String user, WFCMessage.Conversation conversation, long beforeUid, int count, Collection contentTypes); long insertUserMessages(String sender, int conversationType, String target, int line, int messageContentType, String userId, long messageId, boolean directing); ErrorCode canAddGroupMembers(String operator, List memberList, Map failedMembers); WFCMessage.GroupInfo createGroup(String operator, WFCMessage.GroupInfo groupInfo, List memberList, String memberExtra, boolean isAdmin, Map failedMembers); ErrorCode addGroupMembers(String operator, boolean isAdmin, String groupId, List memberList, String extra, Map failedMembers); ErrorCode kickoffGroupMembers(String operator, boolean isAdmin, String groupId, List memberList); ErrorCode quitGroup(String operator, String groupId, boolean admin); void clearUserGroups(String userId); ErrorCode dismissGroup(String operator, String groupId, boolean isAdmin); ErrorCode modifyGroupInfo(String operator, String groupId, int modifyType, String value, boolean isAdmin); ErrorCode modifyGroupMemberAlias(String operator, String groupId, String alias, String memberId, boolean isAdmin); ErrorCode modifyGroupMemberExtra(String operator, String groupId, String extra, String memberId, boolean isAdmin); List getGroupInfos(List requests, String fromUser, boolean isAdmin); WFCMessage.GroupInfo getGroupInfo(String groupId); Set getUserGroupIds(String userId); Set getUserGroupIds(String userId, List types); Set getCommonGroupIds(String userId1, String userId2); ErrorCode getGroupMembers(String fromUser, String groupId, long maxDt, List members); WFCMessage.GroupMember getGroupMember(String groupId, String memberId); ErrorCode transferGroup(String operator, String groupId, String newOwner, boolean isAdmin); ErrorCode setGroupManager(String operator, String groupId, int type, List userList, boolean isAdmin); boolean isMemberInGroup(String member, String groupId); ErrorCode canSendMessageInGroup(String member, String groupId); Set getGroupManagers(String groupId, boolean includeOwner); ErrorCode recallMessage(long messageUid, String operatorId, String clientId, boolean isAdmin, ByteBuf ackPayload); ErrorCode recallCastMessage(long messageUid, String operatorId); void clearUserMessages(String userId); WFCMessage.Robot getRobot(String robotId); void addRobot(WFCMessage.Robot robot); void destroyRobot(String robotId); ErrorCode getUserInfo(String fromUser, List requestList, WFCMessage.PullUserResult.Builder builder); ErrorCode modifyUserInfo(String userId, WFCMessage.ModifyMyInfoRequest request) throws Exception; void forceCleanOnlineStatus(String userId, String clientId); void updateUserOnlineSetting(MemorySessionStore.Session session, boolean online); ErrorCode modifyUserStatus(String userId, int status); int getUserStatus(String userId); List getUserStatusList(); ErrorCode updateUserInfo(InputOutputUserInfo userInfo, int flag); void addUserInfo(WFCMessage.User user) throws Exception; void destroyUser(String userId); void updateUserInfo(WFCMessage.User user) throws Exception; WFCMessage.User getUserInfo(String userId); WFCMessage.User getUserInfoByName(String name); WFCMessage.User getUserInfoByMobile(String mobile); List getUserInfosByEmail(String email); ErrorCode searchUser(String userId, String keyword, int searchType, int userType, int page, List users); List getUserInfoList(int count, int offset); List getUserRobotIds(String userId); boolean updateSystemSetting(int id, String value, String desc); SystemSettingPojo getSystemSetting(int id); void createChatroom(String chatroomId, WFCMessage.ChatroomInfo chatroomInfo); void destoryChatroom(String chatroomId); WFCMessage.ChatroomInfo getChatroomInfo(String chatroomId); WFCMessage.ChatroomMemberInfo getChatroomMemberInfo(String chatroomId, final int maxMemberCount); int getChatroomMemberCount(String chatroomId); Collection getChatroomMemberClient(String userId); boolean checkUserClientInChatroom(String user, String clientId, String chatroomId); long insertChatroomMessages(String target, int line, long messageId); Collection getChatroomMembers(String chatroomId); OutputUserChatroom getUserChatroom(String userId); WFCMessage.PullMessageResult fetchChatroomMessage(String fromUser, String chatroomId, String exceptClientId, long fromMessageId); ErrorCode verifyToken(String userId, String token, List serverIPs, List ports); List getFriendList(String userId, String clientId, long version); void clearUserFriend(String userId); List getFriendRequestList(String userId, long version); ErrorCode saveAddFriendRequest(String userId, WFCMessage.AddFriendRequest request, long[] head, boolean isAdmin, boolean isRobot); ErrorCode handleFriendRequest(String userId, WFCMessage.HandleFriendRequest request, WFCMessage.Message.Builder msgBuilder, long[] heads, boolean isAdmin); ErrorCode deleteFriend(String userId, String friendUid, long[] head); ErrorCode blackUserRequest(String fromUser, String targetUserId, int status, long[] head); FriendData getFriendData(String fromUser, String targetUserId); ErrorCode SyncFriendRequestUnread(String userId, long unreadDt, long[] head); ErrorCode isAllowUserMessage(String fromUser, String userId, int line); ErrorCode isBlacked(String fromUser, String userId); ErrorCode setFriendAliasRequest(String fromUser, String targetUserId, String alias, long[] head); ErrorCode setFriendExtraRequest(String fromUser, String targetUserId, String extra, long[] head); boolean isAllowName(String name); ErrorCode handleJoinChatroom(String userId, String clientId, String chatroomId); ErrorCode handleQuitChatroom(String userId, String clientId, String chatroomId); boolean checkChatroomParticipantIdelTime(MemorySessionStore.Session session); String getApplicationAuthCode(String fromUser, String applicationId, int appType, String host); String verifyApplicationAuthCode(String token, String applicationId, int type); ErrorCode configApplication(String appId, int appType, long timestamp, String nonce, String signature); ErrorCode getUserSettings(String userId, long version, WFCMessage.GetUserSettingResult.Builder builder); WFCMessage.UserSettingEntry getUserSetting(String userId, int scope, String key); List getUserSetting(String userId, int scope); long updateUserSettings(String userId, WFCMessage.ModifyUserSettingReq request, String clientId); void clearUserSettings(String userId); boolean isLocked(String userId, String clientId); boolean getUserGlobalSilent(String userId); boolean getUserVoipSilent(String userId); boolean getUserPushHiddenDetail(String userId); boolean getUserConversationSilent(String userId, WFCMessage.Conversation conversation); boolean getSilentWhenPcOnline(String userId); boolean isUserNoDisturbing(String userId); ErrorCode createChannel(String operator, WFCMessage.ChannelInfo channelInfo); void clearUserChannels(String userId); ErrorCode modifyChannelInfo(String operator, String channelId, int modifyType, String value); ErrorCode transferChannel(String operator, String channelId, String newOwner); ErrorCode destroyChannel(String operator, String channelId, boolean isAdmin); List searchChannel(String keyword, boolean buzzy, int page); List getListenedChannels(String userId); ErrorCode listenChannel(String operator, String channelId, boolean listen); WFCMessage.ChannelInfo getChannelInfo(String channelId); boolean canSendMessageInChannel(String user, String channelId); boolean checkUserInChannel(String user, String channelId); Collection getChannelSubscriber(String channelId); int getOnlineUserCount(); GetOnlineUserResult getOnlineUsers(int offset, int count); Set handleSensitiveWord(String message); boolean addSensitiveWords(List words); boolean removeSensitiveWords(List words); List getAllSensitiveWords(); boolean isSensitiveOnlyMessage(); WFCMessage.Message getMessage(long messageId); void increaseUnreceivedMsgCount(String user); int getUnreceivedMsgCount(String user); boolean isAllowClientCustomGroupNotification(); boolean isAllowRobotCustomGroupNotification(); int getVisibleQuitKickoffNotification(); int getGroupForbiddenClientOperation(); boolean isForwardMessageWithClientInfo(); boolean isForwardMessageWithSenderInfo(); boolean isForwardMessageWithTargetInfo(); boolean isRobotCallbackWithClientInfo(); boolean isRobotCallbackWithSenderInfo(); boolean isRobotCallbackWithTargetInfo(); boolean isRobotMentionExternalRobot(); int getRobotGetUserInfoMask(); boolean isChannelCallbackWithClientInfo(); boolean isChannelCallbackWithSenderInfo(); boolean isChannelCallbackWithTargetInfo(); boolean isChannelNewCallbackFeature(); boolean isGroupAllowPartSuccess(); boolean isRobotAutoAcceptFriendRequest(); long getPushExpiredTimes(); Set getForcePushTypes(); List getClientForbiddenSendTypes(); List getBlackListExceptionTypes(); List getGroupMuteExceptionTypes(); List getGlobalMuteExceptionTypes(); long getMessageHead(String user); long getFriendHead(String user); long getFriendRqHead(String user); long getSettingHead(String user); //使用了数据库,会比较慢,仅能用户用户/群组等id的生成 String getShortUUID(); boolean checkSignature(String signature); boolean existSignatures(); /** * Used to initialize all persistent store structures */ void initStore(); /** * Return a list of retained messages that satisfy the condition. * * @param condition * the condition to match during the search. * @return the collection of matching messages. */ Collection searchMatching(IMatchingCondition condition); void cleanRetained(Topic topic); void storeRetained(Topic topic, StoredMessage storedMessage); } ================================================ FILE: broker/src/main/java/io/moquette/spi/IMessaging.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi; /** * Callback interface used to be notified of some events from the input event queue. * * It's the abstraction of the messaging stuff attached in after the front protocol parsing stuff. */ public interface IMessaging { } ================================================ FILE: broker/src/main/java/io/moquette/spi/ISessionsStore.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi; import cn.wildfirechat.proto.WFCMessage; import io.moquette.persistence.MemorySessionStore.Session; import io.moquette.spi.IMessagesStore.StoredMessage; import cn.wildfirechat.common.ErrorCode; import java.util.Collection; import java.util.Queue; /** * Store used to handle the persistence of the subscriptions tree. */ public interface ISessionsStore { void initStore(); /** * @param clientID * the session client ID. * @return true iff there are subscriptions persisted with clientID */ boolean contains(String clientID); Session updateOrCreateUserSession(String username, String clientID, int platform); ErrorCode loadActiveSession(String username, String clientID); ClientSession updateExistSession(String username, String clientID, WFCMessage.RouteRequest endpoint, boolean cleanSession); void updateSessionIp(String username, String clientID, String ip); Session getSession(String clientID); void cleanDuplatedToken(String cid, int pushType, String token, boolean isVoip, String packageName); void updateSessionToken(Session session, boolean voip); void clearUserSession(String username); void kickoffUserClient(String userId, String clientId); /** * @param clientID * the client owning the session. * @return the session for the given clientID, null if not found. */ Session sessionForClientAndUser(String username, String clientID); ClientSession sessionForClient(String clientID); void loadUserSession(String username, String clientID); Collection sessionForUser(String username); /** * Returns all the sessions * * @return the collection of all stored client sessions. */ Collection getAllSessions(); boolean isClientOnline(String clientId); StoredMessage inFlightAck(String clientID, int messageID); /** * Save the message msg with messageID, clientID as in flight * * @param clientID * the client ID * @param messageID * the message ID * @param msg * the message to put in flight zone */ void inFlight(String clientID, int messageID, StoredMessage msg); /** * Return the next valid packetIdentifier for the given client session. * * @param clientID * the clientID requesting next packet id. * @return the next valid id. */ int nextPacketID(String clientID); /** * List the published retained messages for the session * * @param clientID * the client ID owning the queue. * @return the queue of messages. */ Queue queue(String clientID); void dropQueue(String clientID); void moveInFlightToSecondPhaseAckWaiting(String clientID, int messageID, StoredMessage msg); /** * @param clientID * the client ID accessing the second phase. * @param messageID * the message ID that reached the second phase. * @return the guid of message just acked. */ StoredMessage secondPhaseAcknowledged(String clientID, int messageID); /** * Returns the number of inflight messages for the given client ID * * @param clientID target client. * @return count of pending in flight publish messages. */ int getInflightMessagesNo(String clientID); /** * @return the inflight inbound (PUBREL for Qos2) message. * */ IMessagesStore.StoredMessage inboundInflight(String clientID, int messageID); void markAsInboundInflight(String clientID, int messageID, StoredMessage msg); /** * Returns the size of the session queue for the given client ID * * @param clientID target client. * @return count of enqueued publish messages. */ int getPendingPublishMessagesNo(String clientID); /** * Returns the number of second-phase ACK pending messages for the given client ID * * @param clientID target client. * @return count of pending in flight publish messages. */ int getSecondPhaseAckPendingMessages(String clientID); void disableSession(String userId, String clientId); void cleanSession(String userId, String clientID); boolean isMultiEndpointSupported(); ErrorCode kickoffPCClient(String operator, String pcClientId); } ================================================ FILE: broker/src/main/java/io/moquette/spi/IStore.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi; public interface IStore { void initStore(); void close(); /** * Factory method to instantiate the messages store. * * @return the create instance of IMessagesStore. * */ IMessagesStore messagesStore(); /** * Factory method to instantiate the session store. * * @return the create instance of ISessionsStore. * */ ISessionsStore sessionsStore(); } ================================================ FILE: broker/src/main/java/io/moquette/spi/MessageGUID.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi; import java.io.Serializable; /** * Value object for GUIDs of messages. */ public class MessageGUID implements Serializable { private static final long serialVersionUID = 4315161987111542406L; private final String guid; public MessageGUID(String guid) { this.guid = guid; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MessageGUID that = (MessageGUID) o; return guid != null ? guid.equals(that.guid) : that.guid == null; } @Override public int hashCode() { return guid != null ? guid.hashCode() : 0; } @Override public String toString() { return "MessageGUID{" + "guid='" + guid + '\'' + '}'; } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/BrokerInterceptor.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl; import io.moquette.BrokerConstants; import io.moquette.interception.InterceptHandler; import io.moquette.interception.Interceptor; import io.moquette.interception.messages.*; import io.moquette.server.config.IConfig; import io.netty.handler.codec.mqtt.MqttConnectMessage; import io.netty.handler.codec.mqtt.MqttPublishMessage; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import static io.moquette.logging.LoggingUtils.getInterceptorIds; /** * An interceptor that execute the interception tasks asynchronously. */ final class BrokerInterceptor implements Interceptor { private static final Logger LOG = LoggerFactory.getLogger(BrokerInterceptor.class); private final Map, List> handlers; private final ExecutorService executor; private BrokerInterceptor(int poolSize, List handlers) { LOG.info("Initializing broker interceptor. InterceptorIds={}", getInterceptorIds(handlers)); this.handlers = new HashMap<>(); for (Class messageType : InterceptHandler.ALL_MESSAGE_TYPES) { this.handlers.put(messageType, new CopyOnWriteArrayList()); } for (InterceptHandler handler : handlers) { this.addInterceptHandler(handler); } executor = Executors.newFixedThreadPool(poolSize); } /** * Configures a broker interceptor, with a thread pool of one thread. * * @param handlers */ BrokerInterceptor(List handlers) { this(1, handlers); } /** * Configures a broker interceptor using the pool size specified in the IConfig argument. */ BrokerInterceptor(IConfig props, List handlers) { this(Integer.parseInt(props.getProperty(BrokerConstants.BROKER_INTERCEPTOR_THREAD_POOL_SIZE, "1")), handlers); } /** * Shutdown graciously the executor service */ void stop() { LOG.info("Shutting down interceptor thread pool..."); executor.shutdown(); try { LOG.info("Waiting for thread pool tasks to terminate..."); executor.awaitTermination(10L, TimeUnit.SECONDS); } catch (InterruptedException e) { } if (!executor.isTerminated()) { LOG.warn("Forcing shutdown of interceptor thread pool..."); executor.shutdownNow(); } } @Override public void notifyClientConnected(final MqttConnectMessage msg) { for (final InterceptHandler handler : this.handlers.get(InterceptConnectMessage.class)) { LOG.debug("Sending MQTT CONNECT message to interceptor. CId={}, interceptorId={}", msg.payload().clientIdentifier(), handler.getID()); executor.execute(() -> handler.onConnect(new InterceptConnectMessage(msg))); } } @Override public void notifyClientDisconnected(final String clientID, final String username) { for (final InterceptHandler handler : this.handlers.get(InterceptDisconnectMessage.class)) { LOG.debug("Notifying MQTT client disconnection to interceptor. CId={}, username={}, interceptorId={}", clientID, username, handler.getID()); executor.execute(() -> handler.onDisconnect(new InterceptDisconnectMessage(clientID, username))); } } @Override public void notifyClientConnectionLost(final String clientID, final String username) { for (final InterceptHandler handler : this.handlers.get(InterceptConnectionLostMessage.class)) { LOG.debug("Notifying unexpected MQTT client disconnection to interceptor CId={}, username={}, " + "interceptorId={}", clientID, username, handler.getID()); executor.execute(() -> handler.onConnectionLost(new InterceptConnectionLostMessage(clientID, username))); } } @Override public void notifyMessageAcknowledged(final InterceptAcknowledgedMessage msg) { for (final InterceptHandler handler : this.handlers.get(InterceptAcknowledgedMessage.class)) { LOG.debug("Notifying MQTT ACK message to interceptor. CId={}, messageId={}, topic={}, interceptorId={}", msg.getMsg().getClientID(), msg.getPacketID(), msg.getTopic(), handler.getID()); executor.execute(() -> handler.onMessageAcknowledged(msg)); } } @Override public void addInterceptHandler(InterceptHandler interceptHandler) { Class[] interceptedMessageTypes = getInterceptedMessageTypes(interceptHandler); LOG.info("Adding MQTT message interceptor. InterceptorId={}, handledMessageTypes={}", interceptHandler.getID(), interceptedMessageTypes); for (Class interceptMessageType : interceptedMessageTypes) { this.handlers.get(interceptMessageType).add(interceptHandler); } } @Override public void removeInterceptHandler(InterceptHandler interceptHandler) { Class[] interceptedMessageTypes = getInterceptedMessageTypes(interceptHandler); LOG.info("Removing MQTT message interceptor. InterceptorId={}, handledMessageTypes={}", interceptHandler.getID(), interceptedMessageTypes); for (Class interceptMessageType : interceptedMessageTypes) { this.handlers.get(interceptMessageType).remove(interceptHandler); } } private static Class[] getInterceptedMessageTypes(InterceptHandler interceptHandler) { Class[] interceptedMessageTypes = interceptHandler.getInterceptedMessageTypes(); if (interceptedMessageTypes == null) { return InterceptHandler.ALL_MESSAGE_TYPES; } return interceptedMessageTypes; } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/DebugUtils.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl; import io.netty.buffer.ByteBuf; final class DebugUtils { static String payload2Str(ByteBuf content) { return new String(content.copy().array()); } private DebugUtils() { } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/DesUtil.java ================================================ package io.moquette.spi.impl; import java.io.IOException; import java.security.SecureRandom; import java.util.Base64; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; public class DesUtil { private final static String Key = "abcdefgh"; private final static String DES = "AES"; public static void main(String[] args) throws Exception { String data = "123 456"; System.err.println(encrypt(data)); System.err.println(decrypt(encrypt(data))); System.out.println(decrypt("JF5dX/TlOg529KAhh+vywjzIp5Msktmf")); } /** * Description 根据键值进行加密 * @param data * @return * @throws Exception */ public static String encrypt(String data) throws Exception { byte[] bt = encrypt(data.getBytes(), Key.getBytes()); String strs = new String(Base64.getEncoder().encode(bt)); return strs; } /** * Description 根据键值进行解密 * @param data * @return * @throws IOException * @throws Exception */ public static String decrypt(String data) throws IOException, Exception { if (data == null) return null; byte[] buf = Base64.getDecoder().decode(data); byte[] bt = decrypt(buf,Key.getBytes()); return new String(bt); } /** * Description 根据键值进行加密 * @param data * @param key 加密键byte数组 * @return * @throws Exception */ private static byte[] encrypt(byte[] data, byte[] key) throws Exception { // 生成一个可信任的随机数源 SecureRandom sr = new SecureRandom(); // 从原始密钥数据创建DESKeySpec对象 DESKeySpec dks = new DESKeySpec(key); // 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象 SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES); SecretKey securekey = keyFactory.generateSecret(dks); // Cipher对象实际完成加密操作 Cipher cipher = Cipher.getInstance(DES); // 用密钥初始化Cipher对象 cipher.init(Cipher.ENCRYPT_MODE, securekey, sr); return cipher.doFinal(data); } /** * Description 根据键值进行解密 * @param data * @param key 加密键byte数组 * @return * @throws Exception */ private static byte[] decrypt(byte[] data, byte[] key) throws Exception { // 生成一个可信任的随机数源 SecureRandom sr = new SecureRandom(); // 从原始密钥数据创建DESKeySpec对象 DESKeySpec dks = new DESKeySpec(key); // 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象 SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES); SecretKey securekey = keyFactory.generateSecret(dks); // Cipher对象实际完成解密操作 Cipher cipher = Cipher.getInstance(DES); // 用密钥初始化Cipher对象 cipher.init(Cipher.DECRYPT_MODE, securekey, sr); return cipher.doFinal(data); } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/InternalRepublisher.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl; import io.moquette.spi.ClientSession; import io.moquette.spi.IMessagesStore; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.mqtt.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Collection; import java.util.Queue; class InternalRepublisher { private static final Logger LOG = LoggerFactory.getLogger(InternalRepublisher.class); private final PersistentQueueMessageSender messageSender; InternalRepublisher(PersistentQueueMessageSender messageSender) { this.messageSender = messageSender; } void publishRetained(ClientSession targetSession, Collection messages) { for (IMessagesStore.StoredMessage storedMsg : messages) { // fire as retained the message MqttPublishMessage publishMsg = retainedPublish(storedMsg); if (storedMsg.getQos() != MqttQoS.AT_MOST_ONCE) { LOG.debug("Adding message to inflight zone. ClientId={}, topic={}", targetSession.clientID, storedMsg.getTopic()); int packetID = targetSession.inFlightAckWaiting(storedMsg); // set the PacketIdentifier only for QoS > 0 publishMsg = retainedPublish(storedMsg, packetID); } this.messageSender.sendPublish(targetSession, publishMsg); } } void publishStored(ClientSession clientSession, Queue publishedEvents) { IMessagesStore.StoredMessage pubEvt; while ((pubEvt = publishedEvents.poll()) != null) { // put in flight zone LOG.debug("Adding message ot inflight zone. ClientId={}, guid={}, topic={}", clientSession.clientID, pubEvt.getGuid(), pubEvt.getTopic()); int messageId = clientSession.inFlightAckWaiting(pubEvt); MqttPublishMessage publishMsg = notRetainedPublish(pubEvt); // set the PacketIdentifier only for QoS > 0 if (publishMsg.fixedHeader().qosLevel() != MqttQoS.AT_MOST_ONCE) { publishMsg = notRetainedPublish(pubEvt, messageId); } this.messageSender.sendPublish(clientSession, publishMsg); } } private MqttPublishMessage notRetainedPublish(IMessagesStore.StoredMessage storedMessage, Integer messageID) { return createPublishForQos(storedMessage.getTopic(), storedMessage.getQos(), storedMessage.getPayload(), false, messageID); } private MqttPublishMessage notRetainedPublish(IMessagesStore.StoredMessage storedMessage) { return createPublishForQos(storedMessage.getTopic(), storedMessage.getQos(), storedMessage.getPayload(), false, 0); } private MqttPublishMessage retainedPublish(IMessagesStore.StoredMessage storedMessage) { return createPublishForQos(storedMessage.getTopic(), storedMessage.getQos(), storedMessage.getPayload(), true, 0); } private MqttPublishMessage retainedPublish(IMessagesStore.StoredMessage storedMessage, Integer packetID) { return createPublishForQos(storedMessage.getTopic(), storedMessage.getQos(), storedMessage.getPayload(), true, packetID); } public static MqttPublishMessage createPublishForQos(String topic, MqttQoS qos, ByteBuf message, boolean retained, int messageId) { MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.PUBLISH, false, qos, retained, 0); MqttPublishVariableHeader varHeader = new MqttPublishVariableHeader(topic, messageId); return new MqttPublishMessage(fixedHeader, varHeader, message); } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/MessagesPublisher.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl; import org.json.simple.JSONObject; import cn.wildfirechat.pojos.*; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.push.PushServer; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.util.StringUtil; import com.xiaoleilu.loServer.model.FriendData; import io.moquette.persistence.*; import io.moquette.persistence.MemorySessionStore.Session; import io.moquette.server.ConnectionDescriptorStore; import io.moquette.server.Server; import io.moquette.spi.IMessagesStore; import io.moquette.spi.ISessionsStore; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.handler.codec.mqtt.*; import org.json.simple.parser.JSONParser; import win.liyufan.im.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.function.BiFunction; import static cn.wildfirechat.common.IMExceptionEvent.EventType.EVENT_CALLBACK_Exception; import static cn.wildfirechat.proto.ProtoConstants.ConversationType.*; import static cn.wildfirechat.proto.ProtoConstants.PersistFlag.Transparent; public class MessagesPublisher { private static final Logger LOG = LoggerFactory.getLogger(MessagesPublisher.class); private final ConnectionDescriptorStore connectionDescriptors; private final ISessionsStore m_sessionsStore; private final IMessagesStore m_messagesStore; private final PersistentQueueMessageSender messageSender; private ConcurrentHashMap chatRoomHeaders = new ConcurrentHashMap<>(); private ExecutorService chatroomScheduler = Executors.newFixedThreadPool(1); private boolean schedulerStarted = false; private static ExecutorService executorCallback = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); public void startChatroomScheduler() { schedulerStarted = true; chatroomScheduler.execute(() -> { while (schedulerStarted) { try { if (chatRoomHeaders.size() < 100) { Thread.sleep(500); } else if(chatRoomHeaders.size() < 500) { Thread.sleep(100); } } catch (InterruptedException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } chatRoomHeaders.forEach(100, (s, aLong) -> { chatRoomHeaders.remove(s, aLong); publish2ChatroomReceivers(s.userId, s.clientId, aLong); }); } }); } public void stopChatroomScheduler() { schedulerStarted = false; try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } chatroomScheduler.shutdown(); } public MessagesPublisher(ConnectionDescriptorStore connectionDescriptors, ISessionsStore sessionsStore, PersistentQueueMessageSender messageSender, HazelcastInstance hz, IMessagesStore messagesStore) { this.connectionDescriptors = connectionDescriptors; this.m_sessionsStore = sessionsStore; this.messageSender = messageSender; this.m_messagesStore = messagesStore; this.startChatroomScheduler(); } static MqttPublishMessage notRetainedPublish(String topic, MqttQoS qos, ByteBuf message) { return notRetainedPublishWithMessageId(topic, qos, message, 0); } private static MqttPublishMessage notRetainedPublishWithMessageId(String topic, MqttQoS qos, ByteBuf message, int messageId) { MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.PUBLISH, false, qos, false, 0); MqttPublishVariableHeader varHeader = new MqttPublishVariableHeader(topic, messageId); return new MqttPublishMessage(fixedHeader, varHeader, message); } private void publish2ChatroomReceivers(String user, String clientId, long messageHead) { publish2ChatroomReceiversDirectly(user, clientId, messageHead); } public void publish2ChatroomReceiversDirectly(String user, String clientId, long messageHead) { try { Session session = m_sessionsStore.getSession(clientId); if (session != null) { LOG.warn("session for {} not exit", clientId); return; } if(!session.getUsername().equals(user)) { LOG.warn("session {} user is not {}", clientId, user); return; } if (!this.connectionDescriptors.isConnected(clientId)) { LOG.warn("session {} not connected", clientId); return; } WFCMessage.NotifyMessage notifyMessage = WFCMessage.NotifyMessage .newBuilder() .setType(ProtoConstants.PullType.Pull_ChatRoom) .setHead(messageHead) .build(); ByteBuf payload = Unpooled.buffer(); byte[] byteData = notifyMessage.toByteArray(); payload.ensureWritable(byteData.length).writeBytes(byteData); MqttPublishMessage publishMsg; publishMsg = notRetainedPublish(IMTopic.NotifyMessageTopic, MqttQoS.AT_MOST_ONCE, payload); boolean result = !this.messageSender.sendPublish(session.getClientSession(), publishMsg); if (!result) { LOG.warn("send publish to {} failure", clientId); } } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } private void publish2Receivers(String sender, int conversationType, String target, int line, long messageId, Collection receivers, String pushContent, String pushData, long callStartUid, String exceptClientId, int pullType, int messageContentType, long serverTime, int mentionType, List mentionTargets, int persistFlag, boolean directing) { if (persistFlag == Transparent) { publishTransparentMessage2Receivers(messageId, receivers, pullType, exceptClientId); return; } WFCMessage.Message message = null; String senderName = null; String senderPortrait = null; boolean sendNameLoaded = false; for (String user : receivers) { if (!user.equals(sender)) { WFCMessage.User userInfo = m_messagesStore.getUserInfo(user); if (userInfo != null && userInfo.getType() == ProtoConstants.UserType.UserType_Robot) { WFCMessage.Robot robot = m_messagesStore.getRobot(user); if (robot != null && !StringUtil.isNullOrEmpty(robot.getCallback())) { if (message == null) { message = m_messagesStore.getMessage(messageId); } OutputMessageData outputMessageData = getOutputMessageWithExtraInfo(message, exceptClientId, m_messagesStore.isRobotCallbackWithClientInfo() , m_messagesStore.isRobotCallbackWithSenderInfo(), m_messagesStore.isRobotCallbackWithTargetInfo()); outputMessageData.setToRobotId(robot.getUid()); Server.getServer().getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(robot.getCallback(), GsonUtil.gson.toJson(outputMessageData, OutputMessageData.class), HttpUtils.HttpPostType.POST_TYPE_Robot_Message_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); continue; } } } long messageSeq; if (pullType != ProtoConstants.PullType.Pull_ChatRoom) { messageSeq = m_messagesStore.insertUserMessages(sender, conversationType, target, line, messageContentType, user, messageId, directing); } else { messageSeq = m_messagesStore.insertChatroomMessages(user, line, messageId); } Collection sessions = m_sessionsStore.sessionForUser(user); String targetName = null; String targetPortrait = null; boolean targetNameLoaded = false; Collection targetClients = null; if (pullType == ProtoConstants.PullType.Pull_ChatRoom) { targetClients = m_messagesStore.getChatroomMemberClient(user); } boolean isPcOnline = false; if (!user.equals(sender)) { for (Session targetSession : sessions) { if (targetSession.getPlatform() == ProtoConstants.Platform.Platform_WEB || targetSession.getPlatform() == ProtoConstants.Platform.Platform_Windows || targetSession.getPlatform() == ProtoConstants.Platform.Platform_LINUX || targetSession.getPlatform() == ProtoConstants.Platform.Platform_OSX || targetSession.getPlatform() == ProtoConstants.Platform.Platform_HarmonyPC || targetSession.getPlatform() == ProtoConstants.Platform.Platform_iPad || targetSession.getPlatform() == ProtoConstants.Platform.Platform_APad || targetSession.getPlatform() == ProtoConstants.Platform.Platform_HarmonyPad ) { boolean targetIsActive = this.connectionDescriptors.isConnected(targetSession.getClientSession().clientID); if (targetIsActive) { isPcOnline = true; break; } } } } boolean unreadCountIncreased = false; for (Session targetSession : sessions) { //超过7天不活跃的用户忽略 if(System.currentTimeMillis() - targetSession.getLastActiveTime() > m_messagesStore.getPushExpiredTimes()) { continue; } if (exceptClientId != null && exceptClientId.equals(targetSession.getClientSession().clientID)) { continue; } if (targetSession.getClientID() == null) { continue; } if (pullType == ProtoConstants.PullType.Pull_ChatRoom && !targetClients.contains(targetSession.getClientID())) { continue; } if (pullType == ProtoConstants.PullType.Pull_ChatRoom) { if (exceptClientId != null && exceptClientId.equals(targetSession.getClientID())) { targetSession.refreshLastChatroomActiveTime(); } if (!m_messagesStore.checkChatroomParticipantIdelTime(targetSession)) { m_messagesStore.handleQuitChatroom(user, targetSession.getClientID(), target); continue; } } boolean isSilent; boolean isVoipSilent; boolean isNoDisturb; boolean isConvSilent = false; boolean isForcePush = false; if (pullType == ProtoConstants.PullType.Pull_ChatRoom) { isSilent = true; isConvSilent = true; isVoipSilent = true; isNoDisturb = true; } else { isSilent = false; isVoipSilent = false; isNoDisturb = false; if (!user.equals(sender)) { WFCMessage.Conversation conversation; if (conversationType == ConversationType_Private) { conversation = WFCMessage.Conversation.newBuilder().setType(conversationType).setLine(line).setTarget(sender).build(); } else { conversation = WFCMessage.Conversation.newBuilder().setType(conversationType).setLine(line).setTarget(target).build(); } if(m_messagesStore.getForcePushTypes().contains(messageContentType)) { LOG.info("The message type {} force push", messageContentType); isForcePush = true; } if (m_messagesStore.getUserConversationSilent(user, conversation)) { LOG.info("The conversation {}-{}-{} is slient", conversation.getType(), conversation.getTarget(), conversation.getLine()); isConvSilent = true; } if (m_messagesStore.getUserGlobalSilent(user)) { LOG.info("The user {} is global sliented", user); isSilent = true; } if (m_messagesStore.getUserVoipSilent(user)) { LOG.info("The user {} is voip sliented", user); isVoipSilent = true; } if (!isSilent && isPcOnline && m_messagesStore.getSilentWhenPcOnline(user)) { LOG.info("The user {} pc online and silent when pc online", user); isSilent = true; } if (m_messagesStore.isUserNoDisturbing(user)) { LOG.info("The user {} is no disturbing", user); isNoDisturb = true; } } if (!StringUtil.isNullOrEmpty(pushContent) || messageContentType == 400) { if (!isConvSilent && (persistFlag & 0x02) > 0 && !unreadCountIncreased) { m_messagesStore.increaseUnreceivedMsgCount(user); unreadCountIncreased = true; } } } boolean needPush = !user.equals(sender); boolean targetIsActive = this.connectionDescriptors.isConnected(targetSession.getClientSession().clientID); if (targetIsActive) { WFCMessage.NotifyMessage notifyMessage = WFCMessage.NotifyMessage .newBuilder() .setType(pullType) .setHead(messageSeq) .build(); ByteBuf payload = Unpooled.buffer(); byte[] byteData = notifyMessage.toByteArray(); payload.ensureWritable(byteData.length).writeBytes(byteData); MqttPublishMessage publishMsg; publishMsg = notRetainedPublish(IMTopic.NotifyMessageTopic, MqttQoS.AT_MOST_ONCE, payload); boolean sent = this.messageSender.sendPublish(targetSession.getClientSession(), publishMsg); if (sent) { needPush = false; } } else { LOG.info("the target {} of user {} is not active", targetSession.getClientID(), targetSession.getUsername()); } if (needPush && pullType != ProtoConstants.PullType.Pull_ChatRoom) { int curMentionType = 0; if (mentionType == 2) { curMentionType = 2; isConvSilent = false; } else if (mentionType == 1){ if (mentionTargets != null && mentionTargets.contains(user)) { curMentionType = 1; isConvSilent = false; } } boolean isVoip = messageContentType == 402 || messageContentType == 400 || messageContentType == 401 || messageContentType == 406; if (StringUtil.isNullOrEmpty(pushContent) && StringUtil.isNullOrEmpty(pushData) && !isVoip) { LOG.info("push content is empty and contenttype is {}", messageContentType); continue; } if (StringUtil.isNullOrEmpty(targetSession.getDeviceToken())) { LOG.info("device token not exist"); continue; } if (isConvSilent && !isVoip && !isForcePush) { LOG.info("Silent of user or conversation"); continue; } if (isSilent && !isVoip && !isForcePush) { LOG.info("Silent of user"); continue; } if(isVoip && isVoipSilent && !isForcePush) { LOG.info("voip silent of user"); continue; } if(isNoDisturb) { LOG.info("no disturb of user"); continue; } boolean isHiddenDetail = m_messagesStore.getUserPushHiddenDetail(user); if(!sendNameLoaded) { List list = new ArrayList<>(); senderName = getUserDisplayName(sender, conversationType == ConversationType_Group ? target : null, list); if(!list.isEmpty()) { senderPortrait = list.get(0); } sendNameLoaded = true; } if(!targetNameLoaded) { List list = new ArrayList<>(); targetName = getTargetName(target, conversationType, user, list); if(!list.isEmpty()) { targetPortrait = list.get(0); } targetNameLoaded = true; } String name = senderName; if (!sender.equals(user)) { FriendData fd = m_messagesStore.getFriendData(user, sender); if (fd != null && !StringUtil.isNullOrEmpty(fd.getAlias())) { name = fd.getAlias(); } } this.messageSender.sendPush(sender, conversationType, target, line, messageId, targetSession.getClientID(), pushContent, pushData, callStartUid, messageContentType, serverTime, name, senderPortrait, targetName, targetPortrait, m_messagesStore.getUnreceivedMsgCount(user), curMentionType, isHiddenDetail, targetSession.getLanguage(), getExistBadgeNumber(user)); } } } } private int getExistBadgeNumber(String user) { int existBadgeNumber = 0; WFCMessage.UserSettingEntry userSettingData = m_messagesStore.getUserSetting(user, UserSettingScope.kUserSettingScopeSyncBadge, ""); if(userSettingData != null && !StringUtil.isNullOrEmpty(userSettingData.getValue())) { try { existBadgeNumber = Integer.parseInt(userSettingData.getValue()); } catch (NumberFormatException e) {} } return existBadgeNumber; } public boolean sendOfflineNotify(String clientId) { boolean targetIsActive = this.connectionDescriptors.isConnected(clientId); if (targetIsActive) { ByteBuf payload = Unpooled.buffer(); payload.ensureWritable(1).writeBytes("1".getBytes()); MqttPublishMessage publishMsg; publishMsg = notRetainedPublish(IMTopic.NotifyOffline, MqttQoS.AT_MOST_ONCE, payload); boolean sent = this.messageSender.sendPublish(clientId, publishMsg); if (sent) { return true; } } else { LOG.info("the target {} is not active", clientId); } return false; } private void publishTransparentMessage2Receivers(long messageHead, Collection receivers, int pullType, String exceptClientId) { WFCMessage.Message message = m_messagesStore.getMessage(messageHead); if (message != null) { message = message.toBuilder().setMessageId(0).build(); for (String user : receivers) { Collection sessions = m_sessionsStore.sessionForUser(user); for (Session targetSession : sessions) { if(System.currentTimeMillis() - targetSession.getLastActiveTime() > 60 * 60 * 1000) { continue; } if (targetSession.getClientID() == null) { continue; } if (targetSession.getClientID().equals(exceptClientId)) { continue; } boolean targetIsActive = this.connectionDescriptors.isConnected(targetSession.getClientSession().clientID); if (targetIsActive) { ByteBuf payload = Unpooled.buffer(); byte[] byteData = message.toByteArray(); payload.ensureWritable(byteData.length).writeBytes(byteData); MqttPublishMessage publishMsg; publishMsg = notRetainedPublish(IMTopic.SendMessageTopic, MqttQoS.AT_MOST_ONCE, payload); this.messageSender.sendPublish(targetSession.getClientSession(), publishMsg); } else { LOG.info("the target {} of user {} is not active", targetSession.getClientID(), targetSession.getUsername()); } } if(sessions.isEmpty() && message.getContent().getType() == 403 && !user.equals(message.getFromUser())) { WFCMessage.User userInfo = m_messagesStore.getUserInfo(user); if (userInfo != null && userInfo.getType() == ProtoConstants.UserType.UserType_Robot) { WFCMessage.Robot robot = m_messagesStore.getRobot(user); if (robot != null && !StringUtil.isNullOrEmpty(robot.getCallback())) { OutputMessageData outputMessageData = getOutputMessageWithExtraInfo(message, exceptClientId, m_messagesStore.isRobotCallbackWithClientInfo() , m_messagesStore.isRobotCallbackWithSenderInfo(), m_messagesStore.isRobotCallbackWithTargetInfo()); Server.getServer().getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(robot.getCallback(), GsonUtil.gson.toJson(outputMessageData, OutputMessageData.class), HttpUtils.HttpPostType.POST_TYPE_Robot_Message_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } } } } } } String getUserDisplayName(String userId, String groupId, List portraitList) { WFCMessage.User user = m_messagesStore.getUserInfo(userId); String userName = null; if(user != null) { if(portraitList != null && !StringUtil.isNullOrEmpty(user.getPortrait())) { portraitList.add(user.getPortrait()); } userName = user.getDisplayName(); } if (!StringUtil.isNullOrEmpty(groupId)) { WFCMessage.GroupMember member = m_messagesStore.getGroupMember(groupId, userId); if (member != null && !StringUtil.isNullOrEmpty(member.getAlias())) { userName = member.getAlias(); } } return userName; } String getTargetName(String targetId, int cnvType, String fromUser, List portraitList) { if (cnvType == ConversationType_Private) { return getUserDisplayName(targetId, null, portraitList); } else if(cnvType == ConversationType_Group) { WFCMessage.GroupInfo group = m_messagesStore.getGroupInfo(targetId); if(group != null) { if(!StringUtil.isNullOrEmpty(group.getPortrait())) { portraitList.add(group.getPortrait()); } WFCMessage.UserSettingEntry entry = m_messagesStore.getUserSetting(fromUser, UserSettingScope.kUserSettingGroupRemark, targetId); if(entry != null && !StringUtil.isNullOrEmpty(entry.getValue())) { return entry.getValue(); } return group.getName(); } } else if(cnvType == ConversationType_Channel) { WFCMessage.ChannelInfo channelInfo = m_messagesStore.getChannelInfo(targetId); if (channelInfo != null) { if(!StringUtil.isNullOrEmpty(channelInfo.getPortrait())) { portraitList.add(channelInfo.getPortrait()); } return channelInfo.getName(); } } return null; } public void publishNotification(String topic, String receiver, long head) { publishNotification(topic, receiver, head, null, null); } public void publishNotification(String topic, String receiver, long head, String exceptClientId) { publishNotification(topic, receiver, head, null, null, exceptClientId); } public void publishNotification(String topic, String receiver, long head, String fromUser, String pushContent) { publishNotification(topic, receiver, head, fromUser, pushContent, null); } public void publishNotification(String topic, String receiver, long head, String fromUser, String pushContent, String exceptClientId) { Collection sessions = m_sessionsStore.sessionForUser(receiver); String fromUserName = null; for (Session targetSession : sessions) { if(targetSession.getClientID().equals(exceptClientId)) { continue; } boolean needPush = !StringUtil.isNullOrEmpty(pushContent); boolean targetIsActive = this.connectionDescriptors.isConnected(targetSession.getClientSession().clientID); if (targetIsActive) { ByteBuf payload = Unpooled.buffer(); payload.writeLong(head); MqttPublishMessage publishMsg; publishMsg = notRetainedPublish(topic, MqttQoS.AT_MOST_ONCE, payload); boolean result = this.messageSender.sendPublish(targetSession.getClientSession(), publishMsg); if (!result) { LOG.warn("Publish friend request failure"); } else { needPush = false; } } if (needPush) { if (fromUserName == null) { WFCMessage.User userInfo = m_messagesStore.getUserInfo(fromUser); if (userInfo == null) { fromUserName = ""; } else { fromUserName = userInfo.getDisplayName(); } } if (IMTopic.NotifyFriendRequestTopic.equals(topic)) { messageSender.sendPush(fromUser, receiver, targetSession.getClientID(), pushContent, PushServer.PushMessageType.PUSH_MESSAGE_TYPE_FRIEND_REQUEST, System.currentTimeMillis(), fromUserName, m_messagesStore.getUnreceivedMsgCount(receiver) + 1, targetSession.getLanguage(), getExistBadgeNumber(receiver)); } } } } public void updateChatroomMembersQueue(String chatroomId, int line, long messageId) { final long messageSeq = m_messagesStore.insertChatroomMessages(chatroomId, line, messageId); Collection members = m_messagesStore.getChatroomMembers(chatroomId); for (UserClientEntry member : members ) { chatRoomHeaders.compute(member, new BiFunction() { @Override public Long apply(UserClientEntry s, Long aLong) { if (aLong == null) return messageSeq; if (messageSeq > aLong) return messageSeq; return aLong; } }); } } public void publishRecall2ReceiversLocal(long messageUid, String operatorId, Collection receivers, String exceptClientId) { for (String user : receivers) { Collection sessions = m_sessionsStore.sessionForUser(user); for (Session targetSession : sessions) { if (exceptClientId != null && exceptClientId.equals(targetSession.getClientSession().clientID)) { continue; } if (targetSession.getClientID() == null) { continue; } boolean targetIsActive = this.connectionDescriptors.isConnected(targetSession.getClientSession().clientID); if (targetIsActive) { WFCMessage.NotifyRecallMessage notifyMessage = WFCMessage.NotifyRecallMessage .newBuilder() .setFromUser(operatorId) .setId(messageUid) .build(); ByteBuf payload = Unpooled.buffer(); byte[] byteData = notifyMessage.toByteArray(); payload.ensureWritable(byteData.length).writeBytes(byteData); MqttPublishMessage publishMsg; publishMsg = notRetainedPublish(IMTopic.NotifyRecallMessageTopic, MqttQoS.AT_MOST_ONCE, payload); this.messageSender.sendPublish(targetSession.getClientSession(), publishMsg); } else { LOG.info("the target {} of user {} is not active", targetSession.getClientID(), targetSession.getUsername()); } } } } public void publishRecall2Receivers(long messageUid, String operatorId, Set receivers, String exceptClientId) { publishRecall2ReceiversLocal(messageUid, operatorId, receivers, exceptClientId); } public void publish2Receivers(WFCMessage.Message message, Set receivers, String exceptClientId, int pullType) { if (message.getConversation().getType() == ConversationType_Channel) { WFCMessage.ChannelInfo channelInfo = m_messagesStore.getChannelInfo(message.getConversation().getTarget()); boolean forwardMsg; if(m_messagesStore.isChannelNewCallbackFeature()) { forwardMsg = channelInfo != null && !StringUtil.isNullOrEmpty(channelInfo.getCallback()) && !StringUtil.isNullOrEmpty(exceptClientId); } else { forwardMsg = channelInfo != null && !StringUtil.isNullOrEmpty(channelInfo.getCallback()) && channelInfo.getAutomatic() == 1 && !message.getFromUser().equals(channelInfo.getOwner()); } if (forwardMsg) { OutputMessageData outputMessageData = getOutputMessageWithExtraInfo(message, exceptClientId, m_messagesStore.isChannelCallbackWithClientInfo() , m_messagesStore.isChannelCallbackWithSenderInfo(), m_messagesStore.isChannelCallbackWithTargetInfo()); Server.getServer().getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(channelInfo.getCallback() + "/message", GsonUtil.gson.toJson(outputMessageData, OutputMessageData.class), HttpUtils.HttpPostType.POST_TYPE_Channel_Message_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } else { if (channelInfo == null) { LOG.info("Channel {} not exist", message.getConversation().getTarget()); } else { LOG.info("Channel {} callback {}", message.getConversation().getTarget(), channelInfo.getCallback()); } } } long messageId = message.getMessageId(); String pushContent = message.getContent().getPushContent(); if (StringUtil.isNullOrEmpty(pushContent)) { int type = message.getContent().getType(); if (type == ProtoConstants.ContentType.Image) { pushContent = "[图片]"; } else if(type == ProtoConstants.ContentType.Location) { pushContent = "[位置]"; } else if(type == ProtoConstants.ContentType.Text) { pushContent = message.getContent().getSearchableContent(); } else if(type == ProtoConstants.ContentType.Voice) { pushContent = "[语音]"; } else if(type == ProtoConstants.ContentType.Video) { pushContent = "[视频]"; } else if(type == ProtoConstants.ContentType.Link) { pushContent = "[链接]"; } else if(type == ProtoConstants.ContentType.File) { pushContent = "[文件]"; } else if(type == ProtoConstants.ContentType.Sticker) { pushContent = "[表情]"; } else if (type == ProtoConstants.ContentType.Name_Card) { pushContent = "[名片]"; } } if (message.getContent().getPersistFlag() == Transparent) { pushContent = null; } long callStartUid = 0; if (message.getContent().getType() == 402) { try { String str = new String(message.getContent().getData().toByteArray(), StandardCharsets.UTF_8); JSONObject jsonObject = (JSONObject)(new JSONParser().parse(str)); if (jsonObject.containsKey("u")) { callStartUid = (Long)jsonObject.get("u"); } } catch (Exception e) {} } publish2Receivers(message.getFromUser(), message.getConversation().getType(), message.getConversation().getTarget(), message.getConversation().getLine(), messageId, receivers, pushContent, message.getContent().getPushData(), callStartUid, exceptClientId, pullType, message.getContent().getType(), message.getServerTimestamp(), message.getContent().getMentionedType(), message.getContent().getMentionedTargetList(), message.getContent().getPersistFlag(), message.hasToUser() || !message.getToList().isEmpty()); } private OutputMessageData getOutputMessageWithExtraInfo(WFCMessage.Message message, String clientId, boolean withClient, boolean withSender, boolean withTarget) { if (message == null) { return null; } OutputClient outputClient = null; if (withClient && !StringUtil.isNullOrEmpty(clientId)) { Session session = m_sessionsStore.getSession(clientId); if(session != null && session.getUsername().equals(message.getFromUser())) { outputClient = new OutputClient(session.getPlatform(), clientId); } } OutputMessageData outputMessageData = OutputMessageData.fromProtoMessage(message, outputClient); if (withSender) { WFCMessage.User senderInfo = m_messagesStore.getUserInfo(message.getFromUser()); outputMessageData.setSenderUserInfo(InputOutputUserInfo.fromPbUser(senderInfo)); } if (withTarget) { if (message.getConversation().getType() == ConversationType_Private) { WFCMessage.User targetInfo = m_messagesStore.getUserInfo(message.getConversation().getTarget()); if (targetInfo != null) { outputMessageData.setTargetUserInfo(InputOutputUserInfo.fromPbUser(targetInfo)); } } else if(message.getConversation().getType() == ConversationType_Group) { WFCMessage.GroupInfo groupInfo = m_messagesStore.getGroupInfo(message.getConversation().getTarget()); if (groupInfo != null) { PojoGroupInfo pojoGroupInfo = new PojoGroupInfo(); pojoGroupInfo.setExtra(groupInfo.getExtra()); pojoGroupInfo.setName(groupInfo.getName()); pojoGroupInfo.setOwner(groupInfo.getOwner()); pojoGroupInfo.setPortrait(groupInfo.getPortrait()); pojoGroupInfo.setTarget_id(groupInfo.getTargetId()); pojoGroupInfo.setType(groupInfo.getType()); pojoGroupInfo.setMember_count(groupInfo.getMemberCount()); pojoGroupInfo.setMute(groupInfo.getMute()); pojoGroupInfo.setJoin_type(groupInfo.getJoinType()); pojoGroupInfo.setPrivate_chat(groupInfo.getPrivateChat()); pojoGroupInfo.setSearchable(groupInfo.getSearchable()); pojoGroupInfo.setMax_member_count(groupInfo.getMemberCount()); pojoGroupInfo.setHistory_message(groupInfo.getHistoryMessage()); pojoGroupInfo.setSuper_group(groupInfo.getSuperGroup()>0); pojoGroupInfo.setDeleted(groupInfo.getDeleted()>0); pojoGroupInfo.setUpdate_dt(groupInfo.getUpdateDt()); pojoGroupInfo.setMember_update_dt(groupInfo.getMemberUpdateDt()); outputMessageData.setTargetGroupInfo(pojoGroupInfo); } } else if(message.getConversation().getType() == ConversationType_Channel) { WFCMessage.ChannelInfo targetInfo = m_messagesStore.getChannelInfo(message.getConversation().getTarget()); if (targetInfo != null) { outputMessageData.setTargetChannelInfo(OutputGetChannelInfo.fromPbInfo(targetInfo)); } } } return outputMessageData; } public void forwardMessage(final WFCMessage.Message message, String forwardUrl, String fromClientId) { OutputMessageData outputMessageData = getOutputMessageWithExtraInfo(message, fromClientId, m_messagesStore.isForwardMessageWithClientInfo() , m_messagesStore.isForwardMessageWithSenderInfo(), m_messagesStore.isForwardMessageWithTargetInfo()); Server.getServer().getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(forwardUrl, GsonUtil.gson.toJson(outputMessageData), HttpUtils.HttpPostType.POST_TYPE_Forward_Message_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } public void forwardMessageWithCallback(final WFCMessage.Message message, String fromClientId, String forwardUrl, HttpUtils.HttpCallback callback) { OutputMessageData outputMessageData = getOutputMessageWithExtraInfo(message, fromClientId, m_messagesStore.isForwardMessageWithClientInfo() , m_messagesStore.isForwardMessageWithSenderInfo(), m_messagesStore.isForwardMessageWithTargetInfo()); try { HttpUtils.httpJsonPost(forwardUrl, GsonUtil.gson.toJson(outputMessageData), new HttpUtils.HttpCallback() { @Override public void onSuccess(String content) { Server.getServer().getImBusinessScheduler().execute(()->{ callback.onSuccess(content); }); } @Override public void onFailure(int statusCode, String errorMessage) { Server.getServer().getImBusinessScheduler().execute(()->{ callback.onFailure(statusCode, errorMessage); }); } }, HttpUtils.HttpPostType.POST_TYPE_Forward_Message_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } } public void notifyChannelListenStatusChanged(WFCMessage.ChannelInfo channelInfo, String user, boolean listen) { if (channelInfo == null || StringUtil.isNullOrEmpty(channelInfo.getCallback())) { return; } if(!m_messagesStore.isChannelNewCallbackFeature() && channelInfo.getAutomatic() == 0) { return; } Server.getServer().getCallbackScheduler().execute(() -> { try { HttpUtils.httpJsonPost(channelInfo.getCallback() + "/subscribe", GsonUtil.gson.toJson(new OutputNotifyChannelSubscribeStatus(user, channelInfo.getTargetId(), listen), OutputNotifyChannelSubscribeStatus.class), HttpUtils.HttpPostType.POST_TYPE_Channel_Subscriber_Event_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/PersistentQueueMessageSender.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.push.PushMessage; import cn.wildfirechat.push.PushServer; import io.moquette.server.ConnectionDescriptorStore; import io.moquette.spi.ClientSession; import io.netty.handler.codec.mqtt.MqttPublishMessage; import io.netty.handler.codec.mqtt.MqttQoS; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import static io.moquette.spi.impl.ProtocolProcessor.asStoredMessage; import static io.netty.handler.codec.mqtt.MqttQoS.AT_MOST_ONCE; class PersistentQueueMessageSender { private static final Logger LOG = LoggerFactory.getLogger(PersistentQueueMessageSender.class); private final ConnectionDescriptorStore connectionDescriptorStore; PersistentQueueMessageSender(ConnectionDescriptorStore connectionDescriptorStore) { this.connectionDescriptorStore = connectionDescriptorStore; } void sendPush(String sender, int conversationType, String target, int line, long messageId, String deviceId, String pushContent, String pushData, long callStartUid, int messageContentType, long serverTime, String senderName, String senderPortrait, String targetName, String targetPortrait, int unReceivedMsg, int mentionType, boolean isHiddenDetail, String language, int existBadgeNumber) { LOG.info("Send push to {}, message from {}", deviceId, sender); PushMessage pushMessage = new PushMessage(sender, conversationType, target, line, messageContentType, serverTime, senderName, senderPortrait, targetName, targetPortrait, unReceivedMsg, mentionType, isHiddenDetail, language); pushMessage.pushContent = pushContent; pushMessage.pushData = pushData; pushMessage.messageId = messageId; pushMessage.callStartUid = callStartUid; pushMessage.existBadgeNumber = existBadgeNumber; PushServer.getServer().pushMessage(pushMessage, deviceId, pushContent); } void sendPush(String sender, String target, String deviceId, String pushContent, int pushContentType, long serverTime, String senderName, int unReceivedMsg, String language, int existBadgeNumber) { LOG.info("Send push to {}, message from {}", deviceId, sender); PushMessage pushMessage = new PushMessage(sender, target, serverTime, senderName, unReceivedMsg, language, pushContentType); pushMessage.pushContent = pushContent; PushServer.getServer().pushMessage(pushMessage, deviceId, pushContent); } boolean sendPublish(ClientSession clientsession, MqttPublishMessage pubMessage) { String clientId = clientsession.clientID; return sendPublish(clientId, pubMessage); } boolean sendPublish(String clientId, MqttPublishMessage pubMessage) { final int messageId = pubMessage.variableHeader().packetId(); final String topicName = pubMessage.variableHeader().topicName(); if (LOG.isDebugEnabled()) { LOG.debug("Sending PUBLISH message. MessageId={}, CId={}, topic={}, qos={}, payload={}", messageId, clientId, topicName, DebugUtils.payload2Str(pubMessage.payload())); } else { LOG.info("Sending PUBLISH message. MessageId={}, CId={}, topic={}", messageId, clientId, topicName); } boolean messageDelivered = connectionDescriptorStore.sendMessage(pubMessage, messageId, clientId, null); if(!messageDelivered) { LOG.warn("PUBLISH message could not be delivered. MessageId={}, CId={}, topic={}", messageId, clientId, topicName); } return messageDelivered; } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/ProtocolProcessor.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.OutputCheckUserOnline; import cn.wildfirechat.pojos.UserOnlineStatus; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.hazelcast.util.StringUtil; import io.moquette.BrokerConstants; import io.moquette.persistence.ServerAPIHelper; import io.moquette.interception.InterceptHandler; import io.moquette.interception.messages.InterceptAcknowledgedMessage; import io.moquette.persistence.MemorySessionStore; import io.moquette.server.ConnectionDescriptor; import io.moquette.server.ConnectionDescriptorStore; import io.moquette.server.Server; import io.moquette.server.netty.NettyUtils; import io.moquette.spi.*; import io.moquette.spi.IMessagesStore.StoredMessage; import io.moquette.spi.impl.security.AES; import io.moquette.spi.security.IAuthenticator; import io.moquette.spi.security.IAuthorizator; import io.netty.buffer.ByteBuf; import io.netty.channel.Channel; import io.netty.channel.ChannelPipeline; import io.netty.handler.codec.mqtt.*; import io.netty.handler.timeout.IdleStateHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.GsonUtil; import win.liyufan.im.HttpUtils; import win.liyufan.im.IMTopic; import win.liyufan.im.Utility; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import static cn.wildfirechat.common.ErrorCode.ERROR_CODE_SUCCESS; import static io.moquette.spi.impl.InternalRepublisher.createPublishForQos; import static cn.wildfirechat.common.IMExceptionEvent.EventType.EVENT_CALLBACK_Exception; import static io.moquette.spi.impl.Utils.readBytesAndRewind; import static io.netty.handler.codec.mqtt.MqttConnectReturnCode.*; import static io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader.from; import static io.netty.handler.codec.mqtt.MqttQoS.*; import static io.moquette.server.ConnectionDescriptor.ConnectionState.*; /** * Class responsible to handle the logic of MQTT protocol it's the director of the protocol * execution. * * Used by the front facing class ProtocolProcessorBootstrapper. */ public class ProtocolProcessor { private static ExecutorService executorCallback = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); public void kickoffSession(final MemorySessionStore.Session session) { mServer.getImBusinessScheduler().execute(()->{ new Thread(() -> { messagesPublisher.sendOfflineNotify(session.getClientID()); try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } mServer.getImBusinessScheduler().execute(()->{ ConnectionDescriptor descriptor = connectionDescriptors.getConnection(session.getClientID()); try { if (descriptor != null) { processDisconnect(descriptor.getChannel(), true, false); } } catch (InterruptedException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } m_messagesStore.updateUserOnlineSetting(session, false); }); }).start(); }); } private void kickoffUserOffline(String userId) { System.out.println("kickoff user " + userId); Collection sessions = m_sessionsStore.sessionForUser(userId); for (MemorySessionStore.Session session : sessions) { ConnectionDescriptor descriptor = connectionDescriptors.getConnection(session.getClientID()); try { if (descriptor != null) { processDisconnect(descriptor.getChannel(), false, false); } } catch (InterruptedException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } } private static final Logger LOG = LoggerFactory.getLogger(ProtocolProcessor.class); protected ConnectionDescriptorStore connectionDescriptors; private IAuthorizator m_authorizator; private IMessagesStore m_messagesStore; private ISessionsStore m_sessionsStore; private IAuthenticator m_authenticator; private BrokerInterceptor m_interceptor; public Qos1PublishHandler qos1PublishHandler; private MessagesPublisher messagesPublisher; private Server mServer; ProtocolProcessor() { } /** * @param storageService * the persistent store to use for save/load of messages for QoS1 and QoS2 handling. * @param sessionsStore * the clients sessions store, used to persist subscriptions. * @param authenticator * true to allow clients connect without a clientid * @param authorizator * used to apply ACL policies to publishes and subscriptions. * @param interceptor * to notify events to an intercept handler */ void init(ConnectionDescriptorStore connectionDescriptors, IMessagesStore storageService, ISessionsStore sessionsStore, IAuthenticator authenticator, IAuthorizator authorizator, BrokerInterceptor interceptor, Server server) { LOG.info("Initializing MQTT protocol processor..."); this.connectionDescriptors = connectionDescriptors; this.m_interceptor = interceptor; m_authorizator = authorizator; m_authenticator = authenticator; m_messagesStore = storageService; m_sessionsStore = sessionsStore; LOG.info("Initializing messages publisher..."); final PersistentQueueMessageSender messageSender = new PersistentQueueMessageSender(this.connectionDescriptors); this.messagesPublisher = new MessagesPublisher(connectionDescriptors, sessionsStore, messageSender, server.getHazelcastInstance(), m_messagesStore); LOG.info("Initializing QoS publish handlers..."); this.qos1PublishHandler = new Qos1PublishHandler(m_authorizator, m_messagesStore, m_interceptor, this.connectionDescriptors, this.messagesPublisher, sessionsStore, server.getImBusinessScheduler(), server); mServer = server; String onlineStatusCallback = server.getConfig().getProperty(BrokerConstants.USER_ONLINE_STATUS_CALLBACK); if (!com.hazelcast.util.StringUtil.isNullOrEmpty(onlineStatusCallback)) { mUserOnlineStatusCallback = onlineStatusCallback; } } private String mUserOnlineStatusCallback; public void processConnect(Channel channel, MqttConnectMessage msg) { MqttConnectPayload payload = msg.payload(); String clientId = payload.clientIdentifier(); LOG.info("Processing CONNECT message. CId={}, username={}", clientId, payload.userName()); if (msg.variableHeader().version() < MqttVersion.MQTT_3_1_1.protocolLevel()) { MqttConnAckMessage badProto = connAck(CONNECTION_REFUSED_UNACCEPTABLE_PROTOCOL_VERSION); LOG.error("MQTT protocol version is not valid. CId={}", clientId); channel.writeAndFlush(badProto); channel.close(); return; } if (clientId == null || clientId.length() == 0) { MqttConnAckMessage badId = connAck(CONNECTION_REFUSED_IDENTIFIER_REJECTED); channel.writeAndFlush(badId); channel.close(); LOG.error("The MQTT client ID cannot be empty. Username={}", payload.userName()); return; } MqttVersion mqttVersion = MqttVersion.fromProtocolLevel(msg.variableHeader().version()); if (!login(channel, msg, clientId, mqttVersion)) { channel.flush(); channel.close(); LOG.error("The MQTT login failure. Username={}", payload.userName()); return; } if (!mServer.m_initialized) { channel.close(); return; } ConnectionDescriptor descriptor = new ConnectionDescriptor(clientId, channel); ConnectionDescriptor existing = this.connectionDescriptors.addConnection(descriptor); if (existing != null) { LOG.info("The client ID is being used in an existing connection. It will be closed. CId={}", clientId); this.connectionDescriptors.removeConnection(existing); existing.abort(); this.connectionDescriptors.addConnection(descriptor); } initializeKeepAliveTimeout(channel, msg, clientId); if (!sendAck(descriptor, msg, clientId)) { channel.close(); return; } m_interceptor.notifyClientConnected(msg); final ClientSession clientSession = createOrLoadClientSession(payload.userName(), descriptor, msg, clientId); if (clientSession == null) { MqttConnAckMessage badId = connAck(CONNECTION_REFUSED_SESSION_NOT_EXIST); channel.writeAndFlush(badId); channel.close(); return; } int flushIntervalMs = 500/* (keepAlive * 1000) / 2 */; descriptor.setupAutoFlusher(flushIntervalMs); final boolean success = descriptor.assignState(SESSION_CREATED, ESTABLISHED); if (!success) { channel.close(); return; } MemorySessionStore.Session session = m_sessionsStore.getSession(clientId); if(session != null) { session.refreshLastActiveTime(); forwardOnlineStatusEvent(payload.userName(), clientId, session.getPlatform(), UserOnlineStatus.ONLINE, session.getAppName()); m_messagesStore.updateUserOnlineSetting(session, true); } LOG.info("The CONNECT message has been processed. CId={}, username={}", clientId, payload.userName()); } public void forwardOnlineStatusEvent(String userId, String clientId, int platform, int status, String packageName) { if (!StringUtil.isNullOrEmpty(mUserOnlineStatusCallback)) { mServer.getCallbackScheduler().execute(() -> { try { int sessionstatus; Collection useSessions = m_sessionsStore.sessionForUser(userId); UserOnlineStatus userOnlineStatus = new UserOnlineStatus(userId, clientId, platform, status, packageName); userOnlineStatus.sessions = new ArrayList<>(); for (MemorySessionStore.Session session : useSessions) { if (session.getDeleted() > 0) { continue; } ConnectionDescriptor descriptor = connectionDescriptors.getConnection(session.getClientID()); if (descriptor == null) { sessionstatus = 1; } else { sessionstatus = 0; } userOnlineStatus.sessions.add(new OutputCheckUserOnline.Session(userId, session.getClientID(), session.getPlatform(), sessionstatus, session.getLastActiveTime(), session.getAppName(), session.getIp())); } HttpUtils.httpJsonPost(mUserOnlineStatusCallback, GsonUtil.gson.toJson(userOnlineStatus), HttpUtils.HttpPostType.POST_TYPE_User_Online_Event_Callback); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, EVENT_CALLBACK_Exception); } }); } } private MqttConnAckMessage connAck(MqttConnectReturnCode returnCode) { return connAck(returnCode, false); } private MqttConnAckMessage connAck(MqttConnectReturnCode returnCode, boolean sessionPresent) { return connAck(returnCode, sessionPresent, null); } private MqttConnAckMessage connAck(MqttConnectReturnCode returnCode, byte[] data) { return connAck(returnCode, false, data); } private MqttConnAckMessage connAckWithSessionPresent(MqttConnectReturnCode returnCode, byte[] data) { return connAck(returnCode, true, data); } private MqttConnAckMessage connAck(MqttConnectReturnCode returnCode, boolean sessionPresent, byte[] data) { MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.CONNACK, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttConnAckVariableHeader mqttConnAckVariableHeader = new MqttConnAckVariableHeader(returnCode, sessionPresent); return new MqttConnAckMessage(mqttFixedHeader, mqttConnAckVariableHeader, new MqttConnectAckPayload(data)); } private boolean login(Channel channel, MqttConnectMessage msg, final String clientId, MqttVersion mqttVersion) { // handle user authentication if (msg.variableHeader().hasUserName()) { int status = m_messagesStore.getUserStatus(msg.payload().userName()); if (status == ProtoConstants.UserStatus.Forbidden) { failedBlocked(channel); return false; } byte[] pwd = null; if (msg.variableHeader().hasPassword()) { pwd = msg.payload().passwordInBytes(); MemorySessionStore.Session session = m_sessionsStore.getSession(clientId); if (session == null) { ErrorCode errorCode = m_sessionsStore.loadActiveSession(msg.payload().userName(), clientId); if (errorCode != ErrorCode.ERROR_CODE_SUCCESS) { failedNoSession(channel); return false; } session = m_sessionsStore.getSession(clientId); } if (session.getDeleted() != 0) { LOG.error("user {} session {} is deleted. login failure", msg.payload().userName(), clientId); failedNoSession(channel); return false; } if (session != null && session.getUsername().equals(msg.payload().userName())) { pwd = AES.AESDecrypt(pwd, session.getSecret(), true); } else { LOG.error("Password decrypt failed of client {}", clientId); failedNoSession(channel); return false; } if (pwd == null) { LOG.error("Password decrypt failed of client {}", clientId); failedCredentials(channel); return false; } if(session.getPlatform() == ProtoConstants.Platform.Platform_Android || session.getPlatform() == ProtoConstants.Platform.Platform_APad) { byte[] signature = msg.payload().signatureInBytes(); String basedSign = null; if (signature != null && signature.length > 0) { signature = AES.AESDecrypt(signature, session.getSecret(), true); } if (signature != null && signature.length > 0) { basedSign = Base64.getEncoder().encodeToString(signature); } if (!m_messagesStore.checkSignature(basedSign)) { LOG.error("Bad signature of session <{}, {}>", session.getUsername(), session.getClientID()); failedBadSignature(channel); return false; } } session.setMqttVersion(mqttVersion); } else { LOG.error("Client didn't supply any password and MQTT anonymous mode is disabled CId={}", clientId); failedCredentials(channel); return false; } if (!m_authenticator.checkValid(clientId, msg.payload().userName(), pwd)) { LOG.error("Authenticator has rejected the MQTT credentials CId={}, username={}, password={}", clientId, msg.payload().userName(), pwd); failedCredentials(channel); return false; } NettyUtils.userName(channel, msg.payload().userName()); return true; } else { LOG.error("Client didn't supply any credentials and MQTT anonymous mode is disabled. CId={}", clientId); failedCredentials(channel); return false; } } private boolean sendAck(ConnectionDescriptor descriptor, MqttConnectMessage msg, final String clientId) { LOG.info("Sending connect ACK. CId={}", clientId); final boolean success = descriptor.assignState(DISCONNECTED, SENDACK); if (!success) { return false; } MqttConnAckMessage okResp; ClientSession clientSession = m_sessionsStore.sessionForClient(clientId); boolean isSessionAlreadyStored = clientSession != null; String user = msg.payload().userName(); long messageHead = m_messagesStore.getMessageHead(user); long friendHead = m_messagesStore.getFriendHead(user); long friendRqHead = m_messagesStore.getFriendRqHead(user); long settingHead = m_messagesStore.getSettingHead(user); WFCMessage.ConnectAckPayload payload = WFCMessage.ConnectAckPayload.newBuilder() .setMsgHead(messageHead) .setFriendHead(friendHead) .setFriendRqHead(friendRqHead) .setSettingHead(settingHead) .setServerTime(System.currentTimeMillis()) .build(); if (!msg.variableHeader().isCleanSession() && isSessionAlreadyStored) { okResp = connAckWithSessionPresent(CONNECTION_ACCEPTED, payload.toByteArray()); } else { okResp = connAck(CONNECTION_ACCEPTED, payload.toByteArray()); } descriptor.writeAndFlush(okResp); LOG.info("The connect ACK has been sent. CId={}", clientId); return true; } private void initializeKeepAliveTimeout(Channel channel, MqttConnectMessage msg, final String clientId) { int keepAlive = msg.variableHeader().keepAliveTimeSeconds(); LOG.info("Configuring connection. CId={}", clientId); NettyUtils.keepAlive(channel, keepAlive); // session.attr(NettyUtils.ATTR_KEY_CLEANSESSION).set(msg.variableHeader().isCleanSession()); NettyUtils.cleanSession(channel, msg.variableHeader().isCleanSession()); // used to track the client in the subscription and publishing phases. // session.attr(NettyUtils.ATTR_KEY_CLIENTID).set(msg.getClientID()); NettyUtils.clientID(channel, clientId); int idleTime = Math.round(keepAlive * 1.5f); setIdleTime(channel.pipeline(), idleTime); LOG.debug("The connection has been configured CId={}, keepAlive={}, cleanSession={}, idleTime={}", clientId, keepAlive, msg.variableHeader().isCleanSession(), idleTime); } private ClientSession createOrLoadClientSession(String username, ConnectionDescriptor descriptor, MqttConnectMessage msg, String clientId) { final boolean success = descriptor.assignState(SENDACK, SESSION_CREATED); if (!success) { return null; } m_sessionsStore.loadUserSession(username, clientId); ClientSession clientSession = m_sessionsStore.sessionForClient(clientId); boolean isSessionAlreadyStored = clientSession != null; if (isSessionAlreadyStored) { clientSession = m_sessionsStore.updateExistSession(username, clientId, null, msg.variableHeader().isCleanSession()); } else { return null; } return clientSession; } private void failedBlocked(Channel session) { session.writeAndFlush(connAck(CONNECTION_REFUSED_IDENTIFIER_REJECTED)); LOG.info("Client {} failed to connect, use is blocked.", session); } private void failedCredentials(Channel session) { session.writeAndFlush(connAck(CONNECTION_REFUSED_BAD_USER_NAME_OR_PASSWORD)); LOG.info("Client {} failed to connect with bad username or password.", session); } private void failedNoSession(Channel session) { session.writeAndFlush(connAck(CONNECTION_REFUSED_SESSION_NOT_EXIST)); LOG.info("Client {} failed to connect with bad username or password.", session); } private void failedBadSignature(Channel session) { session.writeAndFlush(connAck(CONNECTION_REFUSED_SIGNATURE_FAILURE)); LOG.info("Client {} failed to connect with bad signature.", session); } private void setIdleTime(ChannelPipeline pipeline, int idleTime) { if (pipeline.names().contains("idleStateHandler")) { pipeline.remove("idleStateHandler"); } pipeline.addFirst("idleStateHandler", new IdleStateHandler(idleTime, 0, 0)); } public void processPubAck(Channel channel, MqttPubAckMessage msg) { String clientID = NettyUtils.clientID(channel); int messageID = msg.variableHeader().messageId(); String username = NettyUtils.userName(channel); LOG.trace("retrieving inflight for messageID <{}>", messageID); ClientSession targetSession = m_sessionsStore.sessionForClient(clientID); StoredMessage inflightMsg = targetSession.inFlightAcknowledged(messageID); String topic = inflightMsg.getTopic(); InterceptAcknowledgedMessage wrapped = new InterceptAcknowledgedMessage(inflightMsg, topic, username, messageID); m_interceptor.notifyMessageAcknowledged(wrapped); } public static IMessagesStore.StoredMessage asStoredMessage(MqttPublishMessage msg) { // TODO ugly, too much array copy ByteBuf payload = msg.payload(); byte[] payloadContent = readBytesAndRewind(payload); IMessagesStore.StoredMessage stored = new IMessagesStore.StoredMessage(payloadContent, msg.fixedHeader().qosLevel(), msg.variableHeader().topicName()); stored.setRetained(msg.fixedHeader().isRetain()); return stored; } public void processPublish(Channel channel, MqttPublishMessage msg) { final MqttQoS qos = msg.fixedHeader().qosLevel(); final String clientId = NettyUtils.clientID(channel); LOG.info("Processing PUBLISH message. CId={}, topic={}, messageId={}, qos={}", clientId, msg.variableHeader().topicName(), msg.variableHeader().packetId(), qos); switch (qos) { case AT_MOST_ONCE: //not support break; case AT_LEAST_ONCE: this.qos1PublishHandler.receivedPublishQos1(channel, msg); break; case EXACTLY_ONCE: //not use break; default: LOG.error("Unknown QoS-Type:{}", qos); break; } } /** * Second phase of a publish QoS2 protocol, sent by publisher to the broker. Search the stored * message and publish to all interested subscribers. * * @param channel * the channel of the incoming message. * @param msg * the decoded pubrel message. */ public void processPubRel(Channel channel, MqttMessage msg) { //not use } public void processPubRec(Channel channel, MqttMessage msg) { //not use } public void processPubComp(Channel channel, MqttMessage msg) { //not use } public void processDisconnect(Channel channel, boolean isDup, boolean isRetain) throws InterruptedException { final String clientID = NettyUtils.clientID(channel); LOG.info("Processing DISCONNECT message. CId={}, clearSession={}", clientID, isDup); channel.flush(); if (clientID == null) { LOG.error("Error. Cid not exist!!!", clientID, isDup); channel.close(); return; } if (!isDup && !isRetain) { processConnectionLost(clientID, channel, isDup); return; } final ConnectionDescriptor existingDescriptor = this.connectionDescriptors.getConnection(clientID); if (existingDescriptor == null) { // another client with same ID removed the descriptor, we must exit channel.close(); return; } if (existingDescriptor.doesNotUseChannel(channel)) { // another client saved it's descriptor, exit LOG.warn("Another client is using the connection descriptor. Closing connection. CId={}", clientID); existingDescriptor.abort(); return; } if (!dropStoredMessages(existingDescriptor, clientID)) { LOG.warn("Unable to drop stored messages. Closing connection. CId={}", clientID); existingDescriptor.abort(); return; } if (!notifyInterceptorDisconnected(existingDescriptor, clientID)) { LOG.warn("Unable to drop will message. Closing connection. CId={}", clientID); existingDescriptor.abort(); return; } if (!existingDescriptor.close()) { LOG.info("The connection has been closed. CId={}", clientID); return; } this.connectionDescriptors.removeConnection(existingDescriptor); LOG.info("The DISCONNECT message has been processed. CId={}", clientID); String username = NettyUtils.userName(channel); MemorySessionStore.Session session = m_sessionsStore.getSession(clientID); if(session != null) { m_messagesStore.updateUserOnlineSetting(session, false); forwardOnlineStatusEvent(username, clientID, session.getPlatform(), UserOnlineStatus.LOGOUT, session.getAppName()); } channel.closeFuture(); //disconnect the session if(session != null) { m_sessionsStore.sessionForClient(clientID).disconnect(session.getUsername(), isDup, isRetain); } } private boolean dropStoredMessages(ConnectionDescriptor descriptor, String clientID) { final boolean success = descriptor.assignState(ESTABLISHED, MESSAGES_DROPPED); if (!success) { return false; } LOG.debug("Removing messages of session. CId={}", descriptor.clientID); this.m_sessionsStore.dropQueue(clientID); LOG.debug("The messages of the session have been removed. CId={}", descriptor.clientID); return true; } private boolean notifyInterceptorDisconnected(ConnectionDescriptor descriptor, String clientID) { final boolean success = descriptor.assignState(MESSAGES_DROPPED, INTERCEPTORS_NOTIFIED); if (!success) { return false; } LOG.info("Removing will message. ClientId={}", descriptor.clientID); // cleanup the will store String username = descriptor.getUsername(); m_interceptor.notifyClientDisconnected(clientID, username); return true; } public void processConnectionLost(String clientID, Channel channel, boolean clearSession) { LOG.info("Processing connection lost event. CId={}", clientID); String username = NettyUtils.userName(channel); MemorySessionStore.Session session = m_sessionsStore.getSession(clientID); if(session != null) { processOffline(session, clearSession, () -> { ConnectionDescriptor oldConnDescr = new ConnectionDescriptor(clientID, channel); if(connectionDescriptors.removeConnection(oldConnDescr)) { m_interceptor.notifyClientConnectionLost(clientID, username); } try { channel.close(); } catch (Exception e) { e.printStackTrace(); } }); } else { ConnectionDescriptor oldConnDescr = new ConnectionDescriptor(clientID, channel); if(connectionDescriptors.removeConnection(oldConnDescr)) { m_interceptor.notifyClientConnectionLost(clientID, username); } try { channel.close(); } catch (Exception e) { e.printStackTrace(); } } } public void processOffline(MemorySessionStore.Session session, boolean logout, Runnable runnable) { if(session != null) { session.refreshLastActiveTime(); forwardOnlineStatusEvent(session.getUsername(), session.getClientID(), session.getPlatform(), logout ? UserOnlineStatus.LOGOUT : UserOnlineStatus.OFFLINE, session.getAppName()); if(runnable != null) { runnable.run(); } m_messagesStore.updateUserOnlineSetting(session, false); } } /** * Remove the clientID from topic subscription, if not previously subscribed, doesn't reply any * error. * * @param channel * the channel of the incoming message. * @param msg * the decoded unsubscribe message. */ public void processUnsubscribe(Channel channel, MqttUnsubscribeMessage msg) { //Not use } public void processSubscribe(Channel channel, MqttSubscribeMessage msg) { //not use } /** * Create the SUBACK response from a list of topicFilters */ private MqttSubAckMessage doAckMessageFromValidateFilters(List topicFilters, int messageId) { List grantedQoSLevels = new ArrayList<>(); for (MqttTopicSubscription req : topicFilters) { grantedQoSLevels.add(req.qualityOfService().value()); } MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.SUBACK, false, AT_LEAST_ONCE, false, 0); MqttSubAckPayload payload = new MqttSubAckPayload(grantedQoSLevels); return new MqttSubAckMessage(fixedHeader, from(messageId), payload); } public void notifyChannelWritable(Channel channel) { String clientID = NettyUtils.clientID(channel); ClientSession clientSession = m_sessionsStore.sessionForClient(clientID); boolean emptyQueue = false; while (channel.isWritable() && !emptyQueue) { StoredMessage msg = clientSession.queue().poll(); if (msg == null) { emptyQueue = true; } else { // recreate a publish from stored publish in queue MqttPublishMessage pubMsg = createPublishForQos( msg.getTopic(), msg.getQos(), msg.getPayload(), msg.isRetained(), 0); channel.write(pubMsg); } } channel.flush(); } public ConnectionDescriptorStore getConnectionDescriptors() { return connectionDescriptors; } public void addInterceptHandler(InterceptHandler interceptHandler) { this.m_interceptor.addInterceptHandler(interceptHandler); } public void removeInterceptHandler(InterceptHandler interceptHandler) { this.m_interceptor.removeInterceptHandler(interceptHandler); } public IMessagesStore getMessagesStore() { return m_messagesStore; } public ISessionsStore getSessionsStore() { return m_sessionsStore; } public void onApiMessage(String fromUser, String clientId, byte[] message, int messageId, String from, String request, ProtoConstants.RequestSourceType requestSourceType) { if(request.equals(ServerAPIHelper.KICKOFF_USER_REQUEST)) { String userId = new String(message); mServer.getImBusinessScheduler().execute(()-> kickoffUserOffline(userId)); return; } qos1PublishHandler.onApiMessage(fromUser, clientId, message, messageId, from, request, requestSourceType); } public void shutdown() { messagesPublisher.stopChatroomScheduler(); } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/ProtocolProcessorBootstrapper.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import io.moquette.BrokerConstants; import io.moquette.interception.InterceptHandler; import io.moquette.server.ConnectionDescriptorStore; import io.moquette.server.Server; import io.moquette.server.config.IConfig; import io.moquette.spi.IMessagesStore; import io.moquette.spi.ISessionsStore; import io.moquette.spi.IStore; import io.moquette.spi.impl.security.PermitAllAuthorizator; import io.moquette.spi.impl.security.TokenAuthenticator; import io.moquette.spi.security.IAuthenticator; import io.moquette.spi.security.IAuthorizator; /** * It's main responsibility is bootstrap the ProtocolProcessor. */ public class ProtocolProcessorBootstrapper { private static final Logger LOG = LoggerFactory.getLogger(ProtocolProcessorBootstrapper.class); public static final String INMEMDB_STORE_CLASS = "io.moquette.persistence.MemoryStorageService"; private ISessionsStore m_sessionsStore; private Runnable storeShutdown; private final ProtocolProcessor m_processor = new ProtocolProcessor(); private ConnectionDescriptorStore connectionDescriptors; public ProtocolProcessorBootstrapper() { } /** * Initialize the processing part of the broker. * * @param props * the properties carrier where some props like port end host could be loaded. For * the full list check of configurable properties check wildfirechat.conf file. * @param embeddedObservers * a list of callbacks to be notified of certain events inside the broker. Could be * empty list of null. * @param authenticator * an implementation of the authenticator to be used, if null load that specified in * config and fallback on the default one (permit all). * @param authorizator * an implementation of the authorizator to be used, if null load that specified in * config and fallback on the default one (permit all). * @param server * the server to init. * @return the processor created for the broker. */ public ProtocolProcessor init(IConfig props, List embeddedObservers, IAuthenticator authenticator, IAuthorizator authorizator, Server server, IStore store) { IMessagesStore messagesStore; messagesStore = store.messagesStore(); m_sessionsStore = store.sessionsStore(); storeShutdown = new Runnable() { @Override public void run() { store.close(); } }; LOG.info("Configuring message interceptors..."); List observers = new ArrayList<>(embeddedObservers); String interceptorClassName = props.getProperty(BrokerConstants.INTERCEPT_HANDLER_PROPERTY_NAME); if (interceptorClassName != null && !interceptorClassName.isEmpty()) { InterceptHandler handler = loadClass(interceptorClassName, InterceptHandler.class, Server.class, server); if (handler != null) { observers.add(handler); } } BrokerInterceptor interceptor = new BrokerInterceptor(props, observers); LOG.info("Configuring MQTT authenticator..."); authenticator = new TokenAuthenticator(); LOG.info("Configuring MQTT authorizator..."); String authorizatorClassName = props.getProperty(BrokerConstants.AUTHORIZATOR_CLASS_NAME, ""); if (authorizator == null && !authorizatorClassName.isEmpty()) { authorizator = loadClass(authorizatorClassName, IAuthorizator.class, IConfig.class, props); } if (authorizator == null) { authorizator = new PermitAllAuthorizator(); LOG.info("An {} authorizator instance will be used", authorizator.getClass().getName()); } LOG.info("Initializing connection descriptor store..."); connectionDescriptors = new ConnectionDescriptorStore(m_sessionsStore); LOG.info("Initializing MQTT protocol processor..."); m_processor.init(connectionDescriptors, messagesStore, m_sessionsStore, authenticator, authorizator, interceptor, server); return m_processor; } @SuppressWarnings("unchecked") private T loadClass(String className, Class intrface, Class constructorArgClass, U props) { T instance = null; try { // check if constructor with constructor arg class parameter // exists LOG.info("Invoking constructor with {} argument. ClassName={}, interfaceName={}", constructorArgClass.getName(), className, intrface.getName()); instance = this.getClass().getClassLoader() .loadClass(className) .asSubclass(intrface) .getConstructor(constructorArgClass) .newInstance(props); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException ex) { LOG.warn("Unable to invoke constructor with {} argument. ClassName={}, interfaceName={}, cause={}, errorMessage={}", constructorArgClass.getName(), className, intrface.getName(), ex.getCause(), ex.getMessage()); return null; } catch (NoSuchMethodException | InvocationTargetException e) { try { LOG.info("Invoking default constructor. ClassName={}, interfaceName={}", className, intrface.getName()); // fallback to default constructor instance = this.getClass().getClassLoader() .loadClass(className) .asSubclass(intrface) .newInstance(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException ex) { LOG.error("Unable to invoke default constructor. ClassName={}, interfaceName={}, cause={}, errorMessage={}", className, intrface.getName(), ex.getCause(), ex.getMessage()); return null; } } return instance; } public ISessionsStore getSessionsStore() { return m_sessionsStore; } public void shutdown() { if (storeShutdown != null) storeShutdown.run(); if (m_processor != null) m_processor.shutdown(); // if (m_interceptor != null) // m_interceptor.stop(); } public ConnectionDescriptorStore getConnectionDescriptors() { return connectionDescriptors; } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/Qos1PublishHandler.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl; import static cn.wildfirechat.common.ErrorCode.*; import static io.moquette.spi.impl.Utils.readBytesAndRewind; import static io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader.from; import static io.netty.handler.codec.mqtt.MqttQoS.AT_MOST_ONCE; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.*; import java.util.zip.GZIPOutputStream; import cn.hutool.core.util.ReflectUtil; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.server.ThreadPoolExecutorWrapper; import com.google.gson.Gson; import com.xiaoleilu.loServer.action.ClassUtil; import cn.wildfirechat.pojos.OutputCheckUserOnline; import io.moquette.persistence.ServerAPIHelper; import io.moquette.imhandler.Handler; import io.moquette.imhandler.IMHandler; import io.moquette.persistence.MemorySessionStore; import io.moquette.server.ConnectionDescriptor; import io.moquette.server.Server; import io.moquette.spi.impl.security.AES; import io.netty.handler.codec.mqtt.MqttVersion; import io.netty.util.ReferenceCountUtil; import io.netty.util.internal.StringUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import io.moquette.server.ConnectionDescriptorStore; import io.moquette.server.netty.NettyUtils; import io.moquette.spi.IMessagesStore; import io.moquette.spi.ISessionsStore; import io.moquette.spi.impl.subscriptions.Topic; import io.moquette.spi.security.IAuthorizator; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.Channel; import io.netty.handler.codec.mqtt.MqttFixedHeader; import io.netty.handler.codec.mqtt.MqttMessageType; import io.netty.handler.codec.mqtt.MqttPublishMessage; import cn.wildfirechat.common.ErrorCode; import win.liyufan.im.GsonUtil; import win.liyufan.im.IMTopic; import win.liyufan.im.RateLimiter; import win.liyufan.im.Utility; import win.liyufan.im.extended.mqttmessage.ModifiedMqttPubAckMessage; public class Qos1PublishHandler extends QosPublishHandler { private static final Logger LOG = LoggerFactory.getLogger(Qos1PublishHandler.class); private final IMessagesStore m_messagesStore; private final ConnectionDescriptorStore connectionDescriptors; private final MessagesPublisher publisher; private final ISessionsStore m_sessionStore; private final ThreadPoolExecutorWrapper m_imBusinessExecutor; private HashMap m_imHandlers = new HashMap<>(); public Qos1PublishHandler(IAuthorizator authorizator, IMessagesStore messagesStore, BrokerInterceptor interceptor, ConnectionDescriptorStore connectionDescriptors, MessagesPublisher messagesPublisher, ISessionsStore sessionStore, ThreadPoolExecutorWrapper executorService, Server server) { super(authorizator); this.m_messagesStore = messagesStore; this.connectionDescriptors = connectionDescriptors; this.publisher = messagesPublisher; this.m_sessionStore = sessionStore; this.m_imBusinessExecutor = executorService; IMHandler.init(m_messagesStore, m_sessionStore, publisher, m_imBusinessExecutor, server); registerAllAction(); } private void registerAllAction() { try { for (Class cls:ClassUtil.getAllAssignedClass(IMHandler.class)) { Handler annotation = (Handler)cls.getAnnotation(Handler.class); if(annotation != null) { IMHandler handler = (IMHandler) ReflectUtil.newInstance(cls); m_imHandlers.put(annotation.value(), handler); } } } catch (IOException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } catch (ClassNotFoundException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } public void onApiMessage(String fromUser, String clientId, byte[] message, int requestId, String from, String request, ProtoConstants.RequestSourceType requestSourceType) { if (request.equals(ServerAPIHelper.CHECK_USER_ONLINE_REQUEST)) { checkUserOnlineHandler(message, ackPayload -> ServerAPIHelper.sendResponse(ERROR_CODE_SUCCESS.getCode(), ackPayload, from, requestId)); } else { imHandler(clientId, fromUser, request, message, (errorCode, ackPayload) -> { if (requestId > 0) { byte[] response = new byte[ackPayload.readableBytes()]; ackPayload.readBytes(response); ReferenceCountUtil.release(ackPayload); ServerAPIHelper.sendResponse(errorCode.getCode(), response, from, requestId); } }, requestSourceType); } } void checkUserOnlineHandler(byte[] payloadContent, RouteCallback callback) { m_imBusinessExecutor.execute(() -> { String userId = new String(payloadContent); int status; Collection useSessions = m_sessionStore.sessionForUser(userId); OutputCheckUserOnline out = new OutputCheckUserOnline(); for (MemorySessionStore.Session session : useSessions) { if (session.getDeleted() > 0) { continue; } ConnectionDescriptor descriptor = connectionDescriptors.getConnection(session.getClientID()); if (descriptor == null) { status = 1; } else { status = 0; } out.addSession(userId, session.getClientID(), session.getPlatform(), status, session.getLastActiveTime(), session.getAppName(), session.getIp()); } callback.onRouteHandled(GsonUtil.gson.toJson(out).getBytes()); }); } void imHandler(String clientID, String fromUser, String topic, byte[] payloadContent, IMCallback callback, ProtoConstants.RequestSourceType requestSourceType) { LOG.info("imHandler fromUser={}, topic={}", fromUser, topic); IMCallback wrapper = (errorcode, ackPayload) -> { ackPayload.resetReaderIndex(); byte code = ackPayload.readByte(); if(ackPayload.readableBytes() > 0) { byte[] data = new byte[ackPayload.readableBytes()]; ackPayload.getBytes(1, data); try { //clientID 为空的是server api请求。客户端不允许clientID为空 if (!StringUtil.isNullOrEmpty(clientID)) { //在route时,使用系统根密钥。当route成功后,用户都使用用户密钥 if (topic.equals(IMTopic.GetTokenTopic)) { data = AES.AESEncrypt(data, ""); } else { MemorySessionStore.Session session = m_sessionStore.getSession(clientID); if (session != null && session.getUsername().equals(fromUser)) { if (data.length > 7*1024 && session.getMqttVersion().protocolLevel() >= MqttVersion.MQTT_5.protocolLevel()) { ByteArrayOutputStream out = new ByteArrayOutputStream(); GZIPOutputStream gzip = null; try { gzip = new GZIPOutputStream(out); gzip.write(data); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } finally { if(gzip != null) { gzip.close(); } } data = out.toByteArray(); code = (byte)ErrorCode.ERROR_CODE_SUCCESS_GZIPED.code; } data = AES.AESEncrypt(data, session.getSecret()); } } } ackPayload.clear(); ackPayload.resetWriterIndex(); ackPayload.writeByte(code); ackPayload.writeBytes(data); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } ackPayload.resetReaderIndex(); try { callback.onIMHandled(errorcode, ackPayload); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } }; IMHandler handler = m_imHandlers.get(topic); if (handler != null) { handler.doHandler(clientID, fromUser, topic, payloadContent, wrapper, requestSourceType); } else { LOG.error("imHandler unknown topic={}", topic); ByteBuf ackPayload = Unpooled.buffer(); ackPayload.ensureWritable(1).writeByte(ERROR_CODE_NOT_IMPLEMENT.getCode()); try { wrapper.onIMHandled(ERROR_CODE_NOT_IMPLEMENT, ackPayload); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } } public interface IMCallback { void onIMHandled(ErrorCode errorCode, ByteBuf ackPayload); } interface RouteCallback { void onRouteHandled(byte[] ackPayload); } void receivedPublishQos1(Channel channel, MqttPublishMessage msg) { // verify if topic can be write final Topic topic = new Topic(msg.variableHeader().topicName()); String clientID = NettyUtils.clientID(channel); String username = NettyUtils.userName(channel); if (!m_authorizator.canWrite(topic, username, clientID)) { LOG.error("MQTT client is not authorized to publish on topic. CId={}, topic={}", clientID, topic); return; } final int messageID = msg.variableHeader().packetId(); String imtopic = topic.getTopic(); ByteBuf payload = msg.payload(); byte[] payloadContent = readBytesAndRewind(payload); if(payloadContent.length > 0) { MemorySessionStore.Session session = m_sessionStore.getSession(clientID); payloadContent = AES.AESDecrypt(payloadContent, session.getSecret(), true); if(payloadContent == null) { ByteBuf ackPayload = Unpooled.buffer(); ackPayload.ensureWritable(1).writeByte(ERROR_CODE_INVALID_DATA.getCode()); sendPubAck(clientID, messageID, ackPayload, ERROR_CODE_INVALID_DATA); return; } } imHandler(clientID, username, imtopic, payloadContent, (errorCode, ackPayload) -> sendPubAck(clientID, messageID, ackPayload, errorCode), ProtoConstants.RequestSourceType.Request_From_User); } private void sendPubAck(String clientId, int messageID, ByteBuf payload, ErrorCode errorCode) { LOG.trace("sendPubAck invoked"); MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.PUBACK, false, AT_MOST_ONCE, false, 0); ModifiedMqttPubAckMessage pubAckMessage = new ModifiedMqttPubAckMessage(fixedHeader, from(messageID), payload); try { if (connectionDescriptors == null) { throw new RuntimeException("Internal bad error, found connectionDescriptors to null while it should " + "be initialized, somewhere it's overwritten!!"); } LOG.debug("clientIDs are {}", connectionDescriptors); if (!connectionDescriptors.isConnected(clientId)) { throw new RuntimeException(String.format("Can't find a ConnectionDescriptor for client %s in cache %s", clientId, connectionDescriptors)); } connectionDescriptors.sendMessage(pubAckMessage, messageID, clientId, errorCode); } catch (Throwable t) { LOG.error(null, t); } } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/QosPublishHandler.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import io.moquette.server.netty.NettyUtils; import io.moquette.spi.impl.subscriptions.Topic; import io.moquette.spi.security.IAuthorizator; import io.netty.channel.Channel; abstract class QosPublishHandler { private static final Logger LOG = LoggerFactory.getLogger(QosPublishHandler.class); protected final IAuthorizator m_authorizator; protected QosPublishHandler(IAuthorizator m_authorizator) { this.m_authorizator = m_authorizator; } public boolean checkWriteOnTopic(Topic topic, Channel channel) { String clientID = NettyUtils.clientID(channel); String username = NettyUtils.userName(channel); if (!m_authorizator.canWrite(topic, username, clientID)) { LOG.error("MQTT client is not authorized to publish on topic. CId={}, topic={}", clientID, topic); return true; } return false; } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/Utils.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.mqtt.MqttMessage; import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; import java.util.Map; /** * Utility static methods, like Map get with default value, or elvis operator. */ public final class Utils { public static T defaultGet(Map map, K key, T defaultValue) { T value = map.get(key); if (value != null) { return value; } return defaultValue; } public static int messageId(MqttMessage msg) { return ((MqttMessageIdVariableHeader) msg.variableHeader()).messageId(); } public static byte[] readBytesAndRewind(ByteBuf payload) { byte[] payloadContent = new byte[payload.readableBytes()]; int mark = payload.readerIndex(); payload.readBytes(payloadContent); payload.readerIndex(mark); return payloadContent; } private Utils() { } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/security/ACLFileParser.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl.security; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.*; import java.text.ParseException; /** * Parses the acl configuration file. If a line starts with # it's comment. Blank lines are skipped. * The format is "topic [read|write|readwrite] {topic name}" */ public final class ACLFileParser { private static final Logger LOG = LoggerFactory.getLogger(ACLFileParser.class); /** * Parse the configuration from file. * * @param file * to parse * @return the collector of authorizations form reader passed into. * @throws ParseException * if the format is not compliant. */ public static AuthorizationsCollector parse(File file) throws ParseException { if (file == null) { LOG.warn("parsing NULL file, so fallback on default configuration!"); return AuthorizationsCollector.emptyImmutableCollector(); } if (!file.exists()) { LOG.warn( String.format( "parsing not existing file %s, so fallback on default configuration!", file.getAbsolutePath())); return AuthorizationsCollector.emptyImmutableCollector(); } try { FileReader reader = new FileReader(file); return parse(reader); } catch (FileNotFoundException fex) { LOG.warn( String.format( "parsing not existing file %s, so fallback on default configuration!", file.getAbsolutePath()), fex); return AuthorizationsCollector.emptyImmutableCollector(); } } /** * Parse the ACL configuration file * * @param reader * to parse * @return the collector of authorizations form reader passed into. * @throws ParseException * if the format is not compliant. */ public static AuthorizationsCollector parse(Reader reader) throws ParseException { if (reader == null) { // just log and return default properties LOG.warn("parsing NULL reader, so fallback on default configuration!"); return AuthorizationsCollector.emptyImmutableCollector(); } BufferedReader br = new BufferedReader(reader); String line; AuthorizationsCollector collector = new AuthorizationsCollector(); try { while ((line = br.readLine()) != null) { int commentMarker = line.indexOf('#'); if (commentMarker != -1) { if (commentMarker == 0) { // skip its a comment continue; } else { // it's a malformed comment throw new ParseException(line, commentMarker); } } else { if (line.isEmpty() || line.matches("^\\s*$")) { // skip it's a black line continue; } collector.parse(line); } } } catch (IOException ex) { throw new ParseException("Failed to read", 1); } return collector; } private ACLFileParser() { } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/security/AES.java ================================================ package io.moquette.spi.impl.security; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.Arrays; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.NoSuchPaddingException; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; public class AES { public static int keyLen = 16; private final static int ivLen = 16; private static byte[] aes_key= {0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F,0x3A,0x1F,0x28,0x39,0x4F,0x52,0x68,0x79,0x71,0x73,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F}; public static byte[] AESEncrypt(String sSrc, String userKey) { return AESEncrypt(sSrc.getBytes(), userKey); } public static void useAes256(boolean aes256) { if(aes256) keyLen = 32; else keyLen = 16; } public static byte[] AESEncrypt(byte[] tobeencrypdata, byte[] aesKey) { if (aesKey == null) { System.out.print("Key为空null"); return null; } // 判断Key是否为16位 if (aesKey.length < keyLen) { System.out.print("Key长度不是16位"); return null; } if(aesKey.length > keyLen) { aesKey = Arrays.copyOfRange(aesKey, 0, keyLen); } byte[] ivKeys; if(aesKey.length == ivLen) { ivKeys = aesKey; } else { ivKeys = Arrays.copyOfRange(aesKey, 0, ivLen); } try { SecretKeySpec skeySpec = new SecretKeySpec(aesKey, "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");//"算法/模式/补码方式" IvParameterSpec iv = new IvParameterSpec(ivKeys);//使用CBC模式,需要一个向量iv,可增加加密算法的强度 cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); //2018.1.1 0:0:0 以来的小时数 int curhour = (int) ((System.currentTimeMillis()/1000 - 1514736000)/3600); byte[] tobeencrypdatawithtime = new byte[tobeencrypdata.length + 4]; byte byte0 = (byte)(curhour & 0xFF); tobeencrypdatawithtime[0] = byte0; byte byte1 = (byte)((curhour & 0xFF00) >> 8); tobeencrypdatawithtime[1] = byte1; byte byte2 = (byte)((curhour & 0xFF0000) >> 16); tobeencrypdatawithtime[2] = byte2; byte byte3 = (byte)((curhour & 0xFF) >> 24); tobeencrypdatawithtime[3] = byte3; System.arraycopy(tobeencrypdata, 0, tobeencrypdatawithtime, 4, tobeencrypdata.length); byte[] encrypted = cipher.doFinal(tobeencrypdatawithtime); return encrypted; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (NoSuchPaddingException e) { e.printStackTrace(); } catch (InvalidKeyException e) { e.printStackTrace(); } catch (InvalidAlgorithmParameterException e) { e.printStackTrace(); } catch (IllegalBlockSizeException e) { e.printStackTrace(); } catch (BadPaddingException e) { e.printStackTrace(); } return null; } public static byte[] AESEncrypt(byte[] tobeencrypdata, String userKey) { byte[] aesKey = aes_key; if (userKey != null && !userKey.isEmpty()) { aesKey = convertUserKey(userKey); } return AESEncrypt(tobeencrypdata, aesKey); } public static int getUnsignedByte (byte data){ //将data字节型数据转换为0~255 (0xFF 即BYTE)。 return data&0x0FF ; } private static byte[] convertUserKey(String userKey) { byte[] key = new byte[keyLen]; for (int i = 0; i < keyLen; i++) { key[i] = (byte) (userKey.charAt(i) & 0xFF); } return key; } public static byte[] AESDecrypt(byte[] sSrc, String userKey, boolean checkTime) { return AESDecrypt(sSrc, userKey, checkTime, null); } public static byte[] AESDecrypt(byte[] sSrc, String userKey, boolean checkTime, boolean[] invalidTime) { byte[] aesKey = aes_key; if (userKey != null && !userKey.isEmpty()) { aesKey = convertUserKey(userKey); } return AESDecrypt(sSrc, aesKey, checkTime, invalidTime); } public static byte[] AESDecrypt(byte[] sSrc, byte[] aesKey, boolean checkTime, boolean[] invalidTime) { try { // 判断Key是否正确 if (aesKey == null) { aesKey = aes_key; } // 判断Key是否为16位 if (aesKey.length < keyLen) { System.out.print("Key长度不是16位"); return null; } if(aesKey.length > keyLen) { aesKey = Arrays.copyOfRange(aesKey, 0, keyLen); } byte[] ivKeys; if(aesKey.length == ivLen) { ivKeys = aesKey; } else { ivKeys = Arrays.copyOfRange(aesKey, 0, ivLen); } SecretKeySpec skeySpec = new SecretKeySpec(aesKey, "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); IvParameterSpec iv = new IvParameterSpec(ivKeys); cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); try { byte[] original = cipher.doFinal(sSrc); int hours = 0; if (original.length > 4) { hours += getUnsignedByte(original[3]); hours <<= 8; hours += getUnsignedByte(original[2]); hours <<= 8; hours += getUnsignedByte(original[1]); hours <<= 8; hours += getUnsignedByte(original[0]); //2018.1.1 0:0:0 以来的小时数 int curhour = (int) ((System.currentTimeMillis()/1000 - 1514736000)/3600); if (Math.abs(curhour - hours) > 24 && checkTime) { if(invalidTime != null) { invalidTime[0] = true; } return null; } byte[] neworiginal = new byte[original.length - 4]; System.arraycopy(original, 4, neworiginal, 0, neworiginal.length); return neworiginal; } return null; } catch (Exception e) { System.out.println(e.toString()); return null; } } catch (Exception ex) { System.out.println(ex.toString()); return null; } } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/security/AcceptAllAuthenticator.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl.security; import io.moquette.spi.security.IAuthenticator; public class AcceptAllAuthenticator implements IAuthenticator { public boolean checkValid(String clientId, String username, byte[] password) { return true; } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/security/Authorization.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl.security; import static io.moquette.spi.impl.security.Authorization.Permission.READWRITE; import io.moquette.spi.impl.subscriptions.Topic; /** * Carries the read/write authorization to topics for the users. */ public class Authorization { protected final Topic topic; protected final Permission permission; /** * Access rights */ enum Permission { READ, WRITE, READWRITE } Authorization(Topic topic) { this(topic, Permission.READWRITE); } Authorization(Topic topic, Permission permission) { this.topic = topic; this.permission = permission; } public boolean grant(Permission desiredPermission) { return permission == desiredPermission || permission == READWRITE; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Authorization that = (Authorization) o; if (permission != that.permission) return false; if (!topic.equals(that.topic)) return false; return true; } @Override public int hashCode() { int result = topic.hashCode(); result = 31 * result + permission.hashCode(); return result; } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/security/AuthorizationsCollector.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl.security; import io.moquette.spi.impl.subscriptions.Topic; import io.moquette.spi.security.IAuthorizator; import java.text.ParseException; import java.util.*; /** * Used by the ACLFileParser to push all authorizations it finds. ACLAuthorizator uses it in read * mode to check it topics matches the ACLs. * * Not thread safe. */ class AuthorizationsCollector implements IAuthorizator { private List m_globalAuthorizations = new ArrayList<>(); private List m_patternAuthorizations = new ArrayList<>(); private Map> m_userAuthorizations = new HashMap<>(); private boolean m_parsingUsersSpecificSection; private boolean m_parsingPatternSpecificSection; private String m_currentUser = ""; static final AuthorizationsCollector emptyImmutableCollector() { AuthorizationsCollector coll = new AuthorizationsCollector(); coll.m_globalAuthorizations = Collections.emptyList(); coll.m_patternAuthorizations = Collections.emptyList(); coll.m_userAuthorizations = Collections.emptyMap(); return coll; } void parse(String line) throws ParseException { Authorization acl = parseAuthLine(line); if (acl == null) { // skip it's a user return; } if (m_parsingUsersSpecificSection) { // TODO in java 8 switch to m_userAuthorizations.putIfAbsent(m_currentUser, new // ArrayList()); if (!m_userAuthorizations.containsKey(m_currentUser)) { m_userAuthorizations.put(m_currentUser, new ArrayList()); } List userAuths = m_userAuthorizations.get(m_currentUser); userAuths.add(acl); } else if (m_parsingPatternSpecificSection) { m_patternAuthorizations.add(acl); } else { m_globalAuthorizations.add(acl); } } protected Authorization parseAuthLine(String line) throws ParseException { String[] tokens = line.split("\\s+"); String keyword = tokens[0].toLowerCase(); switch (keyword) { case "topic": return createAuthorization(line, tokens); case "user": m_parsingUsersSpecificSection = true; m_currentUser = tokens[1]; m_parsingPatternSpecificSection = false; return null; case "pattern": m_parsingUsersSpecificSection = false; m_currentUser = ""; m_parsingPatternSpecificSection = true; return createAuthorization(line, tokens); default: throw new ParseException(String.format("invalid line definition found %s", line), 1); } } private Authorization createAuthorization(String line, String[] tokens) throws ParseException { if (tokens.length > 2) { // if the tokenized lines has 3 token the second must be the permission try { Authorization.Permission permission = Authorization.Permission.valueOf(tokens[1].toUpperCase()); // bring topic with all original spacing Topic topic = new Topic(line.substring(line.indexOf(tokens[2]))); return new Authorization(topic, permission); } catch (IllegalArgumentException iaex) { throw new ParseException("invalid permission token", 1); } } Topic topic = new Topic(tokens[1]); return new Authorization(topic); } @Override public boolean canWrite(Topic topic, String user, String client) { return canDoOperation(topic, Authorization.Permission.WRITE, user, client); } @Override public boolean canRead(Topic topic, String user, String client) { return canDoOperation(topic, Authorization.Permission.READ, user, client); } private boolean canDoOperation(Topic topic, Authorization.Permission permission, String username, String client) { if (matchACL(m_globalAuthorizations, topic, permission)) { return true; } if (isNotEmpty(client) || isNotEmpty(username)) { for (Authorization auth : m_patternAuthorizations) { Topic substitutedTopic = new Topic(auth.topic.toString().replace("%c", client).replace("%u", username)); if (auth.grant(permission)) { if (topic.match(substitutedTopic)) { return true; } } } } if (isNotEmpty(username)) { if (m_userAuthorizations.containsKey(username)) { List auths = m_userAuthorizations.get(username); if (matchACL(auths, topic, permission)) { return true; } } } return false; } private boolean matchACL(List auths, Topic topic, Authorization.Permission permission) { for (Authorization auth : auths) { if (auth.grant(permission)) { if (topic.match(auth.topic)) { return true; } } } return false; } private boolean isNotEmpty(String client) { return client != null && !client.isEmpty(); } public boolean isEmpty() { return m_globalAuthorizations.isEmpty(); } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/security/DBAuthenticator.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl.security; import io.moquette.BrokerConstants; import io.moquette.server.config.IConfig; import io.moquette.spi.security.IAuthenticator; import org.apache.commons.codec.binary.Hex; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import win.liyufan.im.Utility; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.sql.*; /** * Load user credentials from a SQL database. sql driver must be provided at runtime */ public class DBAuthenticator implements IAuthenticator { private static final Logger LOG = LoggerFactory.getLogger(DBAuthenticator.class); private final MessageDigest messageDigest; private final PreparedStatement preparedStatement; public DBAuthenticator(IConfig conf) { this( conf.getProperty(BrokerConstants.DB_AUTHENTICATOR_DRIVER, ""), conf.getProperty(BrokerConstants.DB_AUTHENTICATOR_URL, ""), conf.getProperty(BrokerConstants.DB_AUTHENTICATOR_QUERY, ""), conf.getProperty(BrokerConstants.DB_AUTHENTICATOR_DIGEST, "")); } /** * provide authenticator from SQL database * * @param driver * : jdbc driver class like : "org.postgresql.Driver" * @param jdbcUrl * : jdbc url like : "jdbc:postgresql://host:port/dbname" * @param sqlQuery * : sql query like : "SELECT PASSWORD FROM USER WHERE LOGIN=?" * @param digestMethod * : password encoding algorithm : "MD5", "SHA-1", "SHA-256" */ public DBAuthenticator(String driver, String jdbcUrl, String sqlQuery, String digestMethod) { try { Class.forName(driver); final Connection connection = DriverManager.getConnection(jdbcUrl); this.messageDigest = MessageDigest.getInstance(digestMethod); this.preparedStatement = connection.prepareStatement(sqlQuery); } catch (ClassNotFoundException cnfe) { LOG.error(String.format("Can't find driver %s", driver), cnfe); throw new RuntimeException(cnfe); } catch (SQLException sqle) { LOG.error(String.format("Can't connect to %s", jdbcUrl), sqle); throw new RuntimeException(sqle); } catch (NoSuchAlgorithmException nsaex) { LOG.error(String.format("Can't find %s for password encoding", digestMethod), nsaex); throw new RuntimeException(nsaex); } } @Override public synchronized boolean checkValid(String clientId, String username, byte[] password) { // Check Username / Password in DB using sqlQuery if (username == null || password == null) { LOG.info("username or password was null"); return false; } ResultSet r = null; try { this.preparedStatement.setString(1, username); r = this.preparedStatement.executeQuery(); if (r.next()) { final String foundPwq = r.getString(1); messageDigest.update(password); byte[] digest = messageDigest.digest(); String encodedPasswd = new String(Hex.encodeHex(digest)); return foundPwq.equals(encodedPasswd); } r.close(); } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } return false; } @Override protected void finalize() throws Throwable { this.preparedStatement.close(); this.preparedStatement.getConnection().close(); super.finalize(); } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/security/DenyAllAuthorizator.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl.security; import io.moquette.spi.impl.subscriptions.Topic; import io.moquette.spi.security.IAuthorizator; public class DenyAllAuthorizator implements IAuthorizator { @Override public boolean canWrite(Topic topic, String user, String client) { return true; } @Override public boolean canRead(Topic topic, String user, String client) { return true; } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/security/FileAuthenticator.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl.security; import io.moquette.server.config.FileResourceLoader; /** * Load user credentials from a text file. Each line of the file is formatted as * "[username]:[sha256(password)]". The username mustn't contains : char. * * To encode your password from command line on Linux systems, you could use: * *
 *     echo -n "yourpassword" | sha256sum
 * 
* * NB -n is important because echo append a newline by default at the of string. -n avoid this * behaviour. * * @deprecated user {@link ResourceAuthenticator} instead */ public class FileAuthenticator extends ResourceAuthenticator { public FileAuthenticator(String parent, String filePath) { super(new FileResourceLoader(parent), filePath); } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/security/ITokenGenerator.java ================================================ package io.moquette.spi.impl.security; public interface ITokenGenerator { public String generateToken(String username); } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/security/PermitAllAuthorizator.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl.security; import io.moquette.spi.impl.subscriptions.Topic; import io.moquette.spi.security.IAuthorizator; public class PermitAllAuthorizator implements IAuthorizator { @Override public boolean canWrite(Topic topic, String user, String client) { return true; } @Override public boolean canRead(Topic topic, String user, String client) { return true; } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/security/ResourceAuthenticator.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl.security; import io.moquette.server.config.IResourceLoader; import io.moquette.spi.security.IAuthenticator; import org.apache.commons.codec.digest.DigestUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.ParseException; import java.util.HashMap; import java.util.Map; /** * Load user credentials from a text resource. Each line of the file is formatted as * "[username]:[sha256(password)]". The username mustn't contains : char. * * To encode your password from command line on Linux systems, you could use: * *
 *     echo -n "yourpassword" | sha256sum
 * 
* * NB -n is important because echo append a newline by default at the of string. -n avoid this * behaviour. */ public class ResourceAuthenticator implements IAuthenticator { protected static final Logger LOG = LoggerFactory.getLogger(ResourceAuthenticator.class); private Map m_identities = new HashMap<>(); public ResourceAuthenticator(IResourceLoader resourceLoader, String resourceName) { try { MessageDigest.getInstance("SHA-256"); } catch (NoSuchAlgorithmException nsaex) { LOG.error("Can't find SHA-256 for password encoding", nsaex); throw new RuntimeException(nsaex); } LOG.info(String.format("Loading password %s %s", resourceLoader.getName(), resourceName)); Reader reader = null; try { reader = resourceLoader.loadResource(resourceName); if (reader == null) { LOG.warn(String.format("Parsing not existing %s %s", resourceLoader.getName(), resourceName)); } else { parse(reader); } } catch (IResourceLoader.ResourceIsDirectoryException e) { LOG.warn(String.format("Trying to parse directory %s", resourceName)); } catch (ParseException pex) { LOG.warn( String.format("Format error in parsing password %s %s", resourceLoader.getName(), resourceName), pex); } } private void parse(Reader reader) throws ParseException { if (reader == null) { return; } BufferedReader br = new BufferedReader(reader); String line; try { while ((line = br.readLine()) != null) { int commentMarker = line.indexOf('#'); if (commentMarker != -1) { if (commentMarker == 0) { // skip its a comment continue; } else { // it's a malformed comment throw new ParseException(line, commentMarker); } } else { if (line.isEmpty() || line.matches("^\\s*$")) { // skip it's a black line continue; } // split till the first space int delimiterIdx = line.indexOf(':'); String username = line.substring(0, delimiterIdx).trim(); String password = line.substring(delimiterIdx + 1).trim(); m_identities.put(username, password); } } } catch (IOException ex) { throw new ParseException("Failed to read", 1); } } @Override public boolean checkValid(String clientId, String username, byte[] password) { if (username == null || password == null) { LOG.info("username or password was null"); return false; } String foundPwq = m_identities.get(username); if (foundPwq == null) { return false; } String encodedPasswd = DigestUtils.sha256Hex(password); return foundPwq.equals(encodedPasswd); } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/security/TokenAuthenticator.java ================================================ package io.moquette.spi.impl.security; import java.io.IOException; import io.moquette.spi.security.IAuthenticator; import io.moquette.spi.security.Tokenor; public class TokenAuthenticator implements IAuthenticator, ITokenGenerator { public static void main(String[] args) throws IOException { TokenAuthenticator authenticator = new TokenAuthenticator(); String strToken = authenticator.generateToken("user1"); if (authenticator.checkValid(null, "user1", strToken.getBytes())) { System.out.println("pass" + strToken); } else { System.out.println("fail" + strToken); } } @Override public boolean checkValid(String clientId, String username, byte[] password) { String id = Tokenor.getUserId(password); if (id != null && id.equals(username)) { return true; } return false; } @Override public String generateToken(String username) { return Tokenor.getToken(username); } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/subscriptions/Token.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl.subscriptions; /** * Internal use only class. */ public class Token { static final Token EMPTY = new Token(""); static final Token MULTI = new Token("#"); static final Token SINGLE = new Token("+"); final String name; protected Token(String s) { name = s; } protected String name() { return name; } protected boolean match(Token t) { if (t == MULTI || t == SINGLE) { return false; } if (this == MULTI || this == SINGLE) { return true; } return equals(t); } @Override public int hashCode() { int hash = 7; hash = 29 * hash + (this.name != null ? this.name.hashCode() : 0); return hash; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final Token other = (Token) obj; if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) { return false; } return true; } @Override public String toString() { return name; } } ================================================ FILE: broker/src/main/java/io/moquette/spi/impl/subscriptions/Topic.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.impl.subscriptions; import java.io.Serializable; import java.text.ParseException; import java.util.ArrayList; import java.util.List; import java.util.Objects; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Topic implements Serializable { private static final Logger LOG = LoggerFactory.getLogger(Topic.class); private static final long serialVersionUID = 2438799283749822L; private final String topic; private transient List tokens; private transient boolean valid; public Topic(String topic) { this.topic = topic; } public String getTopic() { return topic; } public List getTokens() { if (tokens == null) { try { tokens = parseTopic(topic); valid = true; } catch (ParseException e) { valid = false; LOG.error("Error parsing the topic: {}, message: {}", topic, e.getMessage()); } } return tokens; } private List parseTopic(String topic) throws ParseException { List res = new ArrayList<>(); String[] splitted = topic.split("/"); if (splitted.length == 0) { res.add(Token.EMPTY); } if (topic.endsWith("/")) { // Add a fictious space String[] newSplitted = new String[splitted.length + 1]; System.arraycopy(splitted, 0, newSplitted, 0, splitted.length); newSplitted[splitted.length] = ""; splitted = newSplitted; } for (int i = 0; i < splitted.length; i++) { String s = splitted[i]; if (s.isEmpty()) { // if (i != 0) { // throw new ParseException("Bad format of topic, expetec topic name between // separators", i); // } res.add(Token.EMPTY); } else if (s.equals("#")) { // check that multi is the last symbol if (i != splitted.length - 1) { throw new ParseException( "Bad format of topic, the multi symbol (#) has to be the last one after a separator", i); } res.add(Token.MULTI); } else if (s.contains("#")) { throw new ParseException("Bad format of topic, invalid subtopic name: " + s, i); } else if (s.equals("+")) { res.add(Token.SINGLE); } else if (s.contains("+")) { throw new ParseException("Bad format of topic, invalid subtopic name: " + s, i); } else { res.add(new Token(s)); } } return res; } public boolean isValid() { if (tokens == null) getTokens(); return valid; } /** * Verify if the 2 topics matching respecting the rules of MQTT Appendix A * * @param subscriptionTopic * the topic filter of the subscription * @return true if the two topics match. */ // TODO reimplement with iterators or with queues public boolean match(Topic subscriptionTopic) { List msgTokens = getTokens(); List subscriptionTokens = subscriptionTopic.getTokens(); int i = 0; for (; i < subscriptionTokens.size(); i++) { Token subToken = subscriptionTokens.get(i); if (subToken != Token.MULTI && subToken != Token.SINGLE) { if (i >= msgTokens.size()) { return false; } Token msgToken = msgTokens.get(i); if (!msgToken.equals(subToken)) { return false; } } else { if (subToken == Token.MULTI) { return true; } if (subToken == Token.SINGLE) { // skip a step forward } } } // if last token was a SINGLE then treat it as an empty // if (subToken == Token.SINGLE && (i - msgTokens.size() == 1)) { // i--; // } return i == msgTokens.size(); } @Override public String toString() { return topic; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Topic other = (Topic) obj; return Objects.equals(this.topic, other.topic); } @Override public int hashCode() { return topic.hashCode(); } /** * Factory method * */ public static Topic asTopic(String s) { return new Topic(s); } } ================================================ FILE: broker/src/main/java/io/moquette/spi/security/DES.java ================================================ package io.moquette.spi.security; import javax.crypto.*; import javax.crypto.spec.DESKeySpec; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.spec.InvalidKeySpecException; import java.util.Base64; public class DES { private static final String Encrypt_Password = "abcdefgh"; private static byte[] iv = { 1, 2, 3, 4, 5, 6, 7, 8 }; private static byte[] aes_key= {0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x78,0x79,0x7A,0x7B,0x7C,0x7D,0x7E,0x7F}; public static String decryptDES(String decryptString) throws Exception { byte[] byteMi = Base64.getDecoder().decode(decryptString); IvParameterSpec zeroIv = new IvParameterSpec(iv); SecretKeySpec key = new SecretKeySpec(Encrypt_Password.getBytes(), "DES"); Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, key, zeroIv); byte decryptedData[] = cipher.doFinal(byteMi); return new String(decryptedData); } public static void init(byte[] secret) { if (secret != null && secret.length == 16) { aes_key = new byte[16]; for (int i = 0; i < 16; i++) { aes_key[i] = secret[i]; } } else { System.out.println("Error int key error, secret incorrect"); } } public static String encryptDES(String encryptString) throws Exception { IvParameterSpec zeroIv = new IvParameterSpec(iv); SecretKeySpec key = new SecretKeySpec(Encrypt_Password.getBytes(), "DES"); Cipher cipher = Cipher.getInstance("DES/CBC/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, key, zeroIv); byte[] encryptedData = cipher.doFinal(encryptString.getBytes()); return new String(Base64.getEncoder().encode(encryptedData)); } public static byte[] encrypt(byte[] datasource) throws InvalidKeyException, NoSuchAlgorithmException, InvalidKeySpecException, NoSuchPaddingException, IllegalBlockSizeException, BadPaddingException { SecureRandom random = new SecureRandom(); DESKeySpec desKey = new DESKeySpec(Encrypt_Password.getBytes()); // 创建一个密匙工厂,然后用它把DESKeySpec转换成 SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); SecretKey securekey = keyFactory.generateSecret(desKey); // Cipher对象实际完成加密操作 Cipher cipher = Cipher.getInstance("DES"); // 用密匙初始化Cipher对象 cipher.init(Cipher.ENCRYPT_MODE, securekey, random); // 现在,获取数据并加密 // 正式执行加密操作 return cipher.doFinal(datasource); } /** * 解密 * * @param src * byte[] * String * @return byte[] * @throws Exception */ public static byte[] decrypt(byte[] src) throws Exception { // DES算法要求有一个可信任的随机数源 SecureRandom random = new SecureRandom(); // 创建一个DESKeySpec对象 DESKeySpec desKey = new DESKeySpec(Encrypt_Password.getBytes()); // 创建一个密匙工厂 SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); // 将DESKeySpec对象转换成SecretKey对象 SecretKey securekey = keyFactory.generateSecret(desKey); // Cipher对象实际完成解密操作 Cipher cipher = Cipher.getInstance("DES"); // 用密匙初始化Cipher对象 cipher.init(Cipher.DECRYPT_MODE, securekey, random); // 真正开始解密操作 return cipher.doFinal(src); } public static byte[] AESEncrypt(String sSrc, String userKey) { return AESEncrypt(sSrc.getBytes(), userKey); } public static byte[] AESEncrypt(byte[] tobeencrypdata, byte[] aesKey) { if (aesKey == null) { System.out.print("Key为空null"); return null; } // 判断Key是否为16位 if (aesKey.length != 16) { System.out.print("Key长度不是16位"); return null; } try { SecretKeySpec skeySpec = new SecretKeySpec(aesKey, "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");//"算法/模式/补码方式" IvParameterSpec iv = new IvParameterSpec(aesKey);//使用CBC模式,需要一个向量iv,可增加加密算法的强度 cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); //2018.1.1 0:0:0 以来的小时数 int curhour = (int) ((System.currentTimeMillis()/1000 - 1514736000)/3600); byte[] tobeencrypdatawithtime = new byte[tobeencrypdata.length + 4]; byte byte0 = (byte)(curhour & 0xFF); tobeencrypdatawithtime[0] = byte0; byte byte1 = (byte)((curhour & 0xFF00) >> 8); tobeencrypdatawithtime[1] = byte1; byte byte2 = (byte)((curhour & 0xFF0000) >> 16); tobeencrypdatawithtime[2] = byte2; byte byte3 = (byte)((curhour & 0xFF) >> 24); tobeencrypdatawithtime[3] = byte3; System.arraycopy(tobeencrypdata, 0, tobeencrypdatawithtime, 4, tobeencrypdata.length); byte[] encrypted = cipher.doFinal(tobeencrypdatawithtime); return encrypted; } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (NoSuchPaddingException e) { e.printStackTrace(); } catch (InvalidKeyException e) { e.printStackTrace(); } catch (InvalidAlgorithmParameterException e) { e.printStackTrace(); } catch (IllegalBlockSizeException e) { e.printStackTrace(); } catch (BadPaddingException e) { e.printStackTrace(); } return null; } public static byte[] AESEncrypt(byte[] tobeencrypdata, String userKey) { byte[] aesKey = aes_key; if (userKey != null && !userKey.isEmpty()) { aesKey = convertUserKey(userKey); } return AESEncrypt(tobeencrypdata, aesKey); } public static int getUnsignedByte (byte data){ //将data字节型数据转换为0~255 (0xFF 即BYTE)。 return data&0x0FF ; } private static byte[] convertUserKey(String userKey) { byte[] key = new byte[16]; for (int i = 0; i < 16; i++) { key[i] = (byte) (userKey.charAt(i) & 0xFF); } return key; } public static byte[] AESDecrypt(byte[] sSrc, String userKey, boolean checkTime) { try { byte[] aesKey = aes_key; if (userKey != null && !userKey.isEmpty()) { aesKey = convertUserKey(userKey); } // 判断Key是否正确 if (aesKey == null) { System.out.print("Key为空null"); return null; } // 判断Key是否为16位 if (aesKey.length != 16) { System.out.print("Key长度不是16位"); return null; } SecretKeySpec skeySpec = new SecretKeySpec(aesKey, "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); IvParameterSpec iv = new IvParameterSpec(aesKey); cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv); try { byte[] original = cipher.doFinal(sSrc); int hours = 0; if (original.length > 4) { hours += getUnsignedByte(original[3]); hours <<= 8; hours += getUnsignedByte(original[2]); hours <<= 8; hours += getUnsignedByte(original[1]); hours <<= 8; hours += getUnsignedByte(original[0]); //2018.1.1 0:0:0 以来的小时数 int curhour = (int) ((System.currentTimeMillis()/1000 - 1514736000)/3600); if (curhour - hours > 24 && checkTime) { return null; } byte[] neworiginal = new byte[original.length - 4]; System.arraycopy(original, 4, neworiginal, 0, neworiginal.length); return neworiginal; } return null; } catch (Exception e) { System.out.println(e.toString()); return null; } } catch (Exception ex) { System.out.println(ex.toString()); return null; } } } ================================================ FILE: broker/src/main/java/io/moquette/spi/security/IAuthenticator.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.security; /** * username and password checker */ public interface IAuthenticator { boolean checkValid(String clientId, String username, byte[] password); } ================================================ FILE: broker/src/main/java/io/moquette/spi/security/IAuthorizator.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.security; import io.moquette.spi.impl.subscriptions.Topic; /** * ACL checker. * * Create an authorizator that matches topic names with same grammar of subscriptions. The # is * always a terminator and its the multilevel matcher. The + sign is the single level matcher. */ public interface IAuthorizator { /** * Ask the implementation of the authorizator if the topic can be used in a publish. * * @param topic * the topic to write to. * @param user * the user * @param client * the client * @return true if the user from client can publish data on topic. */ boolean canWrite(Topic topic, String user, String client); boolean canRead(Topic topic, String user, String client); } ================================================ FILE: broker/src/main/java/io/moquette/spi/security/ISslContextCreator.java ================================================ /* * Copyright (c) 2012-2017 The original author or authors * ------------------------------------------------------ * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * and Apache License v2.0 which accompanies this distribution. * * The Eclipse Public License is available at * http://www.eclipse.org/legal/epl-v10.html * * The Apache License v2.0 is available at * http://www.opensource.org/licenses/apache2.0.php * * You may elect to redistribute this code under either of these licenses. */ package io.moquette.spi.security; import javax.net.ssl.SSLContext; /** * SSL certificate loader used to open SSL connections (websocket and MQTT-S). */ public interface ISslContextCreator { SSLContext initSSLContext(); } ================================================ FILE: broker/src/main/java/io/moquette/spi/security/Tokenor.java ================================================ package io.moquette.spi.security; import com.hazelcast.util.StringUtil; import io.moquette.spi.impl.security.AES; public class Tokenor { private static String KEY = "testim"; private static long expiredTime = Long.MAX_VALUE; public static void setKey(String key) { if (!StringUtil.isNullOrEmpty(key)) { KEY = key; } } public static void setExpiredTime(long expiredTime) { Tokenor.expiredTime = expiredTime; } public static String getUserId(byte[] password) { try { String signKey = DES.decryptDES(new String(password)); if (signKey.startsWith(KEY + "|")) { signKey = signKey.substring(KEY.length() + 1); long timestamp = Long.parseLong(signKey.substring(0, signKey.indexOf('|'))); if (expiredTime > 0 && System.currentTimeMillis() - timestamp > expiredTime) { return null; } String id = signKey.substring(signKey.indexOf('|') + 1); return id; } } catch (Exception e) { // TODO Auto-generated catch block //e.printStackTrace(); } return null; } public static String getToken(String username) { String signKey = KEY + "|" + (System.currentTimeMillis()) + "|" + username; try { return DES.encryptDES(signKey); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return null; } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttCodecUtil.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.DecoderException; import io.netty.util.Attribute; import io.netty.util.AttributeKey; final class MqttCodecUtil { private static final char[] TOPIC_WILDCARDS = {'#', '+'}; static final AttributeKey MQTT_VERSION_KEY = AttributeKey.valueOf("NETTY_CODEC_MQTT_VERSION"); static MqttVersion getMqttVersion(ChannelHandlerContext ctx) { Attribute attr = ctx.channel().attr(MQTT_VERSION_KEY); MqttVersion version = attr.get(); if (version == null) { return MqttVersion.MQTT_3_1_1; } return version; } static void setMqttVersion(ChannelHandlerContext ctx, MqttVersion version) { Attribute attr = ctx.channel().attr(MQTT_VERSION_KEY); attr.set(version); } static boolean isValidPublishTopicName(String topicName) { // publish topic name must not contain any wildcard for (char c : TOPIC_WILDCARDS) { if (topicName.indexOf(c) >= 0) { return false; } } return true; } static boolean isValidMessageId(int messageId) { return messageId != 0; } static boolean isValidClientId(MqttVersion mqttVersion, int maxClientIdLength, String clientId) { if (mqttVersion == MqttVersion.MQTT_3_1) { return clientId != null && clientId.length() >= MqttConstant.MIN_CLIENT_ID_LENGTH && clientId.length() <= maxClientIdLength; } if (mqttVersion.protocolLevel() >= MqttVersion.MQTT_3_1_1.protocolLevel()) { // In 3.1.3.1 Client Identifier of MQTT 3.1.1 and 5.0 specifications, The Server MAY allow ClientId’s // that contain more than 23 encoded bytes. And, The Server MAY allow zero-length ClientId. return clientId != null; } throw new IllegalArgumentException(mqttVersion + " is unknown mqtt version"); } static MqttFixedHeader validateFixedHeader(ChannelHandlerContext ctx, MqttFixedHeader mqttFixedHeader) { switch (mqttFixedHeader.messageType()) { case PUBREL: case SUBSCRIBE: case UNSUBSCRIBE: if (mqttFixedHeader.qosLevel() != MqttQoS.AT_LEAST_ONCE) { throw new DecoderException(mqttFixedHeader.messageType().name() + " message must have QoS 1"); } return mqttFixedHeader; case AUTH: if (MqttCodecUtil.getMqttVersion(ctx) != MqttVersion.MQTT_5) { throw new DecoderException("AUTH message requires at least MQTT 5"); } return mqttFixedHeader; default: return mqttFixedHeader; } } static MqttFixedHeader resetUnusedFields(MqttFixedHeader mqttFixedHeader) { switch (mqttFixedHeader.messageType()) { case CONNECT: case CONNACK: case PUBACK: case PUBREC: case PUBCOMP: case SUBACK: case UNSUBACK: case PINGREQ: case PINGRESP: case DISCONNECT: if (mqttFixedHeader.isDup() || mqttFixedHeader.qosLevel() != MqttQoS.AT_MOST_ONCE || mqttFixedHeader.isRetain()) { return new MqttFixedHeader( mqttFixedHeader.messageType(), false, MqttQoS.AT_MOST_ONCE, false, mqttFixedHeader.remainingLength()); } return mqttFixedHeader; case PUBREL: case SUBSCRIBE: case UNSUBSCRIBE: if (mqttFixedHeader.isRetain()) { return new MqttFixedHeader( mqttFixedHeader.messageType(), mqttFixedHeader.isDup(), mqttFixedHeader.qosLevel(), false, mqttFixedHeader.remainingLength()); } return mqttFixedHeader; default: return mqttFixedHeader; } } private MqttCodecUtil() { } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttConnAckMessage.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; /** * See MQTTV3.1/connack */ public final class MqttConnAckMessage extends MqttMessage { public MqttConnAckMessage(MqttFixedHeader mqttFixedHeader, MqttConnAckVariableHeader variableHeader) { super(mqttFixedHeader, variableHeader); } public MqttConnAckMessage(MqttFixedHeader mqttFixedHeader, MqttConnAckVariableHeader variableHeader, MqttConnectAckPayload payload) { super(mqttFixedHeader, variableHeader, payload); } @Override public MqttConnAckVariableHeader variableHeader() { return (MqttConnAckVariableHeader) super.variableHeader(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttConnAckVariableHeader.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.StringUtil; /** * Variable header of {@link MqttConnectMessage} */ public final class MqttConnAckVariableHeader { private final MqttConnectReturnCode connectReturnCode; private final boolean sessionPresent; private final MqttProperties properties; public MqttConnAckVariableHeader(MqttConnectReturnCode connectReturnCode, boolean sessionPresent) { this(connectReturnCode, sessionPresent, MqttProperties.NO_PROPERTIES); } public MqttConnAckVariableHeader(MqttConnectReturnCode connectReturnCode, boolean sessionPresent, MqttProperties properties) { this.connectReturnCode = connectReturnCode; this.sessionPresent = sessionPresent; this.properties = MqttProperties.withEmptyDefaults(properties); } public MqttConnectReturnCode connectReturnCode() { return connectReturnCode; } public boolean isSessionPresent() { return sessionPresent; } public MqttProperties properties() { return properties; } @Override public String toString() { return new StringBuilder(StringUtil.simpleClassName(this)) .append('[') .append("connectReturnCode=").append(connectReturnCode) .append(", sessionPresent=").append(sessionPresent) .append(']') .toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttConnectAckPayload.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.StringUtil; /** * Payload of {@link MqttConnectMessage} */ public final class MqttConnectAckPayload { private final byte[] data; public MqttConnectAckPayload( byte[] data) { this.data = data; } public byte[] getData() { return data; } @Override public String toString() { return new StringBuilder(StringUtil.simpleClassName(this)) .append('[') .append("data=").append(data) .append(']') .toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttConnectMessage.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; /** * See MQTTV3.1/connect */ public final class MqttConnectMessage extends MqttMessage { public MqttConnectMessage( MqttFixedHeader mqttFixedHeader, MqttConnectVariableHeader variableHeader, MqttConnectPayload payload) { super(mqttFixedHeader, variableHeader, payload); } @Override public MqttConnectVariableHeader variableHeader() { return (MqttConnectVariableHeader) super.variableHeader(); } @Override public MqttConnectPayload payload() { return (MqttConnectPayload) super.payload(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttConnectPayload.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import java.util.Arrays; import io.netty.util.CharsetUtil; import io.netty.util.internal.StringUtil; /** * Payload of {@link MqttConnectMessage} */ public final class MqttConnectPayload { private final String clientIdentifier; private final MqttProperties willProperties; private final String willTopic; private final byte[] willMessage; private final String userName; private final byte[] password; private final byte[] signature; /** * @deprecated use {@link MqttConnectPayload#MqttConnectPayload(String, * MqttProperties, String, byte[], String, byte[])} instead */ @Deprecated public MqttConnectPayload( String clientIdentifier, String willTopic, String willMessage, String userName, String password) { this( clientIdentifier, MqttProperties.NO_PROPERTIES, willTopic, willMessage.getBytes(CharsetUtil.UTF_8), userName, password.getBytes(CharsetUtil.UTF_8), null); } public MqttConnectPayload( String clientIdentifier, String willTopic, byte[] willMessage, String userName, byte[] password) { this(clientIdentifier, MqttProperties.NO_PROPERTIES, willTopic, willMessage, userName, password, null); } public MqttConnectPayload( String clientIdentifier, MqttProperties willProperties, String willTopic, byte[] willMessage, String userName, byte[] password, byte[] signature) { this.clientIdentifier = clientIdentifier; this.willProperties = MqttProperties.withEmptyDefaults(willProperties); this.willTopic = willTopic; this.willMessage = willMessage; this.userName = userName; this.password = password; this.signature = signature; } public String clientIdentifier() { return clientIdentifier; } public MqttProperties willProperties() { return willProperties; } public String willTopic() { return willTopic; } /** * @deprecated use {@link MqttConnectPayload#willMessageInBytes()} instead */ @Deprecated public String willMessage() { return willMessage == null ? null : new String(willMessage, CharsetUtil.UTF_8); } public byte[] willMessageInBytes() { return willMessage; } public String userName() { return userName; } /** * @deprecated use {@link MqttConnectPayload#passwordInBytes()} instead */ @Deprecated public String password() { return password == null ? null : new String(password, CharsetUtil.UTF_8); } public byte[] passwordInBytes() { return password; } public byte[] signatureInBytes() { return signature; } @Override public String toString() { return new StringBuilder(StringUtil.simpleClassName(this)) .append('[') .append("clientIdentifier=").append(clientIdentifier) .append(", willTopic=").append(willTopic) .append(", willMessage=").append(Arrays.toString(willMessage)) .append(", userName=").append(userName) .append(", password=").append(Arrays.toString(password)) .append(']') .toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttConnectReturnCode.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; /** * Return Code of {@link MqttConnAckMessage} */ public enum MqttConnectReturnCode { CONNECTION_ACCEPTED((byte) 0x00), //MQTT 3 codes CONNECTION_REFUSED_UNACCEPTABLE_PROTOCOL_VERSION((byte) 0X01), CONNECTION_REFUSED_IDENTIFIER_REJECTED((byte) 0x02), CONNECTION_REFUSED_SERVER_UNAVAILABLE((byte) 0x03), CONNECTION_REFUSED_BAD_USER_NAME_OR_PASSWORD((byte) 0x04), CONNECTION_REFUSED_NOT_AUTHORIZED((byte) 0x05), CONNECTION_REFUSED_UNEXPECT_NODE((byte) 0X06), CONNECTION_REFUSED_SESSION_NOT_EXIST((byte) 0x07), CONNECTION_REFUSED_SIGNATURE_FAILURE((byte) 0x08), //MQTT 5 codes CONNECTION_REFUSED_UNSPECIFIED_ERROR((byte) 0x80), CONNECTION_REFUSED_MALFORMED_PACKET((byte) 0x81), CONNECTION_REFUSED_PROTOCOL_ERROR((byte) 0x82), CONNECTION_REFUSED_IMPLEMENTATION_SPECIFIC((byte) 0x83), CONNECTION_REFUSED_UNSUPPORTED_PROTOCOL_VERSION((byte) 0x84), CONNECTION_REFUSED_CLIENT_IDENTIFIER_NOT_VALID((byte) 0x85), CONNECTION_REFUSED_BAD_USERNAME_OR_PASSWORD((byte) 0x86), CONNECTION_REFUSED_NOT_AUTHORIZED_5((byte) 0x87), CONNECTION_REFUSED_SERVER_UNAVAILABLE_5((byte) 0x88), CONNECTION_REFUSED_SERVER_BUSY((byte) 0x89), CONNECTION_REFUSED_BANNED((byte) 0x8A), CONNECTION_REFUSED_BAD_AUTHENTICATION_METHOD((byte) 0x8C), CONNECTION_REFUSED_TOPIC_NAME_INVALID((byte) 0x90), CONNECTION_REFUSED_PACKET_TOO_LARGE((byte) 0x95), CONNECTION_REFUSED_QUOTA_EXCEEDED((byte) 0x97), CONNECTION_REFUSED_PAYLOAD_FORMAT_INVALID((byte) 0x99), CONNECTION_REFUSED_RETAIN_NOT_SUPPORTED((byte) 0x9A), CONNECTION_REFUSED_QOS_NOT_SUPPORTED((byte) 0x9B), CONNECTION_REFUSED_USE_ANOTHER_SERVER((byte) 0x9C), CONNECTION_REFUSED_SERVER_MOVED((byte) 0x9D), CONNECTION_REFUSED_CONNECTION_RATE_EXCEEDED((byte) 0x9F); private static final MqttConnectReturnCode[] VALUES; static { MqttConnectReturnCode[] values = values(); VALUES = new MqttConnectReturnCode[160]; for (MqttConnectReturnCode code : values) { final int unsignedByte = code.byteValue & 0xFF; // Suppress a warning about out of bounds access since the enum contains only correct values VALUES[unsignedByte] = code; // lgtm [java/index-out-of-bounds] } } private final byte byteValue; MqttConnectReturnCode(byte byteValue) { this.byteValue = byteValue; } public byte byteValue() { return byteValue; } public static MqttConnectReturnCode valueOf(byte b) { final int unsignedByte = b & 0xFF; MqttConnectReturnCode mqttConnectReturnCode = null; try { mqttConnectReturnCode = VALUES[unsignedByte]; } catch (ArrayIndexOutOfBoundsException ignored) { // no op } if (mqttConnectReturnCode == null) { throw new IllegalArgumentException("unknown connect return code: " + unsignedByte); } return mqttConnectReturnCode; } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttConnectVariableHeader.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.StringUtil; /** * Variable Header for the {@link MqttConnectMessage} */ public final class MqttConnectVariableHeader { private final String name; private final int version; private final boolean hasUserName; private final boolean hasPassword; private final boolean isWillRetain; private final int willQos; private final boolean isWillFlag; private final boolean isCleanSession; private final int keepAliveTimeSeconds; private final MqttProperties properties; public MqttConnectVariableHeader( String name, int version, boolean hasUserName, boolean hasPassword, boolean isWillRetain, int willQos, boolean isWillFlag, boolean isCleanSession, int keepAliveTimeSeconds) { this(name, version, hasUserName, hasPassword, isWillRetain, willQos, isWillFlag, isCleanSession, keepAliveTimeSeconds, MqttProperties.NO_PROPERTIES); } public MqttConnectVariableHeader( String name, int version, boolean hasUserName, boolean hasPassword, boolean isWillRetain, int willQos, boolean isWillFlag, boolean isCleanSession, int keepAliveTimeSeconds, MqttProperties properties) { this.name = name; this.version = version; this.hasUserName = hasUserName; this.hasPassword = hasPassword; this.isWillRetain = isWillRetain; this.willQos = willQos; this.isWillFlag = isWillFlag; this.isCleanSession = isCleanSession; this.keepAliveTimeSeconds = keepAliveTimeSeconds; this.properties = MqttProperties.withEmptyDefaults(properties); } public String name() { return name; } public int version() { return version; } public boolean hasUserName() { return hasUserName; } public boolean hasPassword() { return hasPassword; } public boolean isWillRetain() { return isWillRetain; } public int willQos() { return willQos; } public boolean isWillFlag() { return isWillFlag; } public boolean isCleanSession() { return isCleanSession; } public int keepAliveTimeSeconds() { return keepAliveTimeSeconds; } public MqttProperties properties() { return properties; } @Override public String toString() { return new StringBuilder(StringUtil.simpleClassName(this)) .append('[') .append("name=").append(name) .append(", version=").append(version) .append(", hasUserName=").append(hasUserName) .append(", hasPassword=").append(hasPassword) .append(", isWillRetain=").append(isWillRetain) .append(", isWillFlag=").append(isWillFlag) .append(", isCleanSession=").append(isCleanSession) .append(", keepAliveTimeSeconds=").append(keepAliveTimeSeconds) .append(']') .toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttConstant.java ================================================ /* * Copyright 2021 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; public final class MqttConstant { private MqttConstant() { } /** * Default max bytes in message */ public static final int DEFAULT_MAX_BYTES_IN_MESSAGE = 262144; //256KB /** * min client id length */ public static final int MIN_CLIENT_ID_LENGTH = 1; /** * Default max client id length,In the mqtt3.1 protocol, * the default maximum Client Identifier length is 23 */ public static final int DEFAULT_MAX_CLIENT_ID_LENGTH = 23; } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.DecoderException; import io.netty.handler.codec.ReplayingDecoder; import io.netty.handler.codec.TooLongFrameException; import io.netty.util.CharsetUtil; import io.netty.util.internal.ObjectUtil; import java.util.ArrayList; import java.util.List; /** * Decodes Mqtt messages from bytes, following * the MQTT protocol specification * v3.1 * or * v5.0, depending on the * version specified in the CONNECT message that first goes through the channel. */ public final class MqttDecoder extends ReplayingDecoder { /** * States of the decoder. * We start at READ_FIXED_HEADER, followed by * READ_VARIABLE_HEADER and finally READ_PAYLOAD. */ enum DecoderState { READ_FIXED_HEADER, READ_VARIABLE_HEADER, READ_PAYLOAD, BAD_MESSAGE, } private MqttFixedHeader mqttFixedHeader; private Object variableHeader; private int bytesRemainingInVariablePart; private final int maxBytesInMessage; private final int maxClientIdLength; public MqttDecoder() { this(MqttConstant.DEFAULT_MAX_BYTES_IN_MESSAGE, MqttConstant.DEFAULT_MAX_CLIENT_ID_LENGTH); } public MqttDecoder(int maxBytesInMessage) { this(maxBytesInMessage, MqttConstant.DEFAULT_MAX_CLIENT_ID_LENGTH); } public MqttDecoder(int maxBytesInMessage, int maxClientIdLength) { super(DecoderState.READ_FIXED_HEADER); this.maxBytesInMessage = ObjectUtil.checkPositive(maxBytesInMessage, "maxBytesInMessage"); this.maxClientIdLength = ObjectUtil.checkPositive(maxClientIdLength, "maxClientIdLength"); } @Override protected void decode(ChannelHandlerContext ctx, ByteBuf buffer, List out) throws Exception { switch (state()) { case READ_FIXED_HEADER: try { mqttFixedHeader = decodeFixedHeader(ctx, buffer); bytesRemainingInVariablePart = mqttFixedHeader.remainingLength(); checkpoint(DecoderState.READ_VARIABLE_HEADER); // fall through } catch (Exception cause) { out.add(invalidMessage(cause)); return; } case READ_VARIABLE_HEADER: try { final Result decodedVariableHeader = decodeVariableHeader(ctx, buffer, mqttFixedHeader); variableHeader = decodedVariableHeader.value; if (bytesRemainingInVariablePart > maxBytesInMessage) { buffer.skipBytes(actualReadableBytes()); throw new TooLongFrameException("too large message: " + bytesRemainingInVariablePart + " bytes"); } bytesRemainingInVariablePart -= decodedVariableHeader.numberOfBytesConsumed; checkpoint(DecoderState.READ_PAYLOAD); // fall through } catch (Exception cause) { out.add(invalidMessage(cause)); return; } case READ_PAYLOAD: try { final Result decodedPayload = decodePayload( ctx, buffer, mqttFixedHeader.messageType(), bytesRemainingInVariablePart, maxClientIdLength, variableHeader); bytesRemainingInVariablePart -= decodedPayload.numberOfBytesConsumed; if (bytesRemainingInVariablePart != 0) { throw new DecoderException( "non-zero remaining payload bytes: " + bytesRemainingInVariablePart + " (" + mqttFixedHeader.messageType() + ')'); } checkpoint(DecoderState.READ_FIXED_HEADER); MqttMessage message = MqttMessageFactory.newMessage( mqttFixedHeader, variableHeader, decodedPayload.value); mqttFixedHeader = null; variableHeader = null; out.add(message); break; } catch (Exception cause) { out.add(invalidMessage(cause)); return; } case BAD_MESSAGE: // Keep discarding until disconnection. buffer.skipBytes(actualReadableBytes()); break; default: // Shouldn't reach here. throw new Error(); } } private MqttMessage invalidMessage(Throwable cause) { checkpoint(DecoderState.BAD_MESSAGE); return MqttMessageFactory.newInvalidMessage(mqttFixedHeader, variableHeader, cause); } /** * Decodes the fixed header. It's one byte for the flags and then variable * bytes for the remaining length. * * @see * ... * * @param buffer the buffer to decode from * @return the fixed header */ private static MqttFixedHeader decodeFixedHeader(ChannelHandlerContext ctx, ByteBuf buffer) { short b1 = buffer.readUnsignedByte(); MqttMessageType messageType = MqttMessageType.valueOf(b1 >> 4); boolean dupFlag = (b1 & 0x08) == 0x08; int qosLevel = (b1 & 0x06) >> 1; boolean retain = (b1 & 0x01) != 0; switch (messageType) { case PUBLISH: if (qosLevel == 3) { throw new DecoderException("Illegal QOS Level in fixed header of PUBLISH message (" + qosLevel + ')'); } break; case PUBREL: case SUBSCRIBE: case UNSUBSCRIBE: if (dupFlag) { throw new DecoderException("Illegal BIT 3 in fixed header of " + messageType + " message, must be 0, found 1"); } if (qosLevel != 1) { throw new DecoderException("Illegal QOS Level in fixed header of " + messageType + " message, must be 1, found " + qosLevel); } if (retain) { throw new DecoderException("Illegal BIT 0 in fixed header of " + messageType + " message, must be 0, found 1"); } break; case AUTH: case CONNACK: case CONNECT: case DISCONNECT: case PINGREQ: case PINGRESP: case PUBACK: case PUBCOMP: case PUBREC: case SUBACK: case UNSUBACK: if (dupFlag) { throw new DecoderException("Illegal BIT 3 in fixed header of " + messageType + " message, must be 0, found 1"); } if (qosLevel != 0) { throw new DecoderException("Illegal BIT 2 or 1 in fixed header of " + messageType + " message, must be 0, found " + qosLevel); } if (retain) { throw new DecoderException("Illegal BIT 0 in fixed header of " + messageType + " message, must be 0, found 1"); } break; default: throw new DecoderException("Unknown message type, do not know how to validate fixed header"); } int remainingLength = 0; int multiplier = 1; short digit; int loops = 0; do { digit = buffer.readUnsignedByte(); remainingLength += (digit & 127) * multiplier; multiplier *= 128; loops++; } while ((digit & 128) != 0 && loops < 4); // MQTT protocol limits Remaining Length to 4 bytes if (loops == 4 && (digit & 128) != 0) { throw new DecoderException("remaining length exceeds 4 digits (" + messageType + ')'); } MqttFixedHeader decodedFixedHeader = new MqttFixedHeader(messageType, dupFlag, MqttQoS.valueOf(qosLevel), retain, remainingLength); return MqttCodecUtil.validateFixedHeader(ctx, MqttCodecUtil.resetUnusedFields(decodedFixedHeader)); } /** * Decodes the variable header (if any) * @param buffer the buffer to decode from * @param mqttFixedHeader MqttFixedHeader of the same message * @return the variable header */ private Result decodeVariableHeader(ChannelHandlerContext ctx, ByteBuf buffer, MqttFixedHeader mqttFixedHeader) { switch (mqttFixedHeader.messageType()) { case CONNECT: return decodeConnectionVariableHeader(ctx, buffer); case CONNACK: return decodeConnAckVariableHeader(ctx, buffer); case UNSUBSCRIBE: case SUBSCRIBE: case SUBACK: case UNSUBACK: return decodeMessageIdAndPropertiesVariableHeader(ctx, buffer); case PUBACK: case PUBREC: case PUBCOMP: case PUBREL: return decodePubReplyMessage(buffer); case PUBLISH: return decodePublishVariableHeader(ctx, buffer, mqttFixedHeader); case DISCONNECT: case AUTH: return decodeReasonCodeAndPropertiesVariableHeader(buffer); case PINGREQ: case PINGRESP: // Empty variable header return new Result(null, 0); default: //shouldn't reach here throw new DecoderException("Unknown message type: " + mqttFixedHeader.messageType()); } } private static Result decodeConnectionVariableHeader( ChannelHandlerContext ctx, ByteBuf buffer) { final Result protoString = decodeString(buffer); int numberOfBytesConsumed = protoString.numberOfBytesConsumed; final byte protocolLevel = buffer.readByte(); numberOfBytesConsumed += 1; MqttVersion version = MqttVersion.fromProtocolNameAndLevel(protoString.value, protocolLevel); MqttCodecUtil.setMqttVersion(ctx, version); final int b1 = buffer.readUnsignedByte(); numberOfBytesConsumed += 1; final int keepAlive = decodeMsbLsb(buffer); numberOfBytesConsumed += 2; final boolean hasUserName = (b1 & 0x80) == 0x80; final boolean hasPassword = (b1 & 0x40) == 0x40; final boolean willRetain = (b1 & 0x20) == 0x20; final int willQos = (b1 & 0x18) >> 3; final boolean willFlag = (b1 & 0x04) == 0x04; final boolean cleanSession = (b1 & 0x02) == 0x02; if (version == MqttVersion.MQTT_3_1_1 || version == MqttVersion.MQTT_5) { final boolean zeroReservedFlag = (b1 & 0x01) == 0x0; if (!zeroReservedFlag) { // MQTT v3.1.1: The Server MUST validate that the reserved flag in the CONNECT Control Packet is // set to zero and disconnect the Client if it is not zero. // See https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349230 throw new DecoderException("non-zero reserved flag"); } } final MqttProperties properties; if (version == MqttVersion.MQTT_5) { final Result propertiesResult = decodeProperties(buffer); properties = propertiesResult.value; numberOfBytesConsumed += propertiesResult.numberOfBytesConsumed; } else { properties = MqttProperties.NO_PROPERTIES; } final MqttConnectVariableHeader mqttConnectVariableHeader = new MqttConnectVariableHeader( version.protocolName(), version.protocolLevel(), hasUserName, hasPassword, willRetain, willQos, willFlag, cleanSession, keepAlive, properties); return new Result(mqttConnectVariableHeader, numberOfBytesConsumed); } private static Result decodeConnAckVariableHeader( ChannelHandlerContext ctx, ByteBuf buffer) { final MqttVersion mqttVersion = MqttCodecUtil.getMqttVersion(ctx); final boolean sessionPresent = (buffer.readUnsignedByte() & 0x01) == 0x01; byte returnCode = buffer.readByte(); int numberOfBytesConsumed = 2; final MqttProperties properties; if (mqttVersion == MqttVersion.MQTT_5) { final Result propertiesResult = decodeProperties(buffer); properties = propertiesResult.value; numberOfBytesConsumed += propertiesResult.numberOfBytesConsumed; } else { properties = MqttProperties.NO_PROPERTIES; } final MqttConnAckVariableHeader mqttConnAckVariableHeader = new MqttConnAckVariableHeader(MqttConnectReturnCode.valueOf(returnCode), sessionPresent, properties); return new Result(mqttConnAckVariableHeader, numberOfBytesConsumed); } private static Result decodeMessageIdAndPropertiesVariableHeader( ChannelHandlerContext ctx, ByteBuf buffer) { final MqttVersion mqttVersion = MqttCodecUtil.getMqttVersion(ctx); final int packetId = decodeMessageId(buffer); final MqttMessageIdAndPropertiesVariableHeader mqttVariableHeader; final int mqtt5Consumed; if (mqttVersion == MqttVersion.MQTT_5) { final Result properties = decodeProperties(buffer); mqttVariableHeader = new MqttMessageIdAndPropertiesVariableHeader(packetId, properties.value); mqtt5Consumed = properties.numberOfBytesConsumed; } else { mqttVariableHeader = new MqttMessageIdAndPropertiesVariableHeader(packetId, MqttProperties.NO_PROPERTIES); mqtt5Consumed = 0; } return new Result(mqttVariableHeader, 2 + mqtt5Consumed); } private Result decodePubReplyMessage(ByteBuf buffer) { final int packetId = decodeMessageId(buffer); final MqttPubReplyMessageVariableHeader mqttPubAckVariableHeader; final int consumed; final int packetIdNumberOfBytesConsumed = 2; if (bytesRemainingInVariablePart > 3) { final byte reasonCode = buffer.readByte(); final Result properties = decodeProperties(buffer); mqttPubAckVariableHeader = new MqttPubReplyMessageVariableHeader(packetId, reasonCode, properties.value); consumed = packetIdNumberOfBytesConsumed + 1 + properties.numberOfBytesConsumed; } else if (bytesRemainingInVariablePart > 2) { final byte reasonCode = buffer.readByte(); mqttPubAckVariableHeader = new MqttPubReplyMessageVariableHeader(packetId, reasonCode, MqttProperties.NO_PROPERTIES); consumed = packetIdNumberOfBytesConsumed + 1; } else { mqttPubAckVariableHeader = new MqttPubReplyMessageVariableHeader(packetId, (byte) 0, MqttProperties.NO_PROPERTIES); consumed = packetIdNumberOfBytesConsumed; } return new Result(mqttPubAckVariableHeader, consumed); } private Result decodeReasonCodeAndPropertiesVariableHeader( ByteBuf buffer) { final byte reasonCode; final MqttProperties properties; final int consumed; if (bytesRemainingInVariablePart > 1) { reasonCode = buffer.readByte(); final Result propertiesResult = decodeProperties(buffer); properties = propertiesResult.value; consumed = 1 + propertiesResult.numberOfBytesConsumed; } else if (bytesRemainingInVariablePart > 0) { reasonCode = buffer.readByte(); properties = MqttProperties.NO_PROPERTIES; consumed = 1; } else { reasonCode = 0; properties = MqttProperties.NO_PROPERTIES; consumed = 0; } final MqttReasonCodeAndPropertiesVariableHeader mqttReasonAndPropsVariableHeader = new MqttReasonCodeAndPropertiesVariableHeader(reasonCode, properties); return new Result( mqttReasonAndPropsVariableHeader, consumed); } private Result decodePublishVariableHeader( ChannelHandlerContext ctx, ByteBuf buffer, MqttFixedHeader mqttFixedHeader) { final MqttVersion mqttVersion = MqttCodecUtil.getMqttVersion(ctx); final Result decodedTopic = decodeString(buffer); if (!MqttCodecUtil.isValidPublishTopicName(decodedTopic.value)) { throw new DecoderException("invalid publish topic name: " + decodedTopic.value + " (contains wildcards)"); } int numberOfBytesConsumed = decodedTopic.numberOfBytesConsumed; int messageId = -1; if (mqttFixedHeader.qosLevel().value() > 0) { messageId = decodeMessageId(buffer); numberOfBytesConsumed += 2; } final MqttProperties properties; if (mqttVersion == MqttVersion.MQTT_5) { final Result propertiesResult = decodeProperties(buffer); properties = propertiesResult.value; numberOfBytesConsumed += propertiesResult.numberOfBytesConsumed; } else { properties = MqttProperties.NO_PROPERTIES; } final MqttPublishVariableHeader mqttPublishVariableHeader = new MqttPublishVariableHeader(decodedTopic.value, messageId, properties); return new Result(mqttPublishVariableHeader, numberOfBytesConsumed); } /** * @return messageId with numberOfBytesConsumed is 2 */ private static int decodeMessageId(ByteBuf buffer) { final int messageId = decodeMsbLsb(buffer); if (!MqttCodecUtil.isValidMessageId(messageId)) { throw new DecoderException("invalid messageId: " + messageId); } return messageId; } /** * Decodes the payload. * * @param buffer the buffer to decode from * @param messageType type of the message being decoded * @param bytesRemainingInVariablePart bytes remaining * @param variableHeader variable header of the same message * @return the payload */ private static Result decodePayload( ChannelHandlerContext ctx, ByteBuf buffer, MqttMessageType messageType, int bytesRemainingInVariablePart, int maxClientIdLength, Object variableHeader) { switch (messageType) { case CONNECT: return decodeConnectionPayload(buffer, maxClientIdLength, (MqttConnectVariableHeader) variableHeader); case SUBSCRIBE: return decodeSubscribePayload(buffer, bytesRemainingInVariablePart); case SUBACK: return decodeSubackPayload(buffer, bytesRemainingInVariablePart); case UNSUBSCRIBE: return decodeUnsubscribePayload(buffer, bytesRemainingInVariablePart); case UNSUBACK: return decodeUnsubAckPayload(ctx, buffer, bytesRemainingInVariablePart); case PUBLISH: return decodePublishPayload(buffer, bytesRemainingInVariablePart); default: // unknown payload , no byte consumed return new Result(null, 0); } } private static Result decodeConnectionPayload( ByteBuf buffer, int maxClientIdLength, MqttConnectVariableHeader mqttConnectVariableHeader) { final Result decodedClientId = decodeString(buffer); final String decodedClientIdValue = decodedClientId.value; final MqttVersion mqttVersion = MqttVersion.fromProtocolNameAndLevel(mqttConnectVariableHeader.name(), (byte) mqttConnectVariableHeader.version()); if (!MqttCodecUtil.isValidClientId(mqttVersion, maxClientIdLength, decodedClientIdValue)) { throw new MqttIdentifierRejectedException("invalid clientIdentifier: " + decodedClientIdValue); } int numberOfBytesConsumed = decodedClientId.numberOfBytesConsumed; Result decodedWillTopic = null; byte[] decodedWillMessage = null; final MqttProperties willProperties; if (mqttConnectVariableHeader.isWillFlag()) { if (mqttVersion.protocolLevel() <= MqttVersion.MQTT_5.protocolLevel()) { final Result propertiesResult = decodeProperties(buffer); willProperties = propertiesResult.value; numberOfBytesConsumed += propertiesResult.numberOfBytesConsumed; } else { willProperties = MqttProperties.NO_PROPERTIES; } decodedWillTopic = decodeString(buffer, 0, 32767); numberOfBytesConsumed += decodedWillTopic.numberOfBytesConsumed; decodedWillMessage = decodeByteArray(buffer); numberOfBytesConsumed += decodedWillMessage.length + 2; } else { willProperties = MqttProperties.NO_PROPERTIES; } Result decodedUserName = null; byte[] decodedPassword = null; byte[] decodedSignature = null; if (mqttConnectVariableHeader.hasUserName()) { decodedUserName = decodeString(buffer); numberOfBytesConsumed += decodedUserName.numberOfBytesConsumed; } if (mqttConnectVariableHeader.hasPassword()) { decodedPassword = decodeByteArray(buffer); numberOfBytesConsumed += decodedPassword.length + 2; } if (mqttConnectVariableHeader.isWillRetain()) { decodedSignature = decodeByteArray(buffer); numberOfBytesConsumed += decodedSignature.length + 2; } final MqttConnectPayload mqttConnectPayload = new MqttConnectPayload( decodedClientId.value, willProperties, decodedWillTopic != null ? decodedWillTopic.value : null, decodedWillMessage, decodedUserName != null ? decodedUserName.value : null, decodedPassword, decodedSignature ); return new Result(mqttConnectPayload, numberOfBytesConsumed); } private static Result decodeSubscribePayload( ByteBuf buffer, int bytesRemainingInVariablePart) { final List subscribeTopics = new ArrayList(); int numberOfBytesConsumed = 0; while (numberOfBytesConsumed < bytesRemainingInVariablePart) { final Result decodedTopicName = decodeString(buffer); numberOfBytesConsumed += decodedTopicName.numberOfBytesConsumed; //See 3.8.3.1 Subscription Options of MQTT 5.0 specification for optionByte details final short optionByte = buffer.readUnsignedByte(); MqttQoS qos = MqttQoS.valueOf(optionByte & 0x03); boolean noLocal = ((optionByte & 0x04) >> 2) == 1; boolean retainAsPublished = ((optionByte & 0x08) >> 3) == 1; MqttSubscriptionOption.RetainedHandlingPolicy retainHandling = MqttSubscriptionOption.RetainedHandlingPolicy.valueOf((optionByte & 0x30) >> 4); final MqttSubscriptionOption subscriptionOption = new MqttSubscriptionOption(qos, noLocal, retainAsPublished, retainHandling); numberOfBytesConsumed++; subscribeTopics.add(new MqttTopicSubscription(decodedTopicName.value, subscriptionOption)); } return new Result(new MqttSubscribePayload(subscribeTopics), numberOfBytesConsumed); } private static Result decodeSubackPayload( ByteBuf buffer, int bytesRemainingInVariablePart) { final List grantedQos = new ArrayList(bytesRemainingInVariablePart); int numberOfBytesConsumed = 0; while (numberOfBytesConsumed < bytesRemainingInVariablePart) { int reasonCode = buffer.readUnsignedByte(); numberOfBytesConsumed++; grantedQos.add(reasonCode); } return new Result(new MqttSubAckPayload(grantedQos), numberOfBytesConsumed); } private static Result decodeUnsubAckPayload( ChannelHandlerContext ctx, ByteBuf buffer, int bytesRemainingInVariablePart) { final List reasonCodes = new ArrayList(bytesRemainingInVariablePart); int numberOfBytesConsumed = 0; while (numberOfBytesConsumed < bytesRemainingInVariablePart) { short reasonCode = buffer.readUnsignedByte(); numberOfBytesConsumed++; reasonCodes.add(reasonCode); } return new Result(new MqttUnsubAckPayload(reasonCodes), numberOfBytesConsumed); } private static Result decodeUnsubscribePayload( ByteBuf buffer, int bytesRemainingInVariablePart) { final List unsubscribeTopics = new ArrayList(); int numberOfBytesConsumed = 0; while (numberOfBytesConsumed < bytesRemainingInVariablePart) { final Result decodedTopicName = decodeString(buffer); numberOfBytesConsumed += decodedTopicName.numberOfBytesConsumed; unsubscribeTopics.add(decodedTopicName.value); } return new Result( new MqttUnsubscribePayload(unsubscribeTopics), numberOfBytesConsumed); } private static Result decodePublishPayload(ByteBuf buffer, int bytesRemainingInVariablePart) { ByteBuf b = buffer.readRetainedSlice(bytesRemainingInVariablePart); return new Result(b, bytesRemainingInVariablePart); } private static Result decodeString(ByteBuf buffer) { return decodeString(buffer, 0, Integer.MAX_VALUE); } private static Result decodeString(ByteBuf buffer, int minBytes, int maxBytes) { int size = decodeMsbLsb(buffer); int numberOfBytesConsumed = 2; if (size < minBytes || size > maxBytes) { buffer.skipBytes(size); numberOfBytesConsumed += size; return new Result(null, numberOfBytesConsumed); } String s = buffer.toString(buffer.readerIndex(), size, CharsetUtil.UTF_8); buffer.skipBytes(size); numberOfBytesConsumed += size; return new Result(s, numberOfBytesConsumed); } /** * * @return the decoded byte[], numberOfBytesConsumed = byte[].length + 2 */ private static byte[] decodeByteArray(ByteBuf buffer) { int size = decodeMsbLsb(buffer); byte[] bytes = new byte[size]; buffer.readBytes(bytes); return bytes; } // packing utils to reduce the amount of garbage while decoding ints private static long packInts(int a, int b) { return (((long) a) << 32) | (b & 0xFFFFFFFFL); } private static int unpackA(long ints) { return (int) (ints >> 32); } private static int unpackB(long ints) { return (int) ints; } /** * numberOfBytesConsumed = 2. return decoded result. */ private static int decodeMsbLsb(ByteBuf buffer) { int min = 0; int max = 65535; short msbSize = buffer.readUnsignedByte(); short lsbSize = buffer.readUnsignedByte(); int result = msbSize << 8 | lsbSize; if (result < min || result > max) { result = -1; } return result; } /** * See 1.5.5 Variable Byte Integer section of MQTT 5.0 specification for encoding/decoding rules * * @param buffer the buffer to decode from * @return result pack with a = decoded integer, b = numberOfBytesConsumed. Need to unpack to read them. * @throws DecoderException if bad MQTT protocol limits Remaining Length */ private static long decodeVariableByteInteger(ByteBuf buffer) { int remainingLength = 0; int multiplier = 1; short digit; int loops = 0; do { digit = buffer.readUnsignedByte(); remainingLength += (digit & 127) * multiplier; multiplier *= 128; loops++; } while ((digit & 128) != 0 && loops < 4); if (loops == 4 && (digit & 128) != 0) { throw new DecoderException("MQTT protocol limits Remaining Length to 4 bytes"); } return packInts(remainingLength, loops); } private static final class Result { private final T value; private final int numberOfBytesConsumed; Result(T value, int numberOfBytesConsumed) { this.value = value; this.numberOfBytesConsumed = numberOfBytesConsumed; } } private static Result decodeProperties(ByteBuf buffer) { final long propertiesLength = decodeVariableByteInteger(buffer); int totalPropertiesLength = unpackA(propertiesLength); int numberOfBytesConsumed = unpackB(propertiesLength); MqttProperties decodedProperties = new MqttProperties(); while (numberOfBytesConsumed < totalPropertiesLength) { long propertyId = decodeVariableByteInteger(buffer); final int propertyIdValue = unpackA(propertyId); numberOfBytesConsumed += unpackB(propertyId); MqttProperties.MqttPropertyType propertyType = MqttProperties.MqttPropertyType.valueOf(propertyIdValue); switch (propertyType) { case PAYLOAD_FORMAT_INDICATOR: case REQUEST_PROBLEM_INFORMATION: case REQUEST_RESPONSE_INFORMATION: case MAXIMUM_QOS: case RETAIN_AVAILABLE: case WILDCARD_SUBSCRIPTION_AVAILABLE: case SUBSCRIPTION_IDENTIFIER_AVAILABLE: case SHARED_SUBSCRIPTION_AVAILABLE: final int b1 = buffer.readUnsignedByte(); numberOfBytesConsumed++; decodedProperties.add(new MqttProperties.IntegerProperty(propertyIdValue, b1)); break; case SERVER_KEEP_ALIVE: case RECEIVE_MAXIMUM: case TOPIC_ALIAS_MAXIMUM: case TOPIC_ALIAS: final int int2BytesResult = decodeMsbLsb(buffer); numberOfBytesConsumed += 2; decodedProperties.add(new MqttProperties.IntegerProperty(propertyIdValue, int2BytesResult)); break; case PUBLICATION_EXPIRY_INTERVAL: case SESSION_EXPIRY_INTERVAL: case WILL_DELAY_INTERVAL: case MAXIMUM_PACKET_SIZE: final int maxPacketSize = buffer.readInt(); numberOfBytesConsumed += 4; decodedProperties.add(new MqttProperties.IntegerProperty(propertyIdValue, maxPacketSize)); break; case SUBSCRIPTION_IDENTIFIER: long vbIntegerResult = decodeVariableByteInteger(buffer); numberOfBytesConsumed += unpackB(vbIntegerResult); decodedProperties.add(new MqttProperties.IntegerProperty(propertyIdValue, unpackA(vbIntegerResult))); break; case CONTENT_TYPE: case RESPONSE_TOPIC: case ASSIGNED_CLIENT_IDENTIFIER: case AUTHENTICATION_METHOD: case RESPONSE_INFORMATION: case SERVER_REFERENCE: case REASON_STRING: final Result stringResult = decodeString(buffer); numberOfBytesConsumed += stringResult.numberOfBytesConsumed; decodedProperties.add(new MqttProperties.StringProperty(propertyIdValue, stringResult.value)); break; case USER_PROPERTY: final Result keyResult = decodeString(buffer); final Result valueResult = decodeString(buffer); numberOfBytesConsumed += keyResult.numberOfBytesConsumed; numberOfBytesConsumed += valueResult.numberOfBytesConsumed; decodedProperties.add(new MqttProperties.UserProperty(keyResult.value, valueResult.value)); break; case CORRELATION_DATA: case AUTHENTICATION_DATA: final byte[] binaryDataResult = decodeByteArray(buffer); numberOfBytesConsumed += binaryDataResult.length + 2; decodedProperties.add(new MqttProperties.BinaryProperty(propertyIdValue, binaryDataResult)); break; default: //shouldn't reach here throw new DecoderException("Unknown property type: " + propertyType); } } return new Result(decodedProperties, numberOfBytesConsumed); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.EncoderException; import io.netty.handler.codec.MessageToMessageEncoder; import io.netty.util.internal.EmptyArrays; import java.util.List; import static io.netty.buffer.ByteBufUtil.*; /** * Encodes Mqtt messages into bytes following the protocol specification v3.1 * as described here MQTTV3.1 * or v5.0 as described here MQTTv5.0 - * depending on the version specified in the first CONNECT message that goes through the channel. */ @ChannelHandler.Sharable public final class MqttEncoder extends MessageToMessageEncoder { public static final MqttEncoder INSTANCE = new MqttEncoder(); private MqttEncoder() { } @Override protected void encode(ChannelHandlerContext ctx, MqttMessage msg, List out) throws Exception { out.add(doEncode(ctx, msg)); } /** * This is the main encoding method. * It's only visible for testing. * * @param message MQTT message to encode * @return ByteBuf with encoded bytes */ static ByteBuf doEncode(ChannelHandlerContext ctx, MqttMessage message) { switch (message.fixedHeader().messageType()) { case CONNECT: return encodeConnectMessage(ctx, (MqttConnectMessage) message); case CONNACK: return encodeConnAckMessage(ctx, (MqttConnAckMessage) message); case PUBLISH: return encodePublishMessage(ctx, (MqttPublishMessage) message); case SUBSCRIBE: return encodeSubscribeMessage(ctx, (MqttSubscribeMessage) message); case UNSUBSCRIBE: return encodeUnsubscribeMessage(ctx, (MqttUnsubscribeMessage) message); case SUBACK: return encodeSubAckMessage(ctx, (MqttSubAckMessage) message); case UNSUBACK: if (message instanceof MqttUnsubAckMessage) { return encodeUnsubAckMessage(ctx, (MqttUnsubAckMessage) message); } return encodeMessageWithOnlySingleByteFixedHeaderAndMessageId(ctx.alloc(), message); case PUBACK: case PUBREC: case PUBREL: case PUBCOMP: return encodePubReplyMessage(ctx, message); case DISCONNECT: case AUTH: return encodeReasonCodePlusPropertiesMessage(ctx, message); case PINGREQ: case PINGRESP: return encodeMessageWithOnlySingleByteFixedHeader(ctx.alloc(), message); default: throw new IllegalArgumentException( "Unknown message type: " + message.fixedHeader().messageType().value()); } } private static ByteBuf encodeConnectMessage( ChannelHandlerContext ctx, MqttConnectMessage message) { int payloadBufferSize = 0; MqttFixedHeader mqttFixedHeader = message.fixedHeader(); MqttConnectVariableHeader variableHeader = message.variableHeader(); MqttConnectPayload payload = message.payload(); MqttVersion mqttVersion = MqttVersion.fromProtocolNameAndLevel(variableHeader.name(), (byte) variableHeader.version()); MqttCodecUtil.setMqttVersion(ctx, mqttVersion); // as MQTT 3.1 & 3.1.1 spec, If the User Name Flag is set to 0, the Password Flag MUST be set to 0 if (!variableHeader.hasUserName() && variableHeader.hasPassword()) { throw new EncoderException("Without a username, the password MUST be not set"); } // Client id String clientIdentifier = payload.clientIdentifier(); if (!MqttCodecUtil.isValidClientId(mqttVersion, MqttConstant.DEFAULT_MAX_CLIENT_ID_LENGTH, clientIdentifier)) { throw new MqttIdentifierRejectedException("invalid clientIdentifier: " + clientIdentifier); } int clientIdentifierBytes = utf8Bytes(clientIdentifier); payloadBufferSize += 2 + clientIdentifierBytes; // Will topic and message String willTopic = payload.willTopic(); int willTopicBytes = nullableUtf8Bytes(willTopic); byte[] willMessage = payload.willMessageInBytes(); byte[] willMessageBytes = willMessage != null ? willMessage : EmptyArrays.EMPTY_BYTES; if (variableHeader.isWillFlag()) { payloadBufferSize += 2 + willTopicBytes; payloadBufferSize += 2 + willMessageBytes.length; } String userName = payload.userName(); int userNameBytes = nullableUtf8Bytes(userName); if (variableHeader.hasUserName()) { payloadBufferSize += 2 + userNameBytes; } byte[] password = payload.passwordInBytes(); byte[] passwordBytes = password != null ? password : EmptyArrays.EMPTY_BYTES; if (variableHeader.hasPassword()) { payloadBufferSize += 2 + passwordBytes.length; } // Fixed and variable header byte[] protocolNameBytes = mqttVersion.protocolNameBytes(); ByteBuf propertiesBuf = encodePropertiesIfNeeded( mqttVersion, ctx.alloc(), message.variableHeader().properties()); try { final ByteBuf willPropertiesBuf; if (variableHeader.isWillFlag()) { willPropertiesBuf = encodePropertiesIfNeeded(mqttVersion, ctx.alloc(), payload.willProperties()); payloadBufferSize += willPropertiesBuf.readableBytes(); } else { willPropertiesBuf = Unpooled.EMPTY_BUFFER; } try { int variableHeaderBufferSize = 2 + protocolNameBytes.length + 4 + propertiesBuf.readableBytes(); int variablePartSize = variableHeaderBufferSize + payloadBufferSize; int fixedHeaderBufferSize = 1 + getVariableLengthInt(variablePartSize); ByteBuf buf = ctx.alloc().buffer(fixedHeaderBufferSize + variablePartSize); buf.writeByte(getFixedHeaderByte1(mqttFixedHeader)); writeVariableLengthInt(buf, variablePartSize); buf.writeShort(protocolNameBytes.length); buf.writeBytes(protocolNameBytes); buf.writeByte(variableHeader.version()); buf.writeByte(getConnVariableHeaderFlag(variableHeader)); buf.writeShort(variableHeader.keepAliveTimeSeconds()); buf.writeBytes(propertiesBuf); // Payload writeExactUTF8String(buf, clientIdentifier, clientIdentifierBytes); if (variableHeader.isWillFlag()) { buf.writeBytes(willPropertiesBuf); writeExactUTF8String(buf, willTopic, willTopicBytes); buf.writeShort(willMessageBytes.length); buf.writeBytes(willMessageBytes, 0, willMessageBytes.length); } if (variableHeader.hasUserName()) { writeExactUTF8String(buf, userName, userNameBytes); } if (variableHeader.hasPassword()) { buf.writeShort(passwordBytes.length); buf.writeBytes(passwordBytes, 0, passwordBytes.length); } return buf; } finally { willPropertiesBuf.release(); } } finally { propertiesBuf.release(); } } private static int getConnVariableHeaderFlag(MqttConnectVariableHeader variableHeader) { int flagByte = 0; if (variableHeader.hasUserName()) { flagByte |= 0x80; } if (variableHeader.hasPassword()) { flagByte |= 0x40; } if (variableHeader.isWillRetain()) { flagByte |= 0x20; } flagByte |= (variableHeader.willQos() & 0x03) << 3; if (variableHeader.isWillFlag()) { flagByte |= 0x04; } if (variableHeader.isCleanSession()) { flagByte |= 0x02; } return flagByte; } private static ByteBuf encodeConnAckMessage( ChannelHandlerContext ctx, MqttConnAckMessage message) { final MqttVersion mqttVersion = MqttCodecUtil.getMqttVersion(ctx); ByteBuf propertiesBuf = encodePropertiesIfNeeded(mqttVersion, ctx.alloc(), message.variableHeader().properties()); try { int length = 4; MqttConnectAckPayload payload = null; if (message.payload() != null) { payload = (MqttConnectAckPayload)message.payload(); if (payload.getData() != null && payload.getData().length > 0) { length += payload.getData().length; } } ByteBuf buf = ctx.alloc().buffer(length + propertiesBuf.readableBytes()); buf.writeByte(getFixedHeaderByte1(message.fixedHeader())); writeVariableLengthInt(buf, length - 2 + propertiesBuf.readableBytes()); buf.writeByte(message.variableHeader().isSessionPresent() ? 0x01 : 0x00); buf.writeByte(message.variableHeader().connectReturnCode().byteValue()); if (length > 4) { buf.writeBytes(payload.getData()); } buf.writeBytes(propertiesBuf); return buf; } finally { propertiesBuf.release(); } } private static ByteBuf encodeSubscribeMessage( ChannelHandlerContext ctx, MqttSubscribeMessage message) { MqttVersion mqttVersion = MqttCodecUtil.getMqttVersion(ctx); ByteBuf propertiesBuf = encodePropertiesIfNeeded(mqttVersion, ctx.alloc(), message.idAndPropertiesVariableHeader().properties()); try { final int variableHeaderBufferSize = 2 + propertiesBuf.readableBytes(); int payloadBufferSize = 0; MqttFixedHeader mqttFixedHeader = message.fixedHeader(); MqttMessageIdVariableHeader variableHeader = message.variableHeader(); MqttSubscribePayload payload = message.payload(); for (MqttTopicSubscription topic : payload.topicSubscriptions()) { String topicName = topic.topicName(); int topicNameBytes = utf8Bytes(topicName); payloadBufferSize += 2 + topicNameBytes; payloadBufferSize += 1; } int variablePartSize = variableHeaderBufferSize + payloadBufferSize; int fixedHeaderBufferSize = 1 + getVariableLengthInt(variablePartSize); ByteBuf buf = ctx.alloc().buffer(fixedHeaderBufferSize + variablePartSize); buf.writeByte(getFixedHeaderByte1(mqttFixedHeader)); writeVariableLengthInt(buf, variablePartSize); // Variable Header int messageId = variableHeader.messageId(); buf.writeShort(messageId); buf.writeBytes(propertiesBuf); // Payload for (MqttTopicSubscription topic : payload.topicSubscriptions()) { writeUnsafeUTF8String(buf, topic.topicName()); if (mqttVersion.protocolLevel() >= MqttVersion.MQTT_3_1_1.protocolLevel()) { buf.writeByte(topic.qualityOfService().value()); } else { final MqttSubscriptionOption option = topic.option(); int optionEncoded = option.retainHandling().value() << 4; if (option.isRetainAsPublished()) { optionEncoded |= 0x08; } if (option.isNoLocal()) { optionEncoded |= 0x04; } optionEncoded |= option.qos().value(); buf.writeByte(optionEncoded); } } return buf; } finally { propertiesBuf.release(); } } private static ByteBuf encodeUnsubscribeMessage( ChannelHandlerContext ctx, MqttUnsubscribeMessage message) { MqttVersion mqttVersion = MqttCodecUtil.getMqttVersion(ctx); ByteBuf propertiesBuf = encodePropertiesIfNeeded(mqttVersion, ctx.alloc(), message.idAndPropertiesVariableHeader().properties()); try { final int variableHeaderBufferSize = 2 + propertiesBuf.readableBytes(); int payloadBufferSize = 0; MqttFixedHeader mqttFixedHeader = message.fixedHeader(); MqttMessageIdVariableHeader variableHeader = message.variableHeader(); MqttUnsubscribePayload payload = message.payload(); for (String topicName : payload.topics()) { int topicNameBytes = utf8Bytes(topicName); payloadBufferSize += 2 + topicNameBytes; } int variablePartSize = variableHeaderBufferSize + payloadBufferSize; int fixedHeaderBufferSize = 1 + getVariableLengthInt(variablePartSize); ByteBuf buf = ctx.alloc().buffer(fixedHeaderBufferSize + variablePartSize); buf.writeByte(getFixedHeaderByte1(mqttFixedHeader)); writeVariableLengthInt(buf, variablePartSize); // Variable Header int messageId = variableHeader.messageId(); buf.writeShort(messageId); buf.writeBytes(propertiesBuf); // Payload for (String topicName : payload.topics()) { writeUnsafeUTF8String(buf, topicName); } return buf; } finally { propertiesBuf.release(); } } private static ByteBuf encodeSubAckMessage( ChannelHandlerContext ctx, MqttSubAckMessage message) { MqttVersion mqttVersion = MqttCodecUtil.getMqttVersion(ctx); ByteBuf propertiesBuf = encodePropertiesIfNeeded(mqttVersion, ctx.alloc(), message.idAndPropertiesVariableHeader().properties()); try { int variableHeaderBufferSize = 2 + propertiesBuf.readableBytes(); int payloadBufferSize = message.payload().grantedQoSLevels().size(); int variablePartSize = variableHeaderBufferSize + payloadBufferSize; int fixedHeaderBufferSize = 1 + getVariableLengthInt(variablePartSize); ByteBuf buf = ctx.alloc().buffer(fixedHeaderBufferSize + variablePartSize); buf.writeByte(getFixedHeaderByte1(message.fixedHeader())); writeVariableLengthInt(buf, variablePartSize); buf.writeShort(message.variableHeader().messageId()); buf.writeBytes(propertiesBuf); for (int code: message.payload().reasonCodes()) { buf.writeByte(code); } return buf; } finally { propertiesBuf.release(); } } private static ByteBuf encodeUnsubAckMessage( ChannelHandlerContext ctx, MqttUnsubAckMessage message) { if (message.variableHeader() instanceof MqttMessageIdAndPropertiesVariableHeader) { MqttVersion mqttVersion = MqttCodecUtil.getMqttVersion(ctx); ByteBuf propertiesBuf = encodePropertiesIfNeeded(mqttVersion, ctx.alloc(), message.idAndPropertiesVariableHeader().properties()); try { int variableHeaderBufferSize = 2 + propertiesBuf.readableBytes(); MqttUnsubAckPayload payload = message.payload(); int payloadBufferSize = payload == null ? 0 : payload.unsubscribeReasonCodes().size(); int variablePartSize = variableHeaderBufferSize + payloadBufferSize; int fixedHeaderBufferSize = 1 + getVariableLengthInt(variablePartSize); ByteBuf buf = ctx.alloc().buffer(fixedHeaderBufferSize + variablePartSize); buf.writeByte(getFixedHeaderByte1(message.fixedHeader())); writeVariableLengthInt(buf, variablePartSize); buf.writeShort(message.variableHeader().messageId()); buf.writeBytes(propertiesBuf); if (payload != null) { for (Short reasonCode : payload.unsubscribeReasonCodes()) { buf.writeByte(reasonCode); } } return buf; } finally { propertiesBuf.release(); } } else { return encodeMessageWithOnlySingleByteFixedHeaderAndMessageId(ctx.alloc(), message); } } private static ByteBuf encodePublishMessage( ChannelHandlerContext ctx, MqttPublishMessage message) { MqttVersion mqttVersion = MqttCodecUtil.getMqttVersion(ctx); MqttFixedHeader mqttFixedHeader = message.fixedHeader(); MqttPublishVariableHeader variableHeader = message.variableHeader(); ByteBuf payload = message.payload().duplicate(); String topicName = variableHeader.topicName(); int topicNameBytes = utf8Bytes(topicName); ByteBuf propertiesBuf = encodePropertiesIfNeeded(mqttVersion, ctx.alloc(), message.variableHeader().properties()); try { int variableHeaderBufferSize = 2 + topicNameBytes + (mqttFixedHeader.qosLevel().value() > 0 ? 2 : 0) + propertiesBuf.readableBytes(); int payloadBufferSize = payload.readableBytes(); int variablePartSize = variableHeaderBufferSize + payloadBufferSize; int fixedHeaderBufferSize = 1 + getVariableLengthInt(variablePartSize); ByteBuf buf = ctx.alloc().buffer(fixedHeaderBufferSize + variablePartSize); buf.writeByte(getFixedHeaderByte1(mqttFixedHeader)); writeVariableLengthInt(buf, variablePartSize); writeExactUTF8String(buf, topicName, topicNameBytes); if (mqttFixedHeader.qosLevel().value() > 0) { buf.writeShort(variableHeader.packetId()); } buf.writeBytes(propertiesBuf); buf.writeBytes(payload); return buf; } finally { propertiesBuf.release(); } } private static ByteBuf encodePubReplyMessage(ChannelHandlerContext ctx, MqttMessage message) { if (message.variableHeader() instanceof MqttPubReplyMessageVariableHeader) { MqttFixedHeader mqttFixedHeader = message.fixedHeader(); MqttPubReplyMessageVariableHeader variableHeader = (MqttPubReplyMessageVariableHeader) message.variableHeader(); int msgId = variableHeader.messageId(); final ByteBuf propertiesBuf; final boolean includeReasonCode; final int variableHeaderBufferSize; final MqttVersion mqttVersion = MqttCodecUtil.getMqttVersion(ctx); if (mqttVersion == MqttVersion.MQTT_5 && (variableHeader.reasonCode() != MqttPubReplyMessageVariableHeader.REASON_CODE_OK || !variableHeader.properties().isEmpty())) { propertiesBuf = encodeProperties(ctx.alloc(), variableHeader.properties()); includeReasonCode = true; variableHeaderBufferSize = 3 + propertiesBuf.readableBytes(); } else { propertiesBuf = Unpooled.EMPTY_BUFFER; includeReasonCode = false; variableHeaderBufferSize = 2; } try { final int fixedHeaderBufferSize = 1 + getVariableLengthInt(variableHeaderBufferSize); ByteBuf buf = ctx.alloc().buffer(fixedHeaderBufferSize + variableHeaderBufferSize); buf.writeByte(getFixedHeaderByte1(mqttFixedHeader)); writeVariableLengthInt(buf, variableHeaderBufferSize); buf.writeShort(msgId); if (includeReasonCode) { buf.writeByte(variableHeader.reasonCode()); } buf.writeBytes(propertiesBuf); return buf; } finally { propertiesBuf.release(); } } else { return encodeMessageWithOnlySingleByteFixedHeaderAndMessageId(ctx.alloc(), message); } } private static ByteBuf encodeMessageWithOnlySingleByteFixedHeaderAndMessageId( ByteBufAllocator byteBufAllocator, MqttMessage message) { MqttFixedHeader mqttFixedHeader = message.fixedHeader(); MqttMessageIdVariableHeader variableHeader = (MqttMessageIdVariableHeader) message.variableHeader(); int msgId = variableHeader.messageId(); int variableHeaderBufferSize = 2; // variable part only has a message id ByteBuf payload = null; if (message.payload() != null) { payload = ((ByteBuf)message.payload()).duplicate(); variableHeaderBufferSize += payload.readableBytes(); } int fixedHeaderBufferSize = 1 + getVariableLengthInt(variableHeaderBufferSize); ByteBuf buf = byteBufAllocator.buffer(fixedHeaderBufferSize + variableHeaderBufferSize); buf.writeByte(getFixedHeaderByte1(mqttFixedHeader)); writeVariableLengthInt(buf, variableHeaderBufferSize); buf.writeShort(msgId); if (payload != null) { buf.writeBytes(payload); } return buf; } private static ByteBuf encodeReasonCodePlusPropertiesMessage( ChannelHandlerContext ctx, MqttMessage message) { if (message.variableHeader() instanceof MqttReasonCodeAndPropertiesVariableHeader) { MqttVersion mqttVersion = MqttCodecUtil.getMqttVersion(ctx); MqttFixedHeader mqttFixedHeader = message.fixedHeader(); MqttReasonCodeAndPropertiesVariableHeader variableHeader = (MqttReasonCodeAndPropertiesVariableHeader) message.variableHeader(); final ByteBuf propertiesBuf; final boolean includeReasonCode; final int variableHeaderBufferSize; if (mqttVersion == MqttVersion.MQTT_5 && (variableHeader.reasonCode() != MqttReasonCodeAndPropertiesVariableHeader.REASON_CODE_OK || !variableHeader.properties().isEmpty())) { propertiesBuf = encodeProperties(ctx.alloc(), variableHeader.properties()); includeReasonCode = true; variableHeaderBufferSize = 1 + propertiesBuf.readableBytes(); } else { propertiesBuf = Unpooled.EMPTY_BUFFER; includeReasonCode = false; variableHeaderBufferSize = 0; } try { final int fixedHeaderBufferSize = 1 + getVariableLengthInt(variableHeaderBufferSize); ByteBuf buf = ctx.alloc().buffer(fixedHeaderBufferSize + variableHeaderBufferSize); buf.writeByte(getFixedHeaderByte1(mqttFixedHeader)); writeVariableLengthInt(buf, variableHeaderBufferSize); if (includeReasonCode) { buf.writeByte(variableHeader.reasonCode()); } buf.writeBytes(propertiesBuf); return buf; } finally { propertiesBuf.release(); } } else { return encodeMessageWithOnlySingleByteFixedHeader(ctx.alloc(), message); } } private static ByteBuf encodeMessageWithOnlySingleByteFixedHeader( ByteBufAllocator byteBufAllocator, MqttMessage message) { MqttFixedHeader mqttFixedHeader = message.fixedHeader(); ByteBuf buf = byteBufAllocator.buffer(2); buf.writeByte(getFixedHeaderByte1(mqttFixedHeader)); buf.writeByte(0); return buf; } private static ByteBuf encodePropertiesIfNeeded(MqttVersion mqttVersion, ByteBufAllocator byteBufAllocator, MqttProperties mqttProperties) { if (mqttVersion == MqttVersion.MQTT_5) { return encodeProperties(byteBufAllocator, mqttProperties); } return Unpooled.EMPTY_BUFFER; } private static ByteBuf encodeProperties(ByteBufAllocator byteBufAllocator, MqttProperties mqttProperties) { ByteBuf propertiesHeaderBuf = byteBufAllocator.buffer(); // encode also the Properties part try { ByteBuf propertiesBuf = byteBufAllocator.buffer(); try { for (MqttProperties.MqttProperty property : mqttProperties.listAll()) { MqttProperties.MqttPropertyType propertyType = MqttProperties.MqttPropertyType.valueOf(property.propertyId); switch (propertyType) { case PAYLOAD_FORMAT_INDICATOR: case REQUEST_PROBLEM_INFORMATION: case REQUEST_RESPONSE_INFORMATION: case MAXIMUM_QOS: case RETAIN_AVAILABLE: case WILDCARD_SUBSCRIPTION_AVAILABLE: case SUBSCRIPTION_IDENTIFIER_AVAILABLE: case SHARED_SUBSCRIPTION_AVAILABLE: writeVariableLengthInt(propertiesBuf, property.propertyId); final byte bytePropValue = ((MqttProperties.IntegerProperty) property).value.byteValue(); propertiesBuf.writeByte(bytePropValue); break; case SERVER_KEEP_ALIVE: case RECEIVE_MAXIMUM: case TOPIC_ALIAS_MAXIMUM: case TOPIC_ALIAS: writeVariableLengthInt(propertiesBuf, property.propertyId); final short twoBytesInPropValue = ((MqttProperties.IntegerProperty) property).value.shortValue(); propertiesBuf.writeShort(twoBytesInPropValue); break; case PUBLICATION_EXPIRY_INTERVAL: case SESSION_EXPIRY_INTERVAL: case WILL_DELAY_INTERVAL: case MAXIMUM_PACKET_SIZE: writeVariableLengthInt(propertiesBuf, property.propertyId); final int fourBytesIntPropValue = ((MqttProperties.IntegerProperty) property).value; propertiesBuf.writeInt(fourBytesIntPropValue); break; case SUBSCRIPTION_IDENTIFIER: writeVariableLengthInt(propertiesBuf, property.propertyId); final int vbi = ((MqttProperties.IntegerProperty) property).value; writeVariableLengthInt(propertiesBuf, vbi); break; case CONTENT_TYPE: case RESPONSE_TOPIC: case ASSIGNED_CLIENT_IDENTIFIER: case AUTHENTICATION_METHOD: case RESPONSE_INFORMATION: case SERVER_REFERENCE: case REASON_STRING: writeVariableLengthInt(propertiesBuf, property.propertyId); writeEagerUTF8String(propertiesBuf, ((MqttProperties.StringProperty) property).value); break; case USER_PROPERTY: final List pairs = ((MqttProperties.UserProperties) property).value; for (MqttProperties.StringPair pair : pairs) { writeVariableLengthInt(propertiesBuf, property.propertyId); writeEagerUTF8String(propertiesBuf, pair.key); writeEagerUTF8String(propertiesBuf, pair.value); } break; case CORRELATION_DATA: case AUTHENTICATION_DATA: writeVariableLengthInt(propertiesBuf, property.propertyId); final byte[] binaryPropValue = ((MqttProperties.BinaryProperty) property).value; propertiesBuf.writeShort(binaryPropValue.length); propertiesBuf.writeBytes(binaryPropValue, 0, binaryPropValue.length); break; default: //shouldn't reach here throw new EncoderException("Unknown property type: " + propertyType); } } writeVariableLengthInt(propertiesHeaderBuf, propertiesBuf.readableBytes()); propertiesHeaderBuf.writeBytes(propertiesBuf); return propertiesHeaderBuf; } finally { propertiesBuf.release(); } } catch (RuntimeException e) { propertiesHeaderBuf.release(); throw e; } } private static int getFixedHeaderByte1(MqttFixedHeader header) { int ret = 0; ret |= header.messageType().value() << 4; if (header.isDup()) { ret |= 0x08; } ret |= header.qosLevel().value() << 1; if (header.isRetain()) { ret |= 0x01; } return ret; } private static void writeVariableLengthInt(ByteBuf buf, int num) { do { int digit = num % 128; num /= 128; if (num > 0) { digit |= 0x80; } buf.writeByte(digit); } while (num > 0); } private static int nullableUtf8Bytes(String s) { return s == null? 0 : utf8Bytes(s); } private static int nullableMaxUtf8Bytes(String s) { return s == null? 0 : utf8MaxBytes(s); } private static void writeExactUTF8String(ByteBuf buf, String s, int utf8Length) { buf.ensureWritable(utf8Length + 2); buf.writeShort(utf8Length); if (utf8Length > 0) { final int writtenUtf8Length = reserveAndWriteUtf8(buf, s, utf8Length); assert writtenUtf8Length == utf8Length; } } private static void writeEagerUTF8String(ByteBuf buf, String s) { final int maxUtf8Length = nullableMaxUtf8Bytes(s); buf.ensureWritable(maxUtf8Length + 2); final int writerIndex = buf.writerIndex(); final int startUtf8String = writerIndex + 2; buf.writerIndex(startUtf8String); final int utf8Length = s != null? reserveAndWriteUtf8(buf, s, maxUtf8Length) : 0; buf.setShort(writerIndex, utf8Length); } private static void writeUnsafeUTF8String(ByteBuf buf, String s) { final int writerIndex = buf.writerIndex(); final int startUtf8String = writerIndex + 2; // no need to reserve any capacity here, already done earlier: that's why is Unsafe buf.writerIndex(startUtf8String); final int utf8Length = s != null? reserveAndWriteUtf8(buf, s, 0) : 0; buf.setShort(writerIndex, utf8Length); } private static int getVariableLengthInt(int num) { int count = 0; do { num /= 128; count++; } while (num > 0); return count; } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttFixedHeader.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.ObjectUtil; import io.netty.util.internal.StringUtil; /** * See * MQTTV3.1/fixed-header */ public final class MqttFixedHeader { private final MqttMessageType messageType; private final boolean isDup; private final MqttQoS qosLevel; private final boolean isRetain; private final int remainingLength; public MqttFixedHeader( MqttMessageType messageType, boolean isDup, MqttQoS qosLevel, boolean isRetain, int remainingLength) { this.messageType = ObjectUtil.checkNotNull(messageType, "messageType"); this.isDup = isDup; this.qosLevel = ObjectUtil.checkNotNull(qosLevel, "qosLevel"); this.isRetain = isRetain; this.remainingLength = remainingLength; } public MqttMessageType messageType() { return messageType; } public boolean isDup() { return isDup; } public MqttQoS qosLevel() { return qosLevel; } public boolean isRetain() { return isRetain; } public int remainingLength() { return remainingLength; } @Override public String toString() { return new StringBuilder(StringUtil.simpleClassName(this)) .append('[') .append("messageType=").append(messageType) .append(", isDup=").append(isDup) .append(", qosLevel=").append(qosLevel) .append(", isRetain=").append(isRetain) .append(", remainingLength=").append(remainingLength) .append(']') .toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttIdentifierRejectedException.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.handler.codec.DecoderException; /** * A {@link MqttIdentifierRejectedException} which is thrown when a CONNECT request contains invalid client identifier. */ public final class MqttIdentifierRejectedException extends DecoderException { private static final long serialVersionUID = -1323503322689614981L; /** * Creates a new instance */ public MqttIdentifierRejectedException() { } /** * Creates a new instance */ public MqttIdentifierRejectedException(String message, Throwable cause) { super(message, cause); } /** * Creates a new instance */ public MqttIdentifierRejectedException(String message) { super(message); } /** * Creates a new instance */ public MqttIdentifierRejectedException(Throwable cause) { super(cause); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttMessage.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.handler.codec.DecoderResult; import io.netty.util.internal.StringUtil; /** * Base class for all MQTT message types. */ public class MqttMessage { private final MqttFixedHeader mqttFixedHeader; private final Object variableHeader; private final Object payload; private final DecoderResult decoderResult; // Constants for fixed-header only message types with all flags set to 0 (see // https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Table_2.2_-) public static final MqttMessage PINGREQ = new MqttMessage(new MqttFixedHeader(MqttMessageType.PINGREQ, false, MqttQoS.AT_MOST_ONCE, false, 0)); public static final MqttMessage PINGRESP = new MqttMessage(new MqttFixedHeader(MqttMessageType.PINGRESP, false, MqttQoS.AT_MOST_ONCE, false, 0)); public static final MqttMessage DISCONNECT = new MqttMessage(new MqttFixedHeader(MqttMessageType.DISCONNECT, false, MqttQoS.AT_MOST_ONCE, false, 0)); public MqttMessage(MqttFixedHeader mqttFixedHeader) { this(mqttFixedHeader, null, null); } public MqttMessage(MqttFixedHeader mqttFixedHeader, Object variableHeader) { this(mqttFixedHeader, variableHeader, null); } public MqttMessage(MqttFixedHeader mqttFixedHeader, Object variableHeader, Object payload) { this(mqttFixedHeader, variableHeader, payload, DecoderResult.SUCCESS); } public MqttMessage( MqttFixedHeader mqttFixedHeader, Object variableHeader, Object payload, DecoderResult decoderResult) { this.mqttFixedHeader = mqttFixedHeader; this.variableHeader = variableHeader; this.payload = payload; this.decoderResult = decoderResult; } public MqttFixedHeader fixedHeader() { return mqttFixedHeader; } public Object variableHeader() { return variableHeader; } public Object payload() { return payload; } public DecoderResult decoderResult() { return decoderResult; } @Override public String toString() { return new StringBuilder(StringUtil.simpleClassName(this)) .append('[') .append("fixedHeader=").append(fixedHeader() != null ? fixedHeader().toString() : "") .append(", variableHeader=").append(variableHeader() != null ? variableHeader.toString() : "") .append(", payload=").append(payload() != null ? payload.toString() : "") .append(']') .toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttMessageBuilders.java ================================================ /* * Copyright 2017 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import static io.netty.util.internal.ObjectUtil.checkPositive; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.util.CharsetUtil; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public final class MqttMessageBuilders { public static final class PublishBuilder { private String topic; private boolean retained; private MqttQoS qos; private ByteBuf payload; private int messageId; private MqttProperties mqttProperties; PublishBuilder() { } public PublishBuilder topicName(String topic) { this.topic = topic; return this; } public PublishBuilder retained(boolean retained) { this.retained = retained; return this; } public PublishBuilder qos(MqttQoS qos) { this.qos = qos; return this; } public PublishBuilder payload(ByteBuf payload) { this.payload = payload; return this; } public PublishBuilder messageId(int messageId) { this.messageId = messageId; return this; } public PublishBuilder properties(MqttProperties properties) { this.mqttProperties = properties; return this; } public MqttPublishMessage build() { MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.PUBLISH, false, qos, retained, 0); MqttPublishVariableHeader mqttVariableHeader = new MqttPublishVariableHeader(topic, messageId, mqttProperties); return new MqttPublishMessage(mqttFixedHeader, mqttVariableHeader, Unpooled.buffer().writeBytes(payload)); } } public static final class ConnectBuilder { private MqttVersion version = MqttVersion.MQTT_3_1_1; private String clientId; private boolean cleanSession; private boolean hasUser; private boolean hasPassword; private int keepAliveSecs; private MqttProperties willProperties = MqttProperties.NO_PROPERTIES; private boolean willFlag; private boolean willRetain; private MqttQoS willQos = MqttQoS.AT_MOST_ONCE; private String willTopic; private byte[] willMessage; private String username; private byte[] password; private MqttProperties properties = MqttProperties.NO_PROPERTIES; ConnectBuilder() { } public ConnectBuilder protocolVersion(MqttVersion version) { this.version = version; return this; } public ConnectBuilder clientId(String clientId) { this.clientId = clientId; return this; } public ConnectBuilder cleanSession(boolean cleanSession) { this.cleanSession = cleanSession; return this; } public ConnectBuilder keepAlive(int keepAliveSecs) { this.keepAliveSecs = keepAliveSecs; return this; } public ConnectBuilder willFlag(boolean willFlag) { this.willFlag = willFlag; return this; } public ConnectBuilder willQoS(MqttQoS willQos) { this.willQos = willQos; return this; } public ConnectBuilder willTopic(String willTopic) { this.willTopic = willTopic; return this; } /** * @deprecated use {@link ConnectBuilder#willMessage(byte[])} instead */ @Deprecated public ConnectBuilder willMessage(String willMessage) { willMessage(willMessage == null ? null : willMessage.getBytes(CharsetUtil.UTF_8)); return this; } public ConnectBuilder willMessage(byte[] willMessage) { this.willMessage = willMessage; return this; } public ConnectBuilder willRetain(boolean willRetain) { this.willRetain = willRetain; return this; } public ConnectBuilder willProperties(MqttProperties willProperties) { this.willProperties = willProperties; return this; } public ConnectBuilder hasUser(boolean value) { this.hasUser = value; return this; } public ConnectBuilder hasPassword(boolean value) { this.hasPassword = value; return this; } public ConnectBuilder username(String username) { this.hasUser = username != null; this.username = username; return this; } /** * @deprecated use {@link ConnectBuilder#password(byte[])} instead */ @Deprecated public ConnectBuilder password(String password) { password(password == null ? null : password.getBytes(CharsetUtil.UTF_8)); return this; } public ConnectBuilder password(byte[] password) { this.hasPassword = password != null; this.password = password; return this; } public ConnectBuilder properties(MqttProperties properties) { this.properties = properties; return this; } public MqttConnectMessage build() { MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.CONNECT, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttConnectVariableHeader mqttConnectVariableHeader = new MqttConnectVariableHeader( version.protocolName(), version.protocolLevel(), hasUser, hasPassword, willRetain, willQos.value(), willFlag, cleanSession, keepAliveSecs, properties); MqttConnectPayload mqttConnectPayload = new MqttConnectPayload(clientId, willProperties, willTopic, willMessage, username, password, null); return new MqttConnectMessage(mqttFixedHeader, mqttConnectVariableHeader, mqttConnectPayload); } } public static final class SubscribeBuilder { private List subscriptions; private int messageId; private MqttProperties properties; SubscribeBuilder() { } public SubscribeBuilder addSubscription(MqttQoS qos, String topic) { ensureSubscriptionsExist(); subscriptions.add(new MqttTopicSubscription(topic, qos)); return this; } public SubscribeBuilder addSubscription(String topic, MqttSubscriptionOption option) { ensureSubscriptionsExist(); subscriptions.add(new MqttTopicSubscription(topic, option)); return this; } public SubscribeBuilder messageId(int messageId) { this.messageId = messageId; return this; } public SubscribeBuilder properties(MqttProperties properties) { this.properties = properties; return this; } public MqttSubscribeMessage build() { MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.SUBSCRIBE, false, MqttQoS.AT_LEAST_ONCE, false, 0); MqttMessageIdAndPropertiesVariableHeader mqttVariableHeader = new MqttMessageIdAndPropertiesVariableHeader(messageId, properties); MqttSubscribePayload mqttSubscribePayload = new MqttSubscribePayload(subscriptions); return new MqttSubscribeMessage(mqttFixedHeader, mqttVariableHeader, mqttSubscribePayload); } private void ensureSubscriptionsExist() { if (subscriptions == null) { subscriptions = new ArrayList(5); } } } public static final class UnsubscribeBuilder { private List topicFilters; private int messageId; private MqttProperties properties; UnsubscribeBuilder() { } public UnsubscribeBuilder addTopicFilter(String topic) { if (topicFilters == null) { topicFilters = new ArrayList(5); } topicFilters.add(topic); return this; } public UnsubscribeBuilder messageId(int messageId) { this.messageId = messageId; return this; } public UnsubscribeBuilder properties(MqttProperties properties) { this.properties = properties; return this; } public MqttUnsubscribeMessage build() { MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.UNSUBSCRIBE, false, MqttQoS.AT_LEAST_ONCE, false, 0); MqttMessageIdAndPropertiesVariableHeader mqttVariableHeader = new MqttMessageIdAndPropertiesVariableHeader(messageId, properties); MqttUnsubscribePayload mqttSubscribePayload = new MqttUnsubscribePayload(topicFilters); return new MqttUnsubscribeMessage(mqttFixedHeader, mqttVariableHeader, mqttSubscribePayload); } } public interface PropertiesInitializer { void apply(T builder); } public static final class ConnAckBuilder { private MqttConnectReturnCode returnCode; private boolean sessionPresent; private MqttProperties properties = MqttProperties.NO_PROPERTIES; private ConnAckPropertiesBuilder propsBuilder; private ConnAckBuilder() { } public ConnAckBuilder returnCode(MqttConnectReturnCode returnCode) { this.returnCode = returnCode; return this; } public ConnAckBuilder sessionPresent(boolean sessionPresent) { this.sessionPresent = sessionPresent; return this; } public ConnAckBuilder properties(MqttProperties properties) { this.properties = properties; return this; } public ConnAckBuilder properties(PropertiesInitializer consumer) { if (propsBuilder == null) { propsBuilder = new ConnAckPropertiesBuilder(); } consumer.apply(propsBuilder); return this; } public MqttConnAckMessage build() { if (propsBuilder != null) { properties = propsBuilder.build(); } MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.CONNACK, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttConnAckVariableHeader mqttConnAckVariableHeader = new MqttConnAckVariableHeader(returnCode, sessionPresent, properties); return new MqttConnAckMessage(mqttFixedHeader, mqttConnAckVariableHeader); } } public static final class ConnAckPropertiesBuilder { private String clientId; private Long sessionExpiryInterval; private int receiveMaximum; private Byte maximumQos; private boolean retain; private Long maximumPacketSize; private int topicAliasMaximum; private String reasonString; private final MqttProperties.UserProperties userProperties = new MqttProperties.UserProperties(); private Boolean wildcardSubscriptionAvailable; private Boolean subscriptionIdentifiersAvailable; private Boolean sharedSubscriptionAvailable; private Integer serverKeepAlive; private String responseInformation; private String serverReference; private String authenticationMethod; private byte[] authenticationData; public MqttProperties build() { final MqttProperties props = new MqttProperties(); if (clientId != null) { props.add(new MqttProperties.StringProperty(MqttProperties.MqttPropertyType.ASSIGNED_CLIENT_IDENTIFIER.value(), clientId)); } if (sessionExpiryInterval != null) { props.add(new MqttProperties.IntegerProperty( MqttProperties.MqttPropertyType.SESSION_EXPIRY_INTERVAL.value(), sessionExpiryInterval.intValue())); } if (receiveMaximum > 0) { props.add(new MqttProperties.IntegerProperty(MqttProperties.MqttPropertyType.RECEIVE_MAXIMUM.value(), receiveMaximum)); } if (maximumQos != null) { props.add(new MqttProperties.IntegerProperty(MqttProperties.MqttPropertyType.MAXIMUM_QOS.value(), receiveMaximum)); } props.add(new MqttProperties.IntegerProperty(MqttProperties.MqttPropertyType.RETAIN_AVAILABLE.value(), retain ? 1 : 0)); if (maximumPacketSize != null) { props.add(new MqttProperties.IntegerProperty(MqttProperties.MqttPropertyType.MAXIMUM_PACKET_SIZE.value(), maximumPacketSize.intValue())); } props.add(new MqttProperties.IntegerProperty(MqttProperties.MqttPropertyType.TOPIC_ALIAS_MAXIMUM.value(), topicAliasMaximum)); if (reasonString != null) { props.add(new MqttProperties.StringProperty(MqttProperties.MqttPropertyType.REASON_STRING.value(), reasonString)); } props.add(userProperties); if (wildcardSubscriptionAvailable != null) { props.add(new MqttProperties.IntegerProperty(MqttProperties.MqttPropertyType.WILDCARD_SUBSCRIPTION_AVAILABLE.value(), wildcardSubscriptionAvailable ? 1 : 0)); } if (subscriptionIdentifiersAvailable != null) { props.add(new MqttProperties.IntegerProperty(MqttProperties.MqttPropertyType.SUBSCRIPTION_IDENTIFIER_AVAILABLE.value(), subscriptionIdentifiersAvailable ? 1 : 0)); } if (sharedSubscriptionAvailable != null) { props.add(new MqttProperties.IntegerProperty(MqttProperties.MqttPropertyType.SHARED_SUBSCRIPTION_AVAILABLE.value(), sharedSubscriptionAvailable ? 1 : 0)); } if (serverKeepAlive != null) { props.add(new MqttProperties.IntegerProperty(MqttProperties.MqttPropertyType.SERVER_KEEP_ALIVE.value(), serverKeepAlive)); } if (responseInformation != null) { props.add(new MqttProperties.StringProperty(MqttProperties.MqttPropertyType.RESPONSE_INFORMATION.value(), responseInformation)); } if (serverReference != null) { props.add(new MqttProperties.StringProperty(MqttProperties.MqttPropertyType.SERVER_REFERENCE.value(), serverReference)); } if (authenticationMethod != null) { props.add(new MqttProperties.StringProperty(MqttProperties.MqttPropertyType.AUTHENTICATION_METHOD.value(), authenticationMethod)); } if (authenticationData != null) { props.add(new MqttProperties.BinaryProperty(MqttProperties.MqttPropertyType.AUTHENTICATION_DATA.value(), authenticationData)); } return props; } public ConnAckPropertiesBuilder sessionExpiryInterval(long seconds) { this.sessionExpiryInterval = seconds; return this; } public ConnAckPropertiesBuilder receiveMaximum(int value) { this.receiveMaximum = checkPositive(value, "value"); return this; } public ConnAckPropertiesBuilder maximumQos(byte value) { if (value != 0 && value != 1) { throw new IllegalArgumentException("maximum QoS property could be 0 or 1"); } this.maximumQos = value; return this; } public ConnAckPropertiesBuilder retainAvailable(boolean retain) { this.retain = retain; return this; } public ConnAckPropertiesBuilder maximumPacketSize(long size) { this.maximumPacketSize = checkPositive(size, "size"); return this; } public ConnAckPropertiesBuilder assignedClientId(String clientId) { this.clientId = clientId; return this; } public ConnAckPropertiesBuilder topicAliasMaximum(int value) { this.topicAliasMaximum = value; return this; } public ConnAckPropertiesBuilder reasonString(String reason) { this.reasonString = reason; return this; } public ConnAckPropertiesBuilder userProperty(String name, String value) { userProperties.add(name, value); return this; } public ConnAckPropertiesBuilder wildcardSubscriptionAvailable(boolean value) { this.wildcardSubscriptionAvailable = value; return this; } public ConnAckPropertiesBuilder subscriptionIdentifiersAvailable(boolean value) { this.subscriptionIdentifiersAvailable = value; return this; } public ConnAckPropertiesBuilder sharedSubscriptionAvailable(boolean value) { this.sharedSubscriptionAvailable = value; return this; } public ConnAckPropertiesBuilder serverKeepAlive(int seconds) { this.serverKeepAlive = seconds; return this; } public ConnAckPropertiesBuilder responseInformation(String value) { this.responseInformation = value; return this; } public ConnAckPropertiesBuilder serverReference(String host) { this.serverReference = host; return this; } public ConnAckPropertiesBuilder authenticationMethod(String methodName) { this.authenticationMethod = methodName; return this; } public ConnAckPropertiesBuilder authenticationData(byte[] rawData) { this.authenticationData = rawData.clone(); return this; } } public static final class PubAckBuilder { private int packetId; private byte reasonCode; private MqttProperties properties; PubAckBuilder() { } public PubAckBuilder reasonCode(byte reasonCode) { this.reasonCode = reasonCode; return this; } public PubAckBuilder packetId(int packetId) { this.packetId = packetId; return this; } /** * @deprecated use {@link PubAckBuilder#packetId(int)} instead */ @Deprecated public PubAckBuilder packetId(short packetId) { return packetId(packetId & 0xFFFF); } public PubAckBuilder properties(MqttProperties properties) { this.properties = properties; return this; } public MqttMessage build() { MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.PUBACK, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttPubReplyMessageVariableHeader mqttPubAckVariableHeader = new MqttPubReplyMessageVariableHeader(packetId, reasonCode, properties); return new MqttMessage(mqttFixedHeader, mqttPubAckVariableHeader); } } public static final class SubAckBuilder { private int packetId; private MqttProperties properties; private final List grantedQoses = new ArrayList(); SubAckBuilder() { } public SubAckBuilder packetId(int packetId) { this.packetId = packetId; return this; } /** * @deprecated use {@link SubAckBuilder#packetId(int)} instead */ @Deprecated public SubAckBuilder packetId(short packetId) { return packetId(packetId & 0xFFFF); } public SubAckBuilder properties(MqttProperties properties) { this.properties = properties; return this; } public SubAckBuilder addGrantedQos(MqttQoS qos) { this.grantedQoses.add(qos); return this; } public SubAckBuilder addGrantedQoses(MqttQoS... qoses) { this.grantedQoses.addAll(Arrays.asList(qoses)); return this; } public MqttSubAckMessage build() { MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.SUBACK, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttMessageIdAndPropertiesVariableHeader mqttSubAckVariableHeader = new MqttMessageIdAndPropertiesVariableHeader(packetId, properties); //transform to primitive types int[] grantedQoses = new int[this.grantedQoses.size()]; int i = 0; for (MqttQoS grantedQos : this.grantedQoses) { grantedQoses[i++] = grantedQos.value(); } MqttSubAckPayload subAckPayload = new MqttSubAckPayload(grantedQoses); return new MqttSubAckMessage(mqttFixedHeader, mqttSubAckVariableHeader, subAckPayload); } } public static final class UnsubAckBuilder { private int packetId; private MqttProperties properties; private final List reasonCodes = new ArrayList(); UnsubAckBuilder() { } public UnsubAckBuilder packetId(int packetId) { this.packetId = packetId; return this; } /** * @deprecated use {@link UnsubAckBuilder#packetId(int)} instead */ @Deprecated public UnsubAckBuilder packetId(short packetId) { return packetId(packetId & 0xFFFF); } public UnsubAckBuilder properties(MqttProperties properties) { this.properties = properties; return this; } public UnsubAckBuilder addReasonCode(short reasonCode) { this.reasonCodes.add(reasonCode); return this; } public UnsubAckBuilder addReasonCodes(Short... reasonCodes) { this.reasonCodes.addAll(Arrays.asList(reasonCodes)); return this; } public MqttUnsubAckMessage build() { MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.UNSUBACK, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttMessageIdAndPropertiesVariableHeader mqttSubAckVariableHeader = new MqttMessageIdAndPropertiesVariableHeader(packetId, properties); MqttUnsubAckPayload subAckPayload = new MqttUnsubAckPayload(reasonCodes); return new MqttUnsubAckMessage(mqttFixedHeader, mqttSubAckVariableHeader, subAckPayload); } } public static final class DisconnectBuilder { private MqttProperties properties; private byte reasonCode; DisconnectBuilder() { } public DisconnectBuilder properties(MqttProperties properties) { this.properties = properties; return this; } public DisconnectBuilder reasonCode(byte reasonCode) { this.reasonCode = reasonCode; return this; } public MqttMessage build() { MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.DISCONNECT, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttReasonCodeAndPropertiesVariableHeader mqttDisconnectVariableHeader = new MqttReasonCodeAndPropertiesVariableHeader(reasonCode, properties); return new MqttMessage(mqttFixedHeader, mqttDisconnectVariableHeader); } } public static final class AuthBuilder { private MqttProperties properties; private byte reasonCode; AuthBuilder() { } public AuthBuilder properties(MqttProperties properties) { this.properties = properties; return this; } public AuthBuilder reasonCode(byte reasonCode) { this.reasonCode = reasonCode; return this; } public MqttMessage build() { MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.AUTH, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttReasonCodeAndPropertiesVariableHeader mqttAuthVariableHeader = new MqttReasonCodeAndPropertiesVariableHeader(reasonCode, properties); return new MqttMessage(mqttFixedHeader, mqttAuthVariableHeader); } } public static ConnectBuilder connect() { return new ConnectBuilder(); } public static ConnAckBuilder connAck() { return new ConnAckBuilder(); } public static PublishBuilder publish() { return new PublishBuilder(); } public static SubscribeBuilder subscribe() { return new SubscribeBuilder(); } public static UnsubscribeBuilder unsubscribe() { return new UnsubscribeBuilder(); } public static PubAckBuilder pubAck() { return new PubAckBuilder(); } public static SubAckBuilder subAck() { return new SubAckBuilder(); } public static UnsubAckBuilder unsubAck() { return new UnsubAckBuilder(); } public static DisconnectBuilder disconnect() { return new DisconnectBuilder(); } public static AuthBuilder auth() { return new AuthBuilder(); } private MqttMessageBuilders() { } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttMessageFactory.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.DecoderResult; /** * Utility class with factory methods to create different types of MQTT messages. */ public final class MqttMessageFactory { public static MqttMessage newMessage(MqttFixedHeader mqttFixedHeader, Object variableHeader, Object payload) { switch (mqttFixedHeader.messageType()) { case CONNECT : return new MqttConnectMessage( mqttFixedHeader, (MqttConnectVariableHeader) variableHeader, (MqttConnectPayload) payload); case CONNACK: return new MqttConnAckMessage(mqttFixedHeader, (MqttConnAckVariableHeader) variableHeader); case SUBSCRIBE: return new MqttSubscribeMessage( mqttFixedHeader, (MqttMessageIdVariableHeader) variableHeader, (MqttSubscribePayload) payload); case SUBACK: return new MqttSubAckMessage( mqttFixedHeader, (MqttMessageIdVariableHeader) variableHeader, (MqttSubAckPayload) payload); case UNSUBACK: return new MqttUnsubAckMessage( mqttFixedHeader, (MqttMessageIdVariableHeader) variableHeader, (MqttUnsubAckPayload) payload); case UNSUBSCRIBE: return new MqttUnsubscribeMessage( mqttFixedHeader, (MqttMessageIdVariableHeader) variableHeader, (MqttUnsubscribePayload) payload); case PUBLISH: return new MqttPublishMessage( mqttFixedHeader, (MqttPublishVariableHeader) variableHeader, (ByteBuf) payload); case PUBACK: //Having MqttPubReplyMessageVariableHeader or MqttMessageIdVariableHeader return new MqttPubAckMessage(mqttFixedHeader, (MqttMessageIdVariableHeader) variableHeader); case PUBREC: case PUBREL: case PUBCOMP: //Having MqttPubReplyMessageVariableHeader or MqttMessageIdVariableHeader return new MqttMessage(mqttFixedHeader, variableHeader); case PINGREQ: case PINGRESP: return new MqttMessage(mqttFixedHeader); case DISCONNECT: case AUTH: //Having MqttReasonCodeAndPropertiesVariableHeader return new MqttMessage(mqttFixedHeader, variableHeader); default: throw new IllegalArgumentException("unknown message type: " + mqttFixedHeader.messageType()); } } public static MqttMessage newInvalidMessage(Throwable cause) { return new MqttMessage(null, null, null, DecoderResult.failure(cause)); } public static MqttMessage newInvalidMessage(MqttFixedHeader mqttFixedHeader, Object variableHeader, Throwable cause) { return new MqttMessage(mqttFixedHeader, variableHeader, null, DecoderResult.failure(cause)); } private MqttMessageFactory() { } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttMessageIdAndPropertiesVariableHeader.java ================================================ /* * Copyright 2020 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.StringUtil; /** * Variable Header containing, Packet Id and Properties as in MQTT v5 spec. */ public final class MqttMessageIdAndPropertiesVariableHeader extends MqttMessageIdVariableHeader { private final MqttProperties properties; public MqttMessageIdAndPropertiesVariableHeader(int messageId, MqttProperties properties) { super(messageId); if (messageId < 1 || messageId > 0xffff) { throw new IllegalArgumentException("messageId: " + messageId + " (expected: 1 ~ 65535)"); } this.properties = MqttProperties.withEmptyDefaults(properties); } public MqttProperties properties() { return properties; } @Override public String toString() { return StringUtil.simpleClassName(this) + "[" + "messageId=" + messageId() + ", properties=" + properties + ']'; } @Override MqttMessageIdAndPropertiesVariableHeader withDefaultEmptyProperties() { return this; } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttMessageIdVariableHeader.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.StringUtil; /** * Variable Header containing only Message Id * See MQTTV3.1/msg-id */ public class MqttMessageIdVariableHeader { private final int messageId; public static MqttMessageIdVariableHeader from(int messageId) { if (messageId < 1 || messageId > 0xffff) { throw new IllegalArgumentException("messageId: " + messageId + " (expected: 1 ~ 65535)"); } return new MqttMessageIdVariableHeader(messageId); } protected MqttMessageIdVariableHeader(int messageId) { this.messageId = messageId; } public int messageId() { return messageId; } @Override public String toString() { return new StringBuilder(StringUtil.simpleClassName(this)) .append('[') .append("messageId=").append(messageId) .append(']') .toString(); } public MqttMessageIdAndPropertiesVariableHeader withEmptyProperties() { return new MqttMessageIdAndPropertiesVariableHeader(messageId, MqttProperties.NO_PROPERTIES); } MqttMessageIdAndPropertiesVariableHeader withDefaultEmptyProperties() { return withEmptyProperties(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttMessageType.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; /** * MQTT Message Types. */ public enum MqttMessageType { CONNECT(1), CONNACK(2), PUBLISH(3), PUBACK(4), PUBREC(5), PUBREL(6), PUBCOMP(7), SUBSCRIBE(8), SUBACK(9), UNSUBSCRIBE(10), UNSUBACK(11), PINGREQ(12), PINGRESP(13), DISCONNECT(14), AUTH(15); private static final MqttMessageType[] VALUES; static { // this prevent values to be assigned with the wrong order // and ensure valueOf to work fine final MqttMessageType[] values = values(); VALUES = new MqttMessageType[values.length + 1]; for (MqttMessageType mqttMessageType : values) { final int value = mqttMessageType.value; if (VALUES[value] != null) { throw new AssertionError("value already in use: " + value); } VALUES[value] = mqttMessageType; } } private final int value; MqttMessageType(int value) { this.value = value; } public int value() { return value; } public static MqttMessageType valueOf(int type) { if (type <= 0 || type >= VALUES.length) { throw new IllegalArgumentException("unknown message type: " + type); } return VALUES[type]; } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttProperties.java ================================================ /* * Copyright 2020 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.collection.IntObjectHashMap; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.ArrayList; /** * MQTT Properties container * */ public final class MqttProperties { public enum MqttPropertyType { // single byte properties PAYLOAD_FORMAT_INDICATOR(0x01), REQUEST_PROBLEM_INFORMATION(0x17), REQUEST_RESPONSE_INFORMATION(0x19), MAXIMUM_QOS(0x24), RETAIN_AVAILABLE(0x25), WILDCARD_SUBSCRIPTION_AVAILABLE(0x28), SUBSCRIPTION_IDENTIFIER_AVAILABLE(0x29), SHARED_SUBSCRIPTION_AVAILABLE(0x2A), // two bytes properties SERVER_KEEP_ALIVE(0x13), RECEIVE_MAXIMUM(0x21), TOPIC_ALIAS_MAXIMUM(0x22), TOPIC_ALIAS(0x23), // four bytes properties PUBLICATION_EXPIRY_INTERVAL(0x02), SESSION_EXPIRY_INTERVAL(0x11), WILL_DELAY_INTERVAL(0x18), MAXIMUM_PACKET_SIZE(0x27), // Variable Byte Integer SUBSCRIPTION_IDENTIFIER(0x0B), // UTF-8 Encoded String properties CONTENT_TYPE(0x03), RESPONSE_TOPIC(0x08), ASSIGNED_CLIENT_IDENTIFIER(0x12), AUTHENTICATION_METHOD(0x15), RESPONSE_INFORMATION(0x1A), SERVER_REFERENCE(0x1C), REASON_STRING(0x1F), USER_PROPERTY(0x26), // Binary Data CORRELATION_DATA(0x09), AUTHENTICATION_DATA(0x16); private static final MqttPropertyType[] VALUES; static { VALUES = new MqttPropertyType[43]; for (MqttPropertyType v : values()) { VALUES[v.value] = v; } } private final int value; MqttPropertyType(int value) { this.value = value; } public int value() { return value; } public static MqttPropertyType valueOf(int type) { MqttPropertyType t = null; try { t = VALUES[type]; } catch (ArrayIndexOutOfBoundsException ignored) { // nop } if (t == null) { throw new IllegalArgumentException("unknown property type: " + type); } return t; } } public static final MqttProperties NO_PROPERTIES = new MqttProperties(false); static MqttProperties withEmptyDefaults(MqttProperties properties) { if (properties == null) { return MqttProperties.NO_PROPERTIES; } return properties; } /** * MQTT property base class * * @param property type */ public abstract static class MqttProperty { final T value; final int propertyId; protected MqttProperty(int propertyId, T value) { this.propertyId = propertyId; this.value = value; } /** * Get MQTT property value * * @return property value */ public T value() { return value; } /** * Get MQTT property ID * @return property ID */ public int propertyId() { return propertyId; } @Override public int hashCode() { return propertyId + 31 * value.hashCode(); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } MqttProperty that = (MqttProperty) obj; return this.propertyId == that.propertyId && this.value.equals(that.value); } } public static final class IntegerProperty extends MqttProperty { public IntegerProperty(int propertyId, Integer value) { super(propertyId, value); } @Override public String toString() { return "IntegerProperty(" + propertyId + ", " + value + ")"; } } public static final class StringProperty extends MqttProperty { public StringProperty(int propertyId, String value) { super(propertyId, value); } @Override public String toString() { return "StringProperty(" + propertyId + ", " + value + ")"; } } public static final class StringPair { public final String key; public final String value; public StringPair(String key, String value) { this.key = key; this.value = value; } @Override public int hashCode() { return key.hashCode() + 31 * value.hashCode(); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } StringPair that = (StringPair) obj; return that.key.equals(this.key) && that.value.equals(this.value); } } //User properties are the only properties that may be included multiple times and //are the only properties where ordering is required. Therefore, they need a special handling public static final class UserProperties extends MqttProperty> { public UserProperties() { super(MqttPropertyType.USER_PROPERTY.value, new ArrayList()); } /** * Create user properties from the collection of the String pair values * * @param values string pairs. Collection entries are copied, collection itself isn't shared */ public UserProperties(Collection values) { this(); this.value.addAll(values); } private static UserProperties fromUserPropertyCollection(Collection properties) { UserProperties userProperties = new UserProperties(); for (UserProperty property: properties) { userProperties.add(new StringPair(property.value.key, property.value.value)); } return userProperties; } public void add(StringPair pair) { this.value.add(pair); } public void add(String key, String value) { this.value.add(new StringPair(key, value)); } @Override public String toString() { StringBuilder builder = new StringBuilder("UserProperties("); boolean first = true; for (StringPair pair: value) { if (!first) { builder.append(", "); } builder.append(pair.key + "->" + pair.value); first = false; } builder.append(")"); return builder.toString(); } } public static final class UserProperty extends MqttProperty { public UserProperty(String key, String value) { super(MqttPropertyType.USER_PROPERTY.value, new StringPair(key, value)); } @Override public String toString() { return "UserProperty(" + value.key + ", " + value.value + ")"; } } public static final class BinaryProperty extends MqttProperty { public BinaryProperty(int propertyId, byte[] value) { super(propertyId, value); } @Override public String toString() { return "BinaryProperty(" + propertyId + ", " + value.length + " bytes)"; } } public MqttProperties() { this(true); } private MqttProperties(boolean canModify) { this.canModify = canModify; } private IntObjectHashMap props; private List userProperties; private List subscriptionIds; private final boolean canModify; public void add(MqttProperty property) { if (!canModify) { throw new UnsupportedOperationException("adding property isn't allowed"); } IntObjectHashMap props = this.props; if (property.propertyId == MqttPropertyType.USER_PROPERTY.value) { List userProperties = this.userProperties; if (userProperties == null) { userProperties = new ArrayList(1); this.userProperties = userProperties; } if (property instanceof UserProperty) { userProperties.add((UserProperty) property); } else if (property instanceof UserProperties) { for (StringPair pair: ((UserProperties) property).value) { userProperties.add(new UserProperty(pair.key, pair.value)); } } else { throw new IllegalArgumentException("User property must be of UserProperty or UserProperties type"); } } else if (property.propertyId == MqttPropertyType.SUBSCRIPTION_IDENTIFIER.value) { List subscriptionIds = this.subscriptionIds; if (subscriptionIds == null) { subscriptionIds = new ArrayList(1); this.subscriptionIds = subscriptionIds; } if (property instanceof IntegerProperty) { subscriptionIds.add((IntegerProperty) property); } else { throw new IllegalArgumentException("Subscription ID must be an integer property"); } } else { if (props == null) { props = new IntObjectHashMap(); this.props = props; } props.put(property.propertyId, property); } } public Collection listAll() { IntObjectHashMap props = this.props; if (props == null && subscriptionIds == null && userProperties == null) { return Collections.emptyList(); } if (subscriptionIds == null && userProperties == null) { return props.values(); } if (props == null && userProperties == null) { return subscriptionIds; } List propValues = new ArrayList(props != null ? props.size() : 1); if (props != null) { propValues.addAll(props.values()); } if (subscriptionIds != null) { propValues.addAll(subscriptionIds); } if (userProperties != null) { propValues.add(UserProperties.fromUserPropertyCollection(userProperties)); } return propValues; } public boolean isEmpty() { IntObjectHashMap props = this.props; return props == null || props.isEmpty(); } /** * Get property by ID. If there are multiple properties of this type (can be with Subscription ID) * then return the first one. * * @param propertyId ID of the property * @return a property if it is set, null otherwise */ public MqttProperty getProperty(int propertyId) { if (propertyId == MqttPropertyType.USER_PROPERTY.value) { //special handling to keep compatibility with earlier versions List userProperties = this.userProperties; if (userProperties == null) { return null; } return UserProperties.fromUserPropertyCollection(userProperties); } if (propertyId == MqttPropertyType.SUBSCRIPTION_IDENTIFIER.value) { List subscriptionIds = this.subscriptionIds; if (subscriptionIds == null || subscriptionIds.isEmpty()) { return null; } return subscriptionIds.get(0); } IntObjectHashMap props = this.props; return props == null ? null : props.get(propertyId); } /** * Get properties by ID. * Some properties (Subscription ID and User Properties) may occur multiple times, * this method returns all their values in order. * * @param propertyId ID of the property * @return all properties having specified ID */ public List getProperties(int propertyId) { if (propertyId == MqttPropertyType.USER_PROPERTY.value) { return userProperties == null ? Collections.emptyList() : userProperties; } if (propertyId == MqttPropertyType.SUBSCRIPTION_IDENTIFIER.value) { return subscriptionIds == null ? Collections.emptyList() : subscriptionIds; } IntObjectHashMap props = this.props; return (props == null || !props.containsKey(propertyId)) ? Collections.emptyList() : Collections.singletonList(props.get(propertyId)); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttPubAckMessage.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; /** * See MQTTV3.1/puback */ public final class MqttPubAckMessage extends MqttMessage { public MqttPubAckMessage(MqttFixedHeader mqttFixedHeader, MqttMessageIdVariableHeader variableHeader) { super(mqttFixedHeader, variableHeader); } @Override public MqttMessageIdVariableHeader variableHeader() { return (MqttMessageIdVariableHeader) super.variableHeader(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttPubReplyMessageVariableHeader.java ================================================ /* * Copyright 2020 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.StringUtil; /** * Variable Header containing Packet Id, reason code and Properties as in MQTT v5 spec. */ public final class MqttPubReplyMessageVariableHeader extends MqttMessageIdVariableHeader { private final byte reasonCode; private final MqttProperties properties; public static final byte REASON_CODE_OK = 0; public MqttPubReplyMessageVariableHeader(int messageId, byte reasonCode, MqttProperties properties) { super(messageId); if (messageId < 1 || messageId > 0xffff) { throw new IllegalArgumentException("messageId: " + messageId + " (expected: 1 ~ 65535)"); } this.reasonCode = reasonCode; this.properties = MqttProperties.withEmptyDefaults(properties); } public byte reasonCode() { return reasonCode; } public MqttProperties properties() { return properties; } @Override public String toString() { return StringUtil.simpleClassName(this) + "[" + "messageId=" + messageId() + ", reasonCode=" + reasonCode + ", properties=" + properties + ']'; } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttPublishMessage.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufHolder; import io.netty.buffer.ByteBufUtil; /** * See MQTTV3.1/publish */ public class MqttPublishMessage extends MqttMessage implements ByteBufHolder { public MqttPublishMessage( MqttFixedHeader mqttFixedHeader, MqttPublishVariableHeader variableHeader, ByteBuf payload) { super(mqttFixedHeader, variableHeader, payload); } @Override public MqttPublishVariableHeader variableHeader() { return (MqttPublishVariableHeader) super.variableHeader(); } @Override public ByteBuf payload() { return content(); } @Override public ByteBuf content() { return ByteBufUtil.ensureAccessible((ByteBuf) super.payload()); } @Override public MqttPublishMessage copy() { return replace(content().copy()); } @Override public MqttPublishMessage duplicate() { return replace(content().duplicate()); } @Override public MqttPublishMessage retainedDuplicate() { return replace(content().retainedDuplicate()); } @Override public MqttPublishMessage replace(ByteBuf content) { return new MqttPublishMessage(fixedHeader(), variableHeader(), content); } @Override public int refCnt() { return content().refCnt(); } @Override public MqttPublishMessage retain() { content().retain(); return this; } @Override public MqttPublishMessage retain(int increment) { content().retain(increment); return this; } @Override public MqttPublishMessage touch() { content().touch(); return this; } @Override public MqttPublishMessage touch(Object hint) { content().touch(hint); return this; } @Override public boolean release() { return content().release(); } @Override public boolean release(int decrement) { return content().release(decrement); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttPublishVariableHeader.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.StringUtil; /** * Variable Header of the {@link MqttPublishMessage} */ public final class MqttPublishVariableHeader { private final String topicName; private int packetId; private final MqttProperties properties; public MqttPublishVariableHeader(String topicName, int packetId) { this(topicName, packetId, MqttProperties.NO_PROPERTIES); } public MqttPublishVariableHeader(String topicName, int packetId, MqttProperties properties) { this.topicName = topicName; this.packetId = packetId; this.properties = MqttProperties.withEmptyDefaults(properties); } public String topicName() { return topicName; } /** * @deprecated Use {@link #packetId()} instead. */ @Deprecated public int messageId() { return packetId; } public int packetId() { return packetId; } public MqttProperties properties() { return properties; } public void setPacketId(int packetId) { this.packetId = packetId; } @Override public String toString() { return new StringBuilder(StringUtil.simpleClassName(this)) .append('[') .append("topicName=").append(topicName) .append(", packetId=").append(packetId) .append(']') .toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttQoS.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, version 2.0 (the * "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package io.netty.handler.codec.mqtt; public enum MqttQoS { AT_MOST_ONCE(0), AT_LEAST_ONCE(1), EXACTLY_ONCE(2), FAILURE(0x80); private final int value; MqttQoS(int value) { this.value = value; } public int value() { return value; } public static MqttQoS valueOf(int value) { switch (value) { case 0: return AT_MOST_ONCE; case 1: return AT_LEAST_ONCE; case 2: return EXACTLY_ONCE; case 0x80: return FAILURE; default: throw new IllegalArgumentException("invalid QoS: " + value); } } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttReasonCodeAndPropertiesVariableHeader.java ================================================ /* * Copyright 2020 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.StringUtil; /** * Variable Header for AUTH and DISCONNECT messages represented by {@link MqttMessage} */ public final class MqttReasonCodeAndPropertiesVariableHeader { private final byte reasonCode; private final MqttProperties properties; public static final byte REASON_CODE_OK = 0; public MqttReasonCodeAndPropertiesVariableHeader(byte reasonCode, MqttProperties properties) { this.reasonCode = reasonCode; this.properties = MqttProperties.withEmptyDefaults(properties); } public byte reasonCode() { return reasonCode; } public MqttProperties properties() { return properties; } @Override public String toString() { return new StringBuilder(StringUtil.simpleClassName(this)) .append('[') .append("reasonCode=").append(reasonCode) .append(", properties=").append(properties) .append(']') .toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttSubAckMessage.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; /** * See MQTTV3.1/suback */ public final class MqttSubAckMessage extends MqttMessage { public MqttSubAckMessage( MqttFixedHeader mqttFixedHeader, MqttMessageIdAndPropertiesVariableHeader variableHeader, MqttSubAckPayload payload) { super(mqttFixedHeader, variableHeader, payload); } public MqttSubAckMessage( MqttFixedHeader mqttFixedHeader, MqttMessageIdVariableHeader variableHeader, MqttSubAckPayload payload) { this(mqttFixedHeader, variableHeader.withDefaultEmptyProperties(), payload); } @Override public MqttMessageIdVariableHeader variableHeader() { return (MqttMessageIdVariableHeader) super.variableHeader(); } public MqttMessageIdAndPropertiesVariableHeader idAndPropertiesVariableHeader() { return (MqttMessageIdAndPropertiesVariableHeader) super.variableHeader(); } @Override public MqttSubAckPayload payload() { return (MqttSubAckPayload) super.payload(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttSubAckPayload.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.ObjectUtil; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * Payload of the {@link MqttSubAckMessage} */ public class MqttSubAckPayload { private final List reasonCodes; public MqttSubAckPayload(int... reasonCodes) { ObjectUtil.checkNotNull(reasonCodes, "reasonCodes"); List list = new ArrayList(reasonCodes.length); for (int v: reasonCodes) { list.add(v); } this.reasonCodes = Collections.unmodifiableList(list); } public MqttSubAckPayload(Iterable reasonCodes) { ObjectUtil.checkNotNull(reasonCodes, "reasonCodes"); List list = new ArrayList(); for (Integer v: reasonCodes) { if (v == null) { break; } list.add(v); } this.reasonCodes = Collections.unmodifiableList(list); } public List grantedQoSLevels() { List qosLevels = new ArrayList(reasonCodes.size()); for (int code: reasonCodes) { if (code > MqttQoS.EXACTLY_ONCE.value()) { qosLevels.add(MqttQoS.FAILURE.value()); } else { qosLevels.add(code); } } return qosLevels; } public List reasonCodes() { return reasonCodes; } @Override public String toString() { return new StringBuilder(StringUtil.simpleClassName(this)) .append('[') .append("reasonCodes=").append(reasonCodes) .append(']') .toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttSubscribeMessage.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; /** * See * MQTTV3.1/subscribe */ public final class MqttSubscribeMessage extends MqttMessage { public MqttSubscribeMessage( MqttFixedHeader mqttFixedHeader, MqttMessageIdAndPropertiesVariableHeader variableHeader, MqttSubscribePayload payload) { super(mqttFixedHeader, variableHeader, payload); } public MqttSubscribeMessage( MqttFixedHeader mqttFixedHeader, MqttMessageIdVariableHeader variableHeader, MqttSubscribePayload payload) { this(mqttFixedHeader, variableHeader.withDefaultEmptyProperties(), payload); } @Override public MqttMessageIdVariableHeader variableHeader() { return (MqttMessageIdVariableHeader) super.variableHeader(); } public MqttMessageIdAndPropertiesVariableHeader idAndPropertiesVariableHeader() { return (MqttMessageIdAndPropertiesVariableHeader) super.variableHeader(); } @Override public MqttSubscribePayload payload() { return (MqttSubscribePayload) super.payload(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttSubscribePayload.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.StringUtil; import java.util.Collections; import java.util.List; /** * Payload of the {@link MqttSubscribeMessage} */ public final class MqttSubscribePayload { private final List topicSubscriptions; public MqttSubscribePayload(List topicSubscriptions) { this.topicSubscriptions = Collections.unmodifiableList(topicSubscriptions); } public List topicSubscriptions() { return topicSubscriptions; } @Override public String toString() { StringBuilder builder = new StringBuilder(StringUtil.simpleClassName(this)).append('['); for (int i = 0; i < topicSubscriptions.size(); i++) { builder.append(topicSubscriptions.get(i)).append(", "); } if (!topicSubscriptions.isEmpty()) { builder.setLength(builder.length() - 2); } return builder.append(']').toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttSubscriptionOption.java ================================================ /* * Copyright 2020 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; /** * Model the SubscriptionOption used in Subscribe MQTT v5 packet */ public final class MqttSubscriptionOption { public enum RetainedHandlingPolicy { SEND_AT_SUBSCRIBE(0), SEND_AT_SUBSCRIBE_IF_NOT_YET_EXISTS(1), DONT_SEND_AT_SUBSCRIBE(2); private final int value; RetainedHandlingPolicy(int value) { this.value = value; } public int value() { return value; } public static RetainedHandlingPolicy valueOf(int value) { switch (value) { case 0: return SEND_AT_SUBSCRIBE; case 1: return SEND_AT_SUBSCRIBE_IF_NOT_YET_EXISTS; case 2: return DONT_SEND_AT_SUBSCRIBE; default: throw new IllegalArgumentException("invalid RetainedHandlingPolicy: " + value); } } } private final MqttQoS qos; private final boolean noLocal; private final boolean retainAsPublished; private final RetainedHandlingPolicy retainHandling; public static MqttSubscriptionOption onlyFromQos(MqttQoS qos) { return new MqttSubscriptionOption(qos, false, false, RetainedHandlingPolicy.SEND_AT_SUBSCRIBE); } public MqttSubscriptionOption(MqttQoS qos, boolean noLocal, boolean retainAsPublished, RetainedHandlingPolicy retainHandling) { this.qos = qos; this.noLocal = noLocal; this.retainAsPublished = retainAsPublished; this.retainHandling = retainHandling; } public MqttQoS qos() { return qos; } public boolean isNoLocal() { return noLocal; } public boolean isRetainAsPublished() { return retainAsPublished; } public RetainedHandlingPolicy retainHandling() { return retainHandling; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } MqttSubscriptionOption that = (MqttSubscriptionOption) o; if (noLocal != that.noLocal) { return false; } if (retainAsPublished != that.retainAsPublished) { return false; } if (qos != that.qos) { return false; } return retainHandling == that.retainHandling; } @Override public int hashCode() { int result = qos.hashCode(); result = 31 * result + (noLocal ? 1 : 0); result = 31 * result + (retainAsPublished ? 1 : 0); result = 31 * result + retainHandling.hashCode(); return result; } @Override public String toString() { return "SubscriptionOption[" + "qos=" + qos + ", noLocal=" + noLocal + ", retainAsPublished=" + retainAsPublished + ", retainHandling=" + retainHandling + ']'; } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttTopicSubscription.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.StringUtil; /** * Contains a topic name and Qos Level. * This is part of the {@link MqttSubscribePayload} */ public final class MqttTopicSubscription { private final String topicFilter; private final MqttSubscriptionOption option; public MqttTopicSubscription(String topicFilter, MqttQoS qualityOfService) { this.topicFilter = topicFilter; this.option = MqttSubscriptionOption.onlyFromQos(qualityOfService); } public MqttTopicSubscription(String topicFilter, MqttSubscriptionOption option) { this.topicFilter = topicFilter; this.option = option; } public String topicName() { return topicFilter; } public MqttQoS qualityOfService() { return option.qos(); } public MqttSubscriptionOption option() { return option; } @Override public String toString() { return new StringBuilder(StringUtil.simpleClassName(this)) .append('[') .append("topicFilter=").append(topicFilter) .append(", option=").append(this.option) .append(']') .toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttUnacceptableProtocolVersionException.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.handler.codec.DecoderException; /** * A {@link MqttUnacceptableProtocolVersionException} which is thrown when * a CONNECT request contains unacceptable protocol version. */ public final class MqttUnacceptableProtocolVersionException extends DecoderException { private static final long serialVersionUID = 4914652213232455749L; /** * Creates a new instance */ public MqttUnacceptableProtocolVersionException() { } /** * Creates a new instance */ public MqttUnacceptableProtocolVersionException(String message, Throwable cause) { super(message, cause); } /** * Creates a new instance */ public MqttUnacceptableProtocolVersionException(String message) { super(message); } /** * Creates a new instance */ public MqttUnacceptableProtocolVersionException(Throwable cause) { super(cause); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttUnsubAckMessage.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; /** * See * MQTTV3.1/unsuback */ public final class MqttUnsubAckMessage extends MqttMessage { public MqttUnsubAckMessage(MqttFixedHeader mqttFixedHeader, MqttMessageIdAndPropertiesVariableHeader variableHeader, MqttUnsubAckPayload payload) { super(mqttFixedHeader, variableHeader, MqttUnsubAckPayload.withEmptyDefaults(payload)); } public MqttUnsubAckMessage(MqttFixedHeader mqttFixedHeader, MqttMessageIdVariableHeader variableHeader, MqttUnsubAckPayload payload) { this(mqttFixedHeader, fallbackVariableHeader(variableHeader), payload); } public MqttUnsubAckMessage(MqttFixedHeader mqttFixedHeader, MqttMessageIdVariableHeader variableHeader) { this(mqttFixedHeader, variableHeader, null); } private static MqttMessageIdAndPropertiesVariableHeader fallbackVariableHeader( MqttMessageIdVariableHeader variableHeader) { if (variableHeader instanceof MqttMessageIdAndPropertiesVariableHeader) { return (MqttMessageIdAndPropertiesVariableHeader) variableHeader; } return new MqttMessageIdAndPropertiesVariableHeader(variableHeader.messageId(), MqttProperties.NO_PROPERTIES); } @Override public MqttMessageIdVariableHeader variableHeader() { return (MqttMessageIdVariableHeader) super.variableHeader(); } public MqttMessageIdAndPropertiesVariableHeader idAndPropertiesVariableHeader() { return (MqttMessageIdAndPropertiesVariableHeader) super.variableHeader(); } @Override public MqttUnsubAckPayload payload() { return (MqttUnsubAckPayload) super.payload(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttUnsubAckPayload.java ================================================ /* * Copyright 2020 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.ObjectUtil; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * Payload for MQTT unsuback message as in V5. */ public final class MqttUnsubAckPayload { private final List unsubscribeReasonCodes; private static final MqttUnsubAckPayload EMPTY = new MqttUnsubAckPayload(); public static MqttUnsubAckPayload withEmptyDefaults(MqttUnsubAckPayload payload) { if (payload == null) { return EMPTY; } else { return payload; } } public MqttUnsubAckPayload(short... unsubscribeReasonCodes) { ObjectUtil.checkNotNull(unsubscribeReasonCodes, "unsubscribeReasonCodes"); List list = new ArrayList(unsubscribeReasonCodes.length); for (Short v: unsubscribeReasonCodes) { list.add(v); } this.unsubscribeReasonCodes = Collections.unmodifiableList(list); } public MqttUnsubAckPayload(Iterable unsubscribeReasonCodes) { ObjectUtil.checkNotNull(unsubscribeReasonCodes, "unsubscribeReasonCodes"); List list = new ArrayList(); for (Short v: unsubscribeReasonCodes) { ObjectUtil.checkNotNull(v, "unsubscribeReasonCode"); list.add(v); } this.unsubscribeReasonCodes = Collections.unmodifiableList(list); } public List unsubscribeReasonCodes() { return unsubscribeReasonCodes; } @Override public String toString() { return new StringBuilder(StringUtil.simpleClassName(this)) .append('[') .append("unsubscribeReasonCodes=").append(unsubscribeReasonCodes) .append(']') .toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttUnsubscribeMessage.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; /** * See * MQTTV3.1/unsubscribe */ public final class MqttUnsubscribeMessage extends MqttMessage { public MqttUnsubscribeMessage( MqttFixedHeader mqttFixedHeader, MqttMessageIdAndPropertiesVariableHeader variableHeader, MqttUnsubscribePayload payload) { super(mqttFixedHeader, variableHeader, payload); } public MqttUnsubscribeMessage( MqttFixedHeader mqttFixedHeader, MqttMessageIdVariableHeader variableHeader, MqttUnsubscribePayload payload) { this(mqttFixedHeader, variableHeader.withDefaultEmptyProperties(), payload); } @Override public MqttMessageIdVariableHeader variableHeader() { return (MqttMessageIdVariableHeader) super.variableHeader(); } public MqttMessageIdAndPropertiesVariableHeader idAndPropertiesVariableHeader() { return (MqttMessageIdAndPropertiesVariableHeader) super.variableHeader(); } @Override public MqttUnsubscribePayload payload() { return (MqttUnsubscribePayload) super.payload(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttUnsubscribePayload.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.internal.StringUtil; import java.util.Collections; import java.util.List; /** * Payload of the {@link MqttUnsubscribeMessage} */ public final class MqttUnsubscribePayload { private final List topics; public MqttUnsubscribePayload(List topics) { this.topics = Collections.unmodifiableList(topics); } public List topics() { return topics; } @Override public String toString() { StringBuilder builder = new StringBuilder(StringUtil.simpleClassName(this)).append('['); for (int i = 0; i < topics.size(); i++) { builder.append("topicName = ").append(topics.get(i)).append(", "); } if (!topics.isEmpty()) { builder.setLength(builder.length() - 2); } return builder.append("]").toString(); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/MqttVersion.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, * version 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations * under the License. */ package io.netty.handler.codec.mqtt; import io.netty.util.CharsetUtil; import io.netty.util.internal.ObjectUtil; /** * Mqtt version specific constant values used by multiple classes in mqtt-codec. */ public enum MqttVersion { MQTT_3_1("MQIsdp", (byte) 3), MQTT_3_1_1("MQTT", (byte) 4), MQTT_5("MQTT", (byte) 5), Wildfire_2("MQTT", (byte) 6), Wildfire_Future("MQTT", (byte) 7); private final String name; private final byte level; MqttVersion(String protocolName, byte protocolLevel) { name = ObjectUtil.checkNotNull(protocolName, "protocolName"); level = protocolLevel; } public String protocolName() { return name; } public byte[] protocolNameBytes() { return name.getBytes(CharsetUtil.UTF_8); } public byte protocolLevel() { return level; } public static MqttVersion fromProtocolNameAndLevel(String protocolName, byte protocolLevel) { MqttVersion mv = null; switch (protocolLevel) { case 3: mv = MQTT_3_1; break; case 4: mv = MQTT_3_1_1; break; case 5: mv = MQTT_5; break; case 6: mv = Wildfire_2; break; case 7: mv = Wildfire_Future; break; default: mv = Wildfire_Future; break; } return mv; } public static MqttVersion fromProtocolLevel(int protocolLevel) { for (MqttVersion mv : values()) { if (mv.level == (byte )protocolLevel) { return mv; } } if(protocolLevel > Wildfire_Future.level) { return Wildfire_Future; } throw new MqttUnacceptableProtocolVersionException(protocolLevel + "is unknown protocol level"); } } ================================================ FILE: broker/src/main/java/io/netty/handler/codec/mqtt/package-info.java ================================================ /* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, version 2.0 (the * "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at: * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ /** * Encoder, decoder and different Message Types for MQTT. */ package io.netty.handler.codec.mqtt; ================================================ FILE: broker/src/main/java/win/liyufan/im/DBUtil.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package win.liyufan.im; import java.beans.PropertyVetoException; import java.io.BufferedReader; import java.io.FileReader; import java.math.BigInteger; import java.sql.*; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; import com.hazelcast.util.StringUtil; import com.mchange.v2.c3p0.ComboPooledDataSource; import io.moquette.BrokerConstants; import io.moquette.server.config.IConfig; import org.flywaydb.core.Flyway; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.ConcurrentHashMap; import static cn.wildfirechat.common.IMExceptionEvent.EventType.RDBS_Exception; public class DBUtil { private static final Logger LOG = LoggerFactory.getLogger(DBUtil.class); private static ComboPooledDataSource comboPooledDataSource = null; private static ConcurrentHashMapmap = new ConcurrentHashMap<>(); private static ThreadLocal transactionConnection = new ThreadLocal() { @Override protected Connection initialValue() { super.initialValue(); return null; } }; public static boolean IsEmbedDB = false; public static boolean SystemExiting = false; public static boolean ClearDBDebugMode = false; public static void init(IConfig config) { String embedDB = config.getProperty(BrokerConstants.EMBED_DB_PROPERTY_NAME); String h2dbPath = config.getProperty(BrokerConstants.H2DB_PATH, "./h2db/wfchat"); boolean autoCleanMsgs = "true".equals(config.getProperty(BrokerConstants.DB_AUTO_CLEAN_HISTORY_MESSAGES)); if (embedDB != null && embedDB.equals("1")) { IsEmbedDB = true; LOG.info("Use h2 database"); String warning = "您正在使用h2数据库,建议仅在开发验证或者用户数小于100人时才使用此数据库。正式上线时建议切换到MySQL数据库。"; System.out.println(warning); LOG.warn(warning); } else { IsEmbedDB = false; LOG.info("Use mysql database"); } if (comboPooledDataSource == null) { String migrateLocation; if (IsEmbedDB) { migrateLocation = "filesystem:./migrate/h2"; comboPooledDataSource = new ComboPooledDataSource(); comboPooledDataSource.setJdbcUrl( "jdbc:h2:" + h2dbPath + ";AUTO_SERVER=TRUE;MODE=MySQL" ); comboPooledDataSource.setUser("SA"); comboPooledDataSource.setPassword("SA"); comboPooledDataSource.setMinPoolSize(5); comboPooledDataSource.setAcquireIncrement(5); comboPooledDataSource.setMaxPoolSize(20); comboPooledDataSource.setIdleConnectionTestPeriod(60 * 5); comboPooledDataSource.setMinPoolSize(3); comboPooledDataSource.setInitialPoolSize(3); try { comboPooledDataSource.setDriverClass( "org.h2.Driver" ); //loads the jdbc driver } catch (PropertyVetoException e) { e.printStackTrace(); Utility.printExecption(LOG, e); System.exit(-1); } } else { migrateLocation = "filesystem:./migrate/mysql"; comboPooledDataSource = new ComboPooledDataSource("mysql"); try { String url01 = comboPooledDataSource.getJdbcUrl().substring(0,comboPooledDataSource.getJdbcUrl().indexOf("?")); String datasourceName = url01.substring(url01.lastIndexOf("/")+1); // 连接已经存在的数据库,如:mysql String jdbc = comboPooledDataSource.getJdbcUrl().replace(datasourceName, ""); Connection connection = DriverManager.getConnection(jdbc, comboPooledDataSource.getUser(), comboPooledDataSource.getPassword()); Statement statement = connection.createStatement(); // 创建数据库 statement.executeUpdate("CREATE DATABASE IF NOT EXISTS `" + datasourceName + "` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"); statement.close(); connection.close(); } catch (Exception e) { e.printStackTrace(); System.exit(-1); } } Flyway flyway = Flyway.configure().dataSource(comboPooledDataSource).locations(migrateLocation).baselineOnMigrate(true).load(); if(!IsEmbedDB) { if(flyway.info().current() == null) { System.out.println("数据库执行初始化需要较长时间,可能长达数分钟或更长,请耐心等待,不要中断。。。"); } else if(flyway.info().current().getVersion().getMajor().intValue() < 43) { System.out.println("数据库执行升级需要较长时间,可能长达数分钟或更长,请耐心等待,不要中断。。。"); } if(flyway.info().current() != null && flyway.info().current().getVersion().getMajor().intValue() < 55) { Connection connection = null; PreparedStatement statement = null; try { connection = getConnection(); String sql = "update flyway_schema_history set checksum = ? where version = ? and checksum = ?"; statement = connection.prepareStatement(sql); int index = 1; statement.setLong(index++, -931486413L); statement.setString(index++, "3"); statement.setLong(index++, 478454046L); statement.executeUpdate(); } catch (SQLException e) { Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement); } } } flyway.migrate(); if(autoCleanMsgs) { cleanHistoryMsg(); } } } private static void cleanHistoryMsg() { new Thread(()->{ long usedTime = 0; while (true) { if(SystemExiting) { break; } try { long sleepTime; if(ClearDBDebugMode) { sleepTime = 60 * 1000 - usedTime; } else { sleepTime = 60 * 60 * 1000 - usedTime; } if(sleepTime < 0) { sleepTime = 5 * 1000; } Thread.sleep(sleepTime); LOG.info("Start clean history messages"); if(SystemExiting) { break; } long start = System.currentTimeMillis(); if(IsEmbedDB) { clearH2DB(); } else { clearMySQL(); } usedTime = System.currentTimeMillis() - start; } catch (InterruptedException e) { e.printStackTrace(); } } }).start(); } private static boolean sleep() { if(SystemExiting) return true; try { if(ClearDBDebugMode) { Thread.sleep(500); } else { Thread.sleep(10000); } } catch (InterruptedException e) { e.printStackTrace(); } return SystemExiting; } private static long getMaxMidNeedClean() { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(Calendar.YEAR, -3); cal.add(Calendar.DATE, 1); return MessageShardingUtil.getMsgIdFromTimestamp(cal.getTimeInMillis()); } private static void clearH2DB() { clearOneTable("t_user_messages"); if(sleep()) { return; } clearOneTable("t_messages"); } private static void clearMySQL() { for (int i = 0; i < 128; i++) { clearOneTable("t_user_messages_" + i); if(sleep()) { return; } } String msgTableName = MessageShardingUtil.getMessageTable(MessageShardingUtil.getMsgIdFromTimestamp(System.currentTimeMillis())); clearOneTable(msgTableName); } private static void clearOneTable(String tableName) { Connection connection = null; PreparedStatement statement = null; ResultSet rs = null; long mid = getMaxMidNeedClean(); try { connection = DBUtil.getConnection(); String sql = "delete from " + tableName + " where _mid <= " + mid; statement = connection.prepareStatement(sql); int count = statement.executeUpdate(); LOG.info("Delete history message {} rows", count); } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e, RDBS_Exception); } finally { DBUtil.closeDB(connection, statement, rs); } } private static List getCreateSql() { List out = new ArrayList<>(); try{ BufferedReader br = new BufferedReader(new FileReader("h2/create_table.sql"));//构造一个BufferedReader类来读取文件 String s = null; StringBuilder result = new StringBuilder(); while((s = br.readLine())!=null) { result.append(s); if (s.contains(";")) { out.add(result.toString()); result = new StringBuilder(); } } br.close(); }catch(Exception e){ e.printStackTrace(); Utility.printExecption(LOG, e); } return out; } //从数据源中获取数据库的连接 public static Connection getConnection() throws SQLException { long threadId = Thread.currentThread().getId(); if (map.get(threadId) != null) { LOG.error("error here!!!! DB connection not close correctly"); } map.put(threadId, Thread.currentThread().getStackTrace().toString()); Connection connection = transactionConnection.get(); if (connection != null) { LOG.debug("Thread {} get db connection {}", threadId, connection); return connection; } connection = comboPooledDataSource.getConnection(); LOG.debug("Thread {} get db connection {}", threadId, connection); return connection; } public static void beginTransaction() { try { Connection connection = getConnection(); connection.setAutoCommit(false); transactionConnection.set(connection); } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } public static void commit() { try { Connection connection = transactionConnection.get(); if (connection != null) { connection.commit(); connection.setAutoCommit(true); transactionConnection.remove(); } } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } public static void roolback() { try { Connection connection = transactionConnection.get(); if (connection != null) { connection.rollback(); connection.setAutoCommit(true); transactionConnection.remove(); }; } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } //释放资源,将数据库连接还给数据库连接池 public static void closeDB(Connection conn,PreparedStatement ps,ResultSet rs) { LOG.debug("Thread {} release db connection {}", Thread.currentThread().getId(), conn); try { if (rs!=null) { rs.close(); } } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } try { if (ps!=null) { ps.close(); } } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } try { if (conn!=null && transactionConnection.get() != conn) { conn.close(); map.remove(Thread.currentThread().getId()); } } catch (Exception e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } //释放资源,将数据库连接还给数据库连接池 public static void closeDB(Connection conn, PreparedStatement ps) { LOG.debug("Thread {} release db connection {}", Thread.currentThread().getId(), conn); try { if (ps!=null) { ps.close(); } } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } try { if (conn!=null && transactionConnection.get() != conn) { conn.close(); map.remove(Thread.currentThread().getId()); } } catch (SQLException e) { e.printStackTrace(); Utility.printExecption(LOG, e); } } } ================================================ FILE: broker/src/main/java/win/liyufan/im/FrequencyLimistCounter.java ================================================ package win.liyufan.im; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * 频率限制计数器,由于线程并发问题,并不一定严格准确,但总体可用 */ public class FrequencyLimistCounter { private final Map CACHE_MAP = new HashMap<>(); private final Map CACHE_TIME_MAP = new HashMap<>(); private long CACHE_HOLD_TIME = 5 * 1000; private int FREQUENCY_LIMIT = 100; private final SpinLock mLock = new SpinLock(); private long lastFullScanTime = System.currentTimeMillis(); //2个小时全部扫描一次 private static final long fullScanDuration = 2*60*60*1000; public FrequencyLimistCounter(int limitTimeSec, int limitCount) { this.CACHE_HOLD_TIME = limitTimeSec * 1000; this.FREQUENCY_LIMIT = limitCount; } public FrequencyLimistCounter() { } /** * 增加对象计数并返回是否超频 * @param cacheName * @return ture 超频; false 不超频 */ public boolean increaseAndCheck(String cacheName) { mLock.lock(); try { tryFullScan(); Long cacheHoldTime = CACHE_TIME_MAP.get(cacheName); if (cacheHoldTime != null && cacheHoldTime < System.currentTimeMillis()) { CACHE_MAP.remove(cacheName); CACHE_TIME_MAP.remove(cacheName); } Integer count = CACHE_MAP.get(cacheName); if (count != null) { CACHE_MAP.put(cacheName, ++count); } else { count = 0; CACHE_MAP.put(cacheName, ++count); CACHE_TIME_MAP.put(cacheName, (System.currentTimeMillis() + CACHE_HOLD_TIME));//缓存失效时间 } if (count >= FREQUENCY_LIMIT) { return true; } return false; } finally { mLock.unLock(); } } //去掉超时的数据,如果在一个低频使用的系统中,会残留大量超时无用的信息 private void tryFullScan() { if (System.currentTimeMillis() - lastFullScanTime > fullScanDuration) { lastFullScanTime = System.currentTimeMillis(); for (Map.Entry entry : CACHE_TIME_MAP.entrySet() ) { if (entry.getValue() < lastFullScanTime) { CACHE_MAP.remove(entry.getKey()); CACHE_TIME_MAP.remove(entry.getKey()); } } } } public static void main(String[] args) { FrequencyLimistCounter counter = new FrequencyLimistCounter(5, 100); String name = "test"; for (int i = 0; i < 50; i++) { if(counter.increaseAndCheck(name)) { System.out.println("test failure 1"); System.exit(-1); } } try { Thread.sleep(3000); } catch (InterruptedException e) { e.printStackTrace(); } for (int i = 0; i < 49; i++) { if(counter.increaseAndCheck(name)) { System.out.println("test failure 2"); System.exit(-1); } } if(!counter.increaseAndCheck(name)) { System.out.println("test failure 3"); System.exit(-1); } try { Thread.sleep(5*1000); } catch (InterruptedException e) { e.printStackTrace(); } for (int i = 0; i < 99; i++) { if(counter.increaseAndCheck(name)) { System.out.println("test failure 4"); System.exit(-1); } } try { Thread.sleep(5*1000); } catch (InterruptedException e) { e.printStackTrace(); } for (int i = 0; i < 99; i++) { if(counter.increaseAndCheck(name)) { System.out.println("test failure 5"); System.exit(-1); } } } } ================================================ FILE: broker/src/main/java/win/liyufan/im/GitRepositoryState.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package win.liyufan.im; import io.moquette.server.Server; import java.io.*; import java.util.Properties; import java.util.UUID; public class GitRepositoryState { public final String tags; public final String branch; public final String dirty; public final String remoteOriginUrl; public final String commitId; public final String commitIdAbbrev; public final String describe; public final String describeShort; public final String commitUserName; public final String commitUserEmail; public final String commitMessageFull; public final String commitMessageShort; public final String commitTime; public static final String globalLabel = UUID.randomUUID().toString(); public String label; public final String closestTagName; public final String closestTagCommitCount; public final String buildUserName; public final String buildUserEmail; public final String buildTime; public final String buildHost; public final String buildVersion; public final long runTime; private GitRepositoryState(Properties properties) { this.tags = String.valueOf(properties.get("git.tags")); this.branch = String.valueOf(properties.get("git.branch")); this.dirty = String.valueOf(properties.get("git.dirty")); this.remoteOriginUrl = String.valueOf(properties.get("git.remote.origin.url")); this.commitId = String.valueOf(properties.get("git.commit.id.full")); // OR properties.get("git.commit.id") depending on your configuration this.commitIdAbbrev = String.valueOf(properties.get("git.commit.id.abbrev")); this.describe = String.valueOf(properties.get("git.commit.id.describe")); this.describeShort = String.valueOf(properties.get("git.commit.id.describe-short")); this.commitUserName = String.valueOf(properties.get("git.commit.user.name")); this.commitUserEmail = String.valueOf(properties.get("git.commit.user.email")); this.commitMessageFull = String.valueOf(properties.get("git.commit.message.full")); this.commitMessageShort = String.valueOf(properties.get("git.commit.message.short")); this.commitTime = String.valueOf(properties.get("git.commit.time")); this.closestTagName = String.valueOf(properties.get("git.closest.tag.name")); this.closestTagCommitCount = String.valueOf(properties.get("git.closest.tag.commit.count")); this.buildUserName = String.valueOf(properties.get("git.build.user.name")); this.buildUserEmail = String.valueOf(properties.get("git.build.user.email")); this.buildTime = String.valueOf(properties.get("git.build.time")); this.buildHost = String.valueOf(properties.get("git.build.host")); this.buildVersion = String.valueOf(properties.get("git.build.version")); this.runTime = Server.getServer().getRunTime(); this.label = globalLabel; } public static GitRepositoryState getGitRepositoryState() throws IOException { Properties properties = new Properties(); try { String configPath = System.getProperty("wildfirechat.path", null); File f = new File(configPath, "config/git.properties"); InputStream inputStream = new FileInputStream(f); BufferedReader bf = new BufferedReader(new InputStreamReader(inputStream)); properties.load(bf); } catch (IOException e) { } GitRepositoryState gitRepositoryState = new GitRepositoryState(properties); return gitRepositoryState; } } ================================================ FILE: broker/src/main/java/win/liyufan/im/GsonUtil.java ================================================ package win.liyufan.im; import com.google.gson.Gson; import com.google.gson.GsonBuilder; public class GsonUtil { public static final Gson gson = new GsonBuilder().disableHtmlEscaping().create(); } ================================================ FILE: broker/src/main/java/win/liyufan/im/HttpUtils.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package win.liyufan.im; import cn.wildfirechat.common.ErrorCode; import io.netty.util.internal.StringUtil; import okhttp3.*; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.params.CoreConnectionPNames; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.Charset; public class HttpUtils { private static final Logger LOG = LoggerFactory.getLogger(HttpUtils.class); public static final MediaType JSON = MediaType.get("application/json; charset=utf-8"); static private OkHttpClient client = new OkHttpClient(); public interface HttpCallback { void onSuccess(String content); void onFailure(int statusCode, String errorMessage); } public enum HttpPostType { POST_TYPE_Push, POST_TYPE_Grout_Event_Callback, POST_TYPE_Grout_Member_Event_Callback, POST_TYPE_User_Relation_Event_Callback, POST_TYPE_User_Info_Event_Callback, POST_TYPE_Channel_Info_Event_Callback, POST_TYPE_Channel_Subscriber_Event_Callback, POST_TYPE_Chatroom_Info_Event_Callback, POST_TYPE_Chatroom_Member_Event_Callback, POST_TYPE_Robot_Message_Callback, POST_TYPE_Channel_Message_Callback, POST_TYPE_Forward_Message_Callback, POST_TYPE_User_Online_Event_Callback, POST_TYPE_Server_Exception_Callback, POST_TYPE_Forward_Recall_Callback; } public static void httpJsonPost(String url, String jsonStr, HttpPostType postType) { httpJsonPost(url, jsonStr, null, postType); } public static void httpJsonPost(String url, String jsonStr, HttpCallback httpCallback, HttpPostType postType) { //消息推送内容为 {"sender":"uCGUxUaa","senderName":"杨","convType":0,"target":"usq7v7UU","targetName":"鞋子","userId":"usq7v7UU","line":0,"cntType":400,"serverTime":1610590766485,"pushMessageType":1,"pushType":2,"pushContent":"","pushData":"","unReceivedMsg":1,"mentionedType":0,"packageName":"cn.wildfirechat.chat","deviceToken":"AFoieP9P6u6CccIkRK23gRwUJWKqSkdiqnb-6gC1kL7Wv-9XNoEYBPU7VsINU_q8_WTKfafe35qWu7ya7Z-NmgOTX9XVW3A3zd6ilh--quj6ccINXRvVnh8QmI9QQ","isHiddenDetail":false,"language":"zh"} //推送信息只打印前100个字符,防止敏感信息打印到日志中去。 LOG.info("POST to {} with data {}...", url, jsonStr.substring(0, Math.min(jsonStr.length(), 100))); if (StringUtil.isNullOrEmpty(url)) { LOG.error("http post failure with empty url"); return; } RequestBody body = RequestBody.create(JSON, jsonStr); Request request = new Request.Builder() .url(url) .post(body) .build(); client.newCall(request).enqueue(new Callback() { @Override public void onFailure(Call call, IOException e) { String logText; if(postType == HttpPostType.POST_TYPE_Push) { logText = "Http请求到推送服务失败,请检查推送服务是否正在运行或者配置文件中推送服务地址是否正确。"; } else if(postType == HttpPostType.POST_TYPE_Robot_Message_Callback) { logText = "Http请求转发消息到机器人服务失败,请检查机器人服务是否部署且在机器人信息中的回调地址是否正确。\n如果不需要机器人及机器人服务,请关掉应用服务中自动添加机器人好友和发送机器人欢迎语的代码,用户不给机器人发送消息就不会有转发请求了。"; } else if(postType == HttpPostType.POST_TYPE_Channel_Message_Callback || postType == HttpPostType.POST_TYPE_Channel_Subscriber_Event_Callback) { logText = "Http请求到频道服务失败,请检查频道服务是否部署且在频道信息中的回调地址是否正确。"; } else { logText = "Http请求回调地址失败,请检查IM服务配置文件中对应的回调地址是否正确"; } System.out.println(logText); e.printStackTrace(); LOG.error(logText); LOG.error("POST to {} failed", url); if(httpCallback != null) { httpCallback.onFailure(-1, e.getMessage()); } } @Override public void onResponse(Call call, Response response) throws IOException { LOG.info("POST to {} success with response: {}", url, response.body()); try { if(httpCallback != null) { int code = response.code(); if(code == 200) { if(response.body() != null) { httpCallback.onSuccess(response.body().string()); } else { httpCallback.onSuccess(null); } } else { httpCallback.onFailure(code, response.message()); } } if (response.body() != null) { response.body().close(); } } catch (Exception e) { e.printStackTrace(); } } }); } } ================================================ FILE: broker/src/main/java/win/liyufan/im/IDUtils.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package win.liyufan.im; import java.util.HashMap; import java.util.HashSet; public class IDUtils { private static final int RADIX = 36; private static final int IDLEN = 9; private static final int[] FACTOR = {29,19,1,11,7,17,13,23,5}; private static char getChar(long number) { if (number < 26) { return (char)('a' + number); } else { return (char)('0' + number - 26); } } public static String toUid(long id) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < IDLEN; i++) { long bit = ((id % RADIX) * FACTOR[i] + FACTOR[i] + 5)%RADIX; sb.append(getChar(bit)); id = id / RADIX; } return sb.toString(); } public static void main(String[] args) { HashSet idset = new HashSet<>(); for (long i = 0; i < 1000000000000L; i++) { String uid = toUid(i); if(!idset.add(uid)) { System.out.println("error, dupliate id"); System.exit(-1); } } } } ================================================ FILE: broker/src/main/java/win/liyufan/im/IMTopic.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package win.liyufan.im; public interface IMTopic { String SendMessageTopic = "MS"; String RobotReplyMessageTopic = "RRM"; String MultiCastMessageTopic = "MMC"; String RecallMessageTopic = "MR"; String RecallMultiCastMessageTopic = "MRMC"; String PullMessageTopic = "MP"; String NotifyMessageTopic = "MN"; String NotifyRecallMessageTopic = "RMN"; String NotifyOffline = "ROFL"; String BroadcastMessageTopic = "MBC"; String GetUserSettingTopic = "UG"; String PutUserSettingTopic = "UP"; String NotifyUserSettingTopic = "UN"; String CreateGroupTopic = "GC"; String AddGroupMemberTopic = "GAM"; String KickoffGroupMemberTopic = "GKM"; String QuitGroupTopic = "GQ"; String DismissGroupTopic = "GD"; String ModifyGroupInfoTopic = "GMI"; String ModifyGroupAliasTopic = "GMA"; String ModifyGroupMemberAliasTopic = "GMMA"; String ModifyGroupMemberExtraTopic = "GMME"; String GetGroupInfoTopic = "GPGI"; String GetGroupMemberTopic = "GPGM"; String TransferGroupTopic = "GTG"; String SetGroupManagerTopic = "GSM"; String GetMyGroupsTopic = "GMGS"; String GetCommonGroupsTopic = "GCGS"; String GetUserInfoTopic = "UPUI"; String ModifyMyInfoTopic = "MMI"; String NotifyUserInfoTopic = "UIN"; String GetQiniuUploadTokenTopic = "GQNUT"; String AddFriendRequestTopic = "FAR"; String HandleFriendRequestTopic = "FHR"; String FriendRequestPullTopic = "FRP"; String NotifyFriendRequestTopic = "FRN"; String RriendRequestUnreadSyncTopic = "FRUS"; String SetFriendExtraTopic = "FES"; String DeleteFriendTopic = "FDL"; String FriendPullTopic = "FP"; String NotifyFriendTopic = "FN"; String BlackListUserTopic = "BLU"; String SetFriendAliasTopic = "FALS"; String UploadDeviceTokenTopic = "UDT"; String UserSearchTopic = "US"; String JoinChatroomTopic = "CRJ"; String QuitChatroomTopic = "CRQ"; String GetChatroomInfoTopic = "CRI"; String GetChatroomMemberTopic = "CRMI"; String RouteTopic = "ROUTE"; String CreateChannelTopic = "CHC"; String ModifyChannelInfoTopic = "CHMI"; String TransferChannelInfoTopic = "CHT"; String DestroyChannelInfoTopic = "CHD"; String ChannelSearchTopic = "CHS"; String ChannelListenTopic = "CHL"; String ChannelPullTopic = "CHP"; String ListenedChannelListTopic = "CHLL"; String GetTokenTopic = "GETTOKEN"; String DestroyUserTopic = "DESTROYUSER"; String LoadRemoteMessagesTopic = "LRM"; String KickoffPCClientTopic = "KPCC"; String ClearSessionTopic = "CST"; String GetApplicationTokenRequestTopic = "ATR"; String ApplicationConfigRequestTopic = "ACR"; } ================================================ FILE: broker/src/main/java/win/liyufan/im/MessageBundle.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package win.liyufan.im; import cn.wildfirechat.proto.WFCMessage; import java.io.Serializable; public class MessageBundle implements Serializable { /** * */ private static final long serialVersionUID = -8959293027687263752L; private String fromUser; private String fromClientId; private int type; private int line; private String targetId; private WFCMessage.Message message; private long messageId; public MessageBundle() { } public MessageBundle(long messageId, String fromUser, String fromClientId, WFCMessage.Message message) { super(); this.fromUser = fromUser; this.fromClientId = fromClientId; this.type = message.getConversation().getType(); this.targetId = message.getConversation().getTarget(); this.line = message.getConversation().getLine(); this.message = message; this.messageId = messageId; } public int getLine() { return line; } public long getMessageId() { return messageId; } public String getFromUser() { return fromUser; } public String getFromClientId() { return fromClientId; } public int getType() { return type; } public String getTargetId() { return targetId; } public WFCMessage.Message getMessage() { return message; } public void setFromClientId(String fromClientId) { this.fromClientId = fromClientId; } public void setMessage(WFCMessage.Message message) { this.fromUser = message.getFromUser(); this.type = message.getConversation().getType(); this.targetId = message.getConversation().getTarget(); this.line = message.getConversation().getLine(); this.message = message; this.messageId = message.getMessageId(); } } ================================================ FILE: broker/src/main/java/win/liyufan/im/MessageShardingUtil.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package win.liyufan.im; import java.util.Calendar; import java.util.Date; import java.util.concurrent.ConcurrentHashMap; public class MessageShardingUtil { private static SpinLock mLock = new SpinLock(); private static volatile int rotateId = 0; private static volatile long timeId = 0; private static int nodeId = 0; private static int rotateIdWidth = 15; private static int rotateIdMask = 0x7FFF; private static int nodeIdWidth = 6; private static int nodeIdMask = 0x3F; private static final long T201801010000 = 1514736000000L; public static void setNodeId(int nodeId) { MessageShardingUtil.nodeId = nodeId; } /** * ID = timestamp(43) + nodeId(6) + rotateId(15) * 所以时间限制是到2157/5/15(2的42次幂代表的时间 + (2018-1970))。节点数限制是小于64,每台服务器每毫秒最多发送32768条消息 * @return */ public static long generateId() throws Exception { mLock.lock(); rotateId = (rotateId + 1)&rotateIdMask; long id = System.currentTimeMillis() - T201801010000; if (id > timeId) { timeId = id; rotateId = 1; } else if(id == timeId) { if (rotateId == (rotateIdMask - 1)) { //当前空间已经用完,等待下一个空间打开 while (id <= timeId) { id = System.currentTimeMillis() - T201801010000; } mLock.unLock(); return generateId(); } } else { //id < timeId; if (rotateId > (rotateIdMask -1)*9/10) { //空间已经接近用完 if (timeId - id < 3000) { //时间回拨小于3秒,等待时间赶上回拨之前记录 while (id < timeId) { id = System.currentTimeMillis() - T201801010000; } mLock.unLock(); return generateId(); } else { //时间回拨大于3秒,抛出异常,这段时间消息将不可用。 mLock.unLock(); throw new Exception("Time turn back " + (timeId - id) + " ms, it too long!!!"); } } else { id = timeId; } } id <<= nodeIdWidth; id += (nodeId & nodeIdMask); id <<= rotateIdWidth; id += rotateId; mLock.unLock(); return id; } public static String getMessageTable(long mid) { if (DBUtil.IsEmbedDB) { return "t_messages"; } Calendar calendar = Calendar.getInstance(); if (mid != Long.MAX_VALUE && mid != 0) { mid >>= (nodeIdWidth + rotateIdWidth); Date date = new Date(mid + T201801010000); calendar.setTime(date); } else { Date date = new Date(System.currentTimeMillis()); calendar.setTime(date); } int month = calendar.get(Calendar.MONTH); int year = calendar.get(Calendar.YEAR); year %= 3; return "t_messages_" + (year * 12 + month); } static Calendar getCalendarFromMessageId(long mid) { Calendar calendar = Calendar.getInstance(); if (mid != Long.MAX_VALUE && mid != 0) { mid >>= (nodeIdWidth + rotateIdWidth); Date date = new Date(mid + T201801010000); calendar.setTime(date); } else { Date date = new Date(System.currentTimeMillis()); calendar.setTime(date); } return calendar; } public static long getMsgIdFromTimestamp(long timestamp) { long id = timestamp - T201801010000; id <<= rotateIdWidth; id <<= nodeIdWidth; return id; } public static String getPreviousMessageTable(long mid) { return getMessageTable(mid, -1); } public static String getMessageTable(long mid, int offset) { if (DBUtil.IsEmbedDB) { return null; } mid >>= (nodeIdWidth + rotateIdWidth); Date date = new Date(mid + T201801010000); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); int month = calendar.get(Calendar.MONTH); int year = calendar.get(Calendar.YEAR); year %= 3; month = month + offset; while (month < 0) { month += 12; year = (year + 3 - 1)%3; } while (month >= 12) { month -= 12; year = (year + 1)%3; } return "t_messages_" + (year * 12 + month); } public static void main(String[] args) throws Exception { ConcurrentHashMap messageIds = new ConcurrentHashMap<>(); int threadCount = 1000; int loop = 1000000; for (int i = 0; i < threadCount; i++) { new Thread(()->{ for (int j = 0; j < loop; j++) { try { long mid = generateId(); if(messageIds.put(mid, j) != null) { System.out.println("Duplicated message id !!!!!!" + mid); } } catch (Exception e) { e.printStackTrace(); } } }).start(); } Thread.sleep(1000 * 60 * 10); } } ================================================ FILE: broker/src/main/java/win/liyufan/im/RateLimiter.java ================================================ package win.liyufan.im; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * 漏桶算法 * capacity * 1000是为了更精确, 漏水的小洞更小^~^ */ public class RateLimiter { private static final int DEFAULT_LIMIT_TIME_SECOND = 5; private static final int DEFAULT_LIMIT_COUNT = 100; private static final long expire = 2 * 60 * 60 * 1000; private double rate = (double) DEFAULT_LIMIT_COUNT / (DEFAULT_LIMIT_TIME_SECOND); private long capacity = DEFAULT_LIMIT_COUNT * 1000; private long lastCleanTime; private Map requestCountMap = new HashMap<>(); private Map requestTimeMap = new HashMap<>(); private SpinLock lock = new SpinLock(); public RateLimiter() { } public RateLimiter(int limitTimeSecond, int limitCount) { if (limitTimeSecond <= 0 || limitCount <= 0) { throw new IllegalArgumentException(); } this.capacity = limitCount * 1000; this.rate = (double) limitCount / limitTimeSecond; } /** * 漏桶算法,https://en.wikipedia.org/wiki/Leaky_bucket */ public boolean isGranted(String userId) { try { lock.lock(); long current = System.currentTimeMillis(); cleanUp(current); Long lastRequestTime = requestTimeMap.get(userId); long count = 0; if (lastRequestTime == null) { count += 1000; requestTimeMap.put(userId, current); requestCountMap.put(userId, count); return true; } else { count = requestCountMap.get(userId); lastRequestTime = requestTimeMap.get(userId); count -= (current - lastRequestTime) * rate; count = count > 0 ? count : 0; requestTimeMap.put(userId, current); if (count < capacity) { count += 1000; requestCountMap.put(userId, count); return true; } else { requestCountMap.put(userId, count); return false; } } } finally { lock.unLock(); } } private void cleanUp(long current) { if (current - lastCleanTime > expire) { for (Iterator> it = requestTimeMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = it.next(); if (entry.getValue() < current - expire) { it.remove(); requestCountMap.remove(entry.getKey()); } } lastCleanTime = current; } } public static void main(String[] args) throws InterruptedException { RateLimiter limiter = new RateLimiter(1, 10); long start = System.currentTimeMillis(); for (int i = 0; i < 53; i++) { if (!limiter.isGranted("test")) { System.out.println("1 too frequency " + i); } } Thread.sleep(1 * 1000); System.out.println("sleep 1 s"); for (int i = 0; i < 53; i++) { if (!limiter.isGranted("test")) { System.out.println("2 too frequency " + i); } } Thread.sleep(5 * 1000); System.out.println("sleep 5 s"); for (int i = 0; i < 53; i++) { if (!limiter.isGranted("test")) { System.out.println("3 too frequency " + i); } } Thread.sleep(5 * 1000); System.out.println("sleep 5 s"); long second = System.currentTimeMillis(); for (int i = 0; i < 100; i++) { if (!limiter.isGranted("test")) { System.out.println("4 too frequency " + i); } Thread.sleep(50); } System.out.println("second: " + (System.currentTimeMillis() - second)); System.out.println("end: " + (System.currentTimeMillis() - start)); } } ================================================ FILE: broker/src/main/java/win/liyufan/im/SensitiveFilter.java ================================================ package win.liyufan.im; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.*; import java.util.concurrent.ConcurrentHashMap; public class SensitiveFilter { private static final Logger LOG = LoggerFactory.getLogger(SensitiveFilter.class); public enum MatchType { MIN_MATCH("最小匹配规则"),MAX_MATCH("最大匹配规则"); String desc; MatchType(String desc) { this.desc = desc; } } private Map sensitiveWordsMap; private static final String END_FLAG="end"; public boolean isContainSensitiveWord(String text){ Set sensitiveWords = getSensitiveWords(text, MatchType.MIN_MATCH); if(sensitiveWords!=null&&sensitiveWords.size()>0){ return true; } return false; } private int getUrlLength(String text, int i) { boolean startUrl = false; if(text.charAt(i) == 'h') { if(text.length() > i + 6 && text.substring(i, i+7).equals("http://")) { startUrl = true; } else if(text.length() > i + 7 && text.substring(i, i+8).equals("https://")) { startUrl = true; } } if(startUrl) { for (int j = i+1; j < text.length(); j++) { char ch = text.charAt(j); if(ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t') { return j-i; } } return text.length() - i - 1; } return 0; } public Set getSensitiveWords(String text,MatchType matchType){ Set sensitiveWords=new HashSet<>(); if(text==null||text.trim().length()==0){ return sensitiveWords; } String originalText = text; text = text.toLowerCase(); for(int i=0;i 0) { i = i + urlLength; continue; } int sensitiveWordLength = getSensitiveWordLength(text, i, matchType); if(sensitiveWordLength>0){ String sensitiveWord = originalText.substring(i, i + sensitiveWordLength); sensitiveWords.add(sensitiveWord); if(matchType==MatchType.MIN_MATCH){ break; } i=i+sensitiveWordLength-1; } } if(!sensitiveWords.isEmpty()) { LOG.info("Text {} matched sensitive word {}", originalText, sensitiveWords); } return sensitiveWords; } public int getSensitiveWordLength(String text,int startIndex,MatchType matchType){ if(text==null||text.trim().length()==0){ throw new IllegalArgumentException("The input text must not be empty."); } char currentChar; Map currentMap=sensitiveWordsMap; int wordLength=0; boolean endFlag=false; for(int i=startIndex;i subMap=(Map) currentMap.get(currentChar); if(subMap==null){ break; }else { wordLength++; if(subMap.containsKey(END_FLAG)){ endFlag=true; if(matchType==MatchType.MIN_MATCH){ break; }else { currentMap=subMap; } }else { currentMap=subMap; } } } if(!endFlag){ wordLength=0; } return wordLength; } public SensitiveFilter(Set sensitiveWords){ sensitiveWordsMap=new ConcurrentHashMap<>(sensitiveWords.size()); if(sensitiveWords==null||sensitiveWords.isEmpty()){ //throw new IllegalArgumentException("Senditive words must not be empty!"); return; } String currentWord; Map currentMap; Map subMap; Iterator iterator = sensitiveWords.iterator(); while (iterator.hasNext()){ currentWord=iterator.next(); if(currentWord==null||currentWord.trim().length()<1){ //敏感词长度必须大于等于1 continue; } currentMap=sensitiveWordsMap; for(int i=0;i) currentMap.get(c); if(subMap==null){ subMap=new HashMap<>(); currentMap.put(c,subMap); currentMap=subMap; }else { currentMap= subMap; } if(i==currentWord.length()-1){ //如果是最后一个字符,则put一个结束标志,这里只需要保存key就行了,value为null可以节省空间。 //如果不是最后一个字符,则不需要存这个结束标志,同样也是为了节省空间。 currentMap.put(END_FLAG,null); } } } } public static void main(String[] args) { Set words = new HashSet<>(); words.add("sb"); words.add("xx"); SensitiveFilter sensitiveFilter = new SensitiveFilter(words); String text1 = "u sb a"; Set ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH); System.out.println(ss.size()); text1 = "u xx"; ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH); System.out.println(ss.size()); text1 = "a url is https://sdsbhe.com here"; ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH); System.out.println(ss.size()); text1 = "a url is https://sdsbhe.com"; ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH); System.out.println(ss.size()); text1 = "a url is https://sdsbhe.com\nsb"; ss = sensitiveFilter.getSensitiveWords(text1, MatchType.MIN_MATCH); System.out.println(ss.size()); } } ================================================ FILE: broker/src/main/java/win/liyufan/im/SpinLock.java ================================================ package win.liyufan.im; import java.util.concurrent.atomic.AtomicReference; public class SpinLock { //java中原子(CAS)操作 AtomicReference owner = new AtomicReference<>();//持有自旋锁的线程对象 private int count; public void lock() { Thread cur = Thread.currentThread(); //lock函数将owner设置为当前线程,并且预测原来的值为空。unlock函数将owner设置为null,并且预测值为当前线程。当有第二个线程调用lock操作时由于owner值不为空,导致循环 //一直被执行,直至第一个线程调用unlock函数将owner设置为null,第二个线程才能进入临界区。 while (!owner.compareAndSet(null, cur)){ } } public void unLock() { Thread cur = Thread.currentThread(); owner.compareAndSet(cur, null); } } ================================================ FILE: broker/src/main/java/win/liyufan/im/UUIDGenerator.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package win.liyufan.im; import java.util.UUID; public class UUIDGenerator { public static String getUUID() { UUID uuid = UUID.randomUUID(); String str = uuid.toString(); str = str.replace("-", ""); return str; } } ================================================ FILE: broker/src/main/java/win/liyufan/im/UserSettingScope.java ================================================ package win.liyufan.im; public interface UserSettingScope { int kUserSettingConversationSilent = 1; int kUserSettingGlobalSilent = 2; int kUserSettingHiddenNotificationDetail = 4; int kUserSettingConversationSync = 7; int kUserSettingMyChannels = 8; int kUserSettingListenedChannels = 9; int kUserSettingPCOnline = 10; int kUserSettingMuteWhenPCOnline = 15; int kUserSettingNoDisturbing = 17; int kUserSettingConversationClearMessage = 18; int kUserSettingConversationDraft = 19; int kUserSettingDisableSyncDraft = 20; int kUserSettingVoipSilent = 21; int kUserSettingPttReserved = 22; int kUserSettingCustomState = 23; int kUserSettingDisableSecretChat = 24; int kUserSettingPttSilent = 25; int kUserSettingGroupRemark = 26; int kUserSettingPrivacySearchable = 27; int kUserSettingAddFriendStrategy = 28; int kUserSettingScopeSyncBadge = 29; int UserSettingScopeLockPC = 30; } ================================================ FILE: broker/src/main/java/win/liyufan/im/Utility.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package win.liyufan.im; import cn.wildfirechat.common.IMExceptionEvent; import com.google.gson.Gson; import com.hazelcast.util.StringUtil; import io.moquette.server.Server; import org.slf4j.Logger; import java.net.*; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicLong; public class Utility { private static Map exceptionEventHashMap = new ConcurrentHashMap<>(); static AtomicLong SendExceptionExpireTime = new AtomicLong(0); static int SendExceptionDuration = 180000; static long lastSendTime = System.currentTimeMillis(); static { new Thread(()->{ while (true) { try { Thread.sleep(60 * 1000); sendExceptionEvent(); } catch (Exception e) { e.printStackTrace(); } } }).start(); } public static InetAddress getLocalAddress(){ try { Enumeration b = NetworkInterface.getNetworkInterfaces(); while( b.hasMoreElements()){ for ( InterfaceAddress f : b.nextElement().getInterfaceAddresses()) if ( f.getAddress().isSiteLocalAddress()) return f.getAddress(); } } catch (SocketException e) { e.printStackTrace(); } return null; } public static void printExecption(Logger LOG, Exception e) { printExecption(LOG, e, 0); } public static void printExecption(Logger LOG, Exception e, int eventType) { String message = ""; for(StackTraceElement stackTraceElement : e.getStackTrace()) { message = message + System.lineSeparator() + stackTraceElement.toString(); } LOG.error("Exception: {}", e.getMessage()); LOG.error(message); if(eventType > 0) { String key = eventType+(e.getMessage() != null ? e.getMessage().split("\n")[0] : "null"); IMExceptionEvent event = exceptionEventHashMap.get(key); if(event == null) { event = new IMExceptionEvent(); event.event_type = eventType; event.msg = e.getMessage(); event.call_stack = message; event.count = 0; exceptionEventHashMap.put(key, event); } event.count++; sendExceptionEvent(); } } private static String gMonitorEventAddress; public static void setMonitorEventAddress(String gMonitorEventAddress) { Utility.gMonitorEventAddress = gMonitorEventAddress; } private static void sendExceptionEvent() { if(StringUtil.isNullOrEmpty(gMonitorEventAddress)) { return; } long now = System.currentTimeMillis(); long t = SendExceptionExpireTime.getAndUpdate((long l) -> now - l >= SendExceptionDuration ? now : l); if(now - t >= SendExceptionDuration) { for (Map.Entry entry : exceptionEventHashMap.entrySet()) { if(entry.getValue().count > 0) { String jsonStr = GsonUtil.gson.toJson(entry.getValue()); Server.getServer().getCallbackScheduler().execute(() -> HttpUtils.httpJsonPost(gMonitorEventAddress, jsonStr, HttpUtils.HttpPostType.POST_TYPE_Server_Exception_Callback)); entry.getValue().count = 0; lastSendTime = now; } } if(now - lastSendTime > 24 * 3600 * 1000) { lastSendTime = now; IMExceptionEvent event = new IMExceptionEvent(); event.event_type = 0; event.msg = "监控心跳通知"; event.call_stack = "别担心!这个是心跳消息,已经有24小时没有出现异常消息了!"; event.count = IMExceptionEvent.EventType.HEART_BEAT; String jsonStr = GsonUtil.gson.toJson(event); Server.getServer().getCallbackScheduler().execute(() -> HttpUtils.httpJsonPost(gMonitorEventAddress, jsonStr, HttpUtils.HttpPostType.POST_TYPE_Server_Exception_Callback)); } } } public static String getMacAddress() throws UnknownHostException, SocketException { InetAddress ipAddress = InetAddress.getLocalHost(); NetworkInterface networkInterface = NetworkInterface .getByInetAddress(ipAddress); byte[] macAddressBytes = networkInterface.getHardwareAddress(); StringBuilder macAddressBuilder = new StringBuilder(); for (int macAddressByteIndex = 0; macAddressByteIndex < macAddressBytes.length; macAddressByteIndex++) { String macAddressHexByte = String.format("%02X", macAddressBytes[macAddressByteIndex]); macAddressBuilder.append(macAddressHexByte); if (macAddressByteIndex != macAddressBytes.length - 1) { macAddressBuilder.append(":"); } } return macAddressBuilder.toString(); } /** * 格式化 * * @param jsonStr * @return * @author lizhgb * @Date 2015-10-14 下午1:17:35 * @Modified 2017-04-28 下午8:55:35 */ public static String formatJson(String jsonStr) { if (null == jsonStr || "".equals(jsonStr)) return ""; StringBuilder sb = new StringBuilder(); char last = '\0'; char current = '\0'; int indent = 0; boolean isInQuotationMarks = false; for (int i = 0; i < jsonStr.length(); i++) { last = current; current = jsonStr.charAt(i); switch (current) { case '"': if (last != '\\'){ isInQuotationMarks = !isInQuotationMarks; } sb.append(current); break; case '{': case '[': sb.append(current); if (!isInQuotationMarks) { sb.append('\n'); indent++; addIndentBlank(sb, indent); } break; case '}': case ']': if (!isInQuotationMarks) { sb.append('\n'); indent--; addIndentBlank(sb, indent); } sb.append(current); break; case ',': sb.append(current); if (last != '\\' && !isInQuotationMarks) { sb.append('\n'); addIndentBlank(sb, indent); } break; default: sb.append(current); } } return sb.toString(); } /** * 添加space * * @param sb * @param indent * @author lizhgb * @Date 2015-10-14 上午10:38:04 */ private static void addIndentBlank(StringBuilder sb, int indent) { for (int i = 0; i < indent; i++) { sb.append('\t'); } } } ================================================ FILE: broker/src/main/java/win/liyufan/im/extended/mqttmessage/ModifiedMqttPubAckMessage.java ================================================ package win.liyufan.im.extended.mqttmessage; import io.netty.buffer.ByteBuf; import io.netty.handler.codec.mqtt.MqttFixedHeader; import io.netty.handler.codec.mqtt.MqttMessage; import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader; public class ModifiedMqttPubAckMessage extends MqttMessage { public ModifiedMqttPubAckMessage(MqttFixedHeader mqttFixedHeader, MqttMessageIdVariableHeader variableHeader, ByteBuf payload) { super(mqttFixedHeader, variableHeader, payload); } @Override public MqttMessageIdVariableHeader variableHeader() { return (MqttMessageIdVariableHeader) super.variableHeader(); } } ================================================ FILE: broker/src/main/resources/c3p0-config.xml ================================================ 10 30 100 10 200 com.mysql.cj.jdbc.Driver jdbc:mysql://localhost:3306/wfchat?verifyServerCertificate=false&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8 root 123456 10 30 100 10 200 3000 2 0 1000 false false 60 ================================================ FILE: broker/src/main/resources/log4j2.xml ================================================ ./logs UTF-8 %d %-5p [%t] %C{2} (%F:%L) - %m%n ================================================ FILE: build.sh ================================================ #!/bin/bash mvn clean compile package ================================================ FILE: checkstyle-suppressions.xml ================================================ ================================================ FILE: checkstyle.xml ================================================ ================================================ FILE: common/pom.xml ================================================ wildfirechat-parent cn.wildfirechat 1.4.5 4.0.0 common io.netty netty-common ${netty.version} com.google.protobuf protobuf-java 2.5.0 com.google.code.gson gson 2.8.9 com.googlecode.json-simple json-simple 1.1.1 ================================================ FILE: common/src/main/java/cn/wildfirechat/common/APIPath.java ================================================ package cn.wildfirechat.common; /** * API路径接口 *

* 定义了野火IM服务器所有管理接口的API路径。 * 包括聊天室、敏感词、域、用户、好友、黑名单、消息、群组、会议、频道等模块的接口路径。 *

*/ public interface APIPath { String Create_Chatroom = "/admin/chatroom/create"; String Chatroom_Destroy = "/admin/chatroom/del"; String Chatroom_Info = "/admin/chatroom/info"; String Chatroom_GetMembers = "/admin/chatroom/members"; String Chatroom_GetUserChatroom = "/admin/chatroom/user_chatroom"; String Chatroom_SetBlacklist = "/admin/chatroom/set_black_status"; String Chatroom_GetBlacklist = "/admin/chatroom/get_black_status"; String Chatroom_SetManager = "/admin/chatroom/set_manager"; String Chatroom_GetManagerList = "/admin/chatroom/get_manager_list"; String Chatroom_MuteAll = "/admin/chatroom/mute_all"; String Sensitive_Add = "/admin/sensitive/add"; String Sensitive_Del = "/admin/sensitive/del"; String Sensitive_Query = "/admin/sensitive/query"; String Create_Domain = "/admin/domain/create"; String Get_Domain = "/admin/domain/get"; String Destroy_Domain = "/admin/domain/destroy"; String List_Domain = "/admin/domain/list"; String Ping_Domain = "/admin/domain/ping"; String Create_User = "/admin/user/create"; String Update_User = "/admin/user/update"; String Destroy_User = "/admin/user/destroy"; String Search_User = "/admin/user/search_user"; String Create_Robot = "/admin/robot/create"; String CreateOrUpdate_Device = "/admin/device/create"; String Get_Device = "/admin/device/get"; String Get_User_Devices = "/admin/device/user_devices"; String User_Get_Token = "/admin/user/get_token"; String User_Update_Block_Status = "/admin/user/update_block_status"; String User_Get_Info = "/admin/user/get_info"; String User_Batch_Get_Infos = "/admin/user/batch_get_infos"; String User_Get_Email_Info = "/admin/user/get_info_by_email"; String User_Get_All = "/admin/user/all"; String User_Get_Robot_Info = "/admin/user/get_robot_info"; String User_Get_User_Robots = "/admin/user/get_user_robots"; String User_Get_Blocked_List = "/admin/user/get_blocked_list"; String User_Check_Block_Status = "/admin/user/check_block_status"; String User_Get_Online_Status = "/admin/user/onlinestatus"; String User_Put_Setting = "/admin/user/put_setting"; String User_Get_Setting = "/admin/user/get_setting"; String User_Kickoff_Client = "/admin/user/kickoff_client"; String User_Online_Count = "/admin/user/online_count"; String User_Online_List = "/admin/user/online_list"; String User_Session_List = "/admin/user/session_list"; String User_Application_Get_UserInfo = "/admin/user/app_get_user_info"; String Friend_Update_Status = "/admin/friend/status"; String Friend_Get_List = "/admin/friend/list"; String Blacklist_Update_Status = "/admin/blacklist/status"; String Blacklist_Get_List = "/admin/blacklist/list"; String Friend_Get_Alias = "/admin/friend/get_alias"; String Friend_Set_Alias = "/admin/friend/set_alias"; String Friend_Set_Extra = "/admin/friend/set_extra"; String Friend_Send_Request = "/admin/friend/send_request"; String Friend_Get_Requests = "/admin/friend/get_requests"; String Relation_Get = "/admin/relation/get"; String Handle_Friend_Send_Request = "/admin/friend/handle_send_request"; String Admin_Moments_Post_Feed = "/admin/moments/feed/post"; String Msg_Send = "/admin/message/send"; String Msg_Publish = "/admin/message/publish"; String Msg_Recall = "/admin/message/recall"; String Msg_Delete = "/admin/message/delete"; String Msg_Update = "/admin/message/update"; String Msg_GetOne = "/admin/message/get_one"; String Msg_Broadcast = "/admin/message/broadcast"; String Msg_Multicast = "/admin/message/multicast"; String Msg_RecallBroadCast = "/admin/message/recall_broadcast"; String Msg_RecallMultiCast = "/admin/message/recall_multicast"; String Msg_DeleteBroadCast = "/admin/message/delete_broadcast"; String Msg_DeleteMultiCast = "/admin/message/delete_multicast"; String Msg_ConvRead = "/admin/message/conv_read"; String Msg_Delivery = "/admin/message/delivery"; String Conversation_Delete = "/admin/conversation/delete"; String Msg_Clear_By_User = "/admin/message/clear_by_user"; String Create_Group = "/admin/group/create"; String Group_Dismiss = "/admin/group/del"; String Group_Transfer = "/admin/group/transfer"; String Group_Get_Info = "/admin/group/get_info"; String Group_Batch_Info = "/admin/group/batch_infos"; String Group_Modify_Info = "/admin/group/modify"; String Group_Member_List = "/admin/group/member/list"; String Group_Member_Get = "/admin/group/member/get"; String Group_Member_Add = "/admin/group/member/add"; String Group_Member_Kickoff = "/admin/group/member/del"; String Group_Member_Quit = "/admin/group/member/quit"; String Group_Set_Manager = "/admin/group/manager/set"; String Group_Mute_Member = "/admin/group/manager/mute"; String Group_Allow_Member = "/admin/group/manager/allow"; String Group_Join_Request_Add = "/admin/group/join_request/add"; String Get_User_Groups = "/admin/group/of_user"; String Get_User_Groups_By_Type = "/admin/group/of_user_by_type"; String Group_Set_Member_Alias = "/admin/group/member/set_alias"; String Group_Set_Member_Extra = "/admin/group/member/set_extra"; String Get_Common_Groups = "/admin/group/common_group"; String Sync_Group = "/admin/mesh/group_sync"; String Conference_User_Request = "/admin/conference/user_request"; String Conference_User_Event = "/admin/conference/user_event"; String Create_Channel = "/admin/channel/create"; String Destroy_Channel = "/admin/channel/destroy"; String Get_Channel_Info = "/admin/channel/get"; String Subscribe_Channel = "/admin/channel/subscribe"; String Check_User_Subscribe_Channel = "/admin/channel/is_subscribed"; String Get_System_Setting = "/admin/system/get_setting"; String Put_System_Setting = "/admin/system/put_setting"; String GET_CUSTOMER = "/admin/customer"; String Health = "/admin/health"; String Get_Conversation_Files = "/admin/file/conversation_files"; String Get_User_Files = "/admin/file/user_files"; String Get_Message_File = "/admin/file/message_file"; String Get_Presigned_Upload_Url = "/admin/oss/get_upload_url"; String Conference_List = "/admin/conference/list"; String Conference_Exist = "/admin/conference/exist"; String Conference_List_Participant = "/admin/conference/list_participant"; String Conference_Create = "/admin/conference/create"; String Conference_Destroy = "/admin/conference/destroy"; String Conference_Recording = "/admin/conference/recording"; String Conference_Rtp_Forward = "/admin/conference/rtp_forward"; String Conference_Stop_Rtp_Forward = "/admin/conference/stop_rtp_forward"; String Conference_List_Rtp_Forward = "/admin/conference/list_rtp_forward"; String Channel_User_Info = "/channel/user_info"; String Channel_Update_Profile = "/channel/update_profile"; String Channel_Get_Profile = "/channel/get_profile"; String Channel_Message_Send = "/channel/message/send"; String Channel_Msg_Recall = "/channel/message/recall"; String Channel_Msg_Republish = "/channel/message/republish"; String Channel_Subscribe = "/channel/subscribe"; String Channel_Subscriber_List = "/channel/subscriber_list"; String Channel_Is_Subscriber = "/channel/is_subscriber"; String Channel_Application_Get_UserInfo = "/channel/application/get_user_info"; String Robot_User_Info = "/robot/user_info"; String Robot_Get_Profile = "/robot/profile"; String Robot_Message_Send = "/robot/message/send"; String Robot_Message_Reply = "/robot/message/reply"; String Robot_Message_Recall = "/robot/message/recall"; String Robot_Message_Update = "/robot/message/update"; String Robot_Set_Callback = "/robot/set_callback"; String Robot_Get_Callback = "/robot/get_callback"; String Robot_Delete_Callback = "/robot/delete_callback"; String Robot_Update_Profile = "/robot/update_profile"; String Robot_Application_Get_UserInfo = "/robot/application/get_user_info"; String Robot_Group_Member_Add = "/robot/group/member/add"; String Robot_Group_Allow_Member = "/robot/group/manager/allow"; String Robot_Create_Group = "/robot/group/create"; String Robot_Group_Dismiss = "/robot/group/del"; String Robot_Group_Get_Info = "/robot/group/get_info"; String Robot_Group_Member_List = "/robot/group/member/list"; String Robot_Group_Member_Get = "/robot/group/member/get"; String Robot_Group_Member_Kickoff = "/robot/group/member/del"; String Robot_Group_Modify_Info = "/robot/group/modify"; String Robot_Group_Set_Member_Alias = "/robot/group/member/set_alias"; String Robot_Group_Set_Member_Extra = "/robot/group/member/set_extra"; String Robot_Group_Mute_Member = "/robot/group/manager/mute"; String Robot_Group_Member_Quit = "/robot/group/member/quit"; String Robot_Group_Transfer = "/robot/group/transfer"; String Robot_Group_Set_Manager = "/robot/group/manager/set"; String Robot_Moments_Post_Feed = "/robot/moments/feed/post"; String Robot_Moments_Pull_Feeds = "/robot/moments/feed/pull"; String Robot_Moments_Update_Feed = "/robot/moments/feed/update"; String Robot_Moments_Post_Comment = "/robot/moments/comment/post"; String Robot_Moments_Pull_Comment = "/robot/moments/comment/pull"; String Robot_Moments_Fetch_Feed = "/robot/moments/feed/pull_one"; String Robot_Moments_Fetch_Profiles = "/robot/moments/profiles/pull"; String Robot_Moments_Recall_Comment = "/robot/moments/comment/recall"; String Robot_Moments_Recall_Feed = "/robot/moments/feed/recall"; String Robot_Moments_Update_Profiles_List_Value = "/robot/moments/profiles/list/push"; String Robot_Moments_Update_Profiles_Value = "/robot/moments/profiles/value/push"; String Robot_Conference_Request = "/robot/conference/request"; String Robot_Get_Presigned_Upload_Url = "/robot/oss/get_upload_url"; } ================================================ FILE: common/src/main/java/cn/wildfirechat/common/ErrorCode.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.common; /** * 错误码枚举 *

* 定义了野火IM系统中所有可能的错误码,包括: *

    *
  • 通用错误(0-5)
  • *
  • 认证错误(6-8)
  • *
  • 消息错误(9-10)
  • *
  • 群组错误(11-12)
  • *
  • 用户错误(16-19)
  • *
  • 聊天室错误(20)
  • *
  • 频道错误(21-25)
  • *
  • 会议错误(60-61)
  • *
  • 应用错误(70)
  • *
  • 密聊错误(81-87)
  • *
  • 其他错误(90-255)
  • *
*

*/ public enum ErrorCode { //General error ERROR_CODE_SUCCESS(0, "success"), ERROR_CODE_SECRECT_KEY_MISMATCH(1, "secrect key mismatch"), ERROR_CODE_INVALID_DATA(2, "invalid data"), ERROR_CODE_NODE_NOT_EXIST(3, "node not exist"), ERROR_CODE_SERVER_ERROR(4, "server error"), ERROR_CODE_NOT_MODIFIED(5, "not modified"), //Auth error ERROR_CODE_TOKEN_ERROR(6, "token error"), ERROR_CODE_KICKED_OFF(7, "kicked off"), ERROR_CODE_USER_FORBIDDEN(8, "user forbidden"), //Message error ERROR_CODE_NOT_IN_GROUP(9, "not in group"), ERROR_CODE_INVALID_MESSAGE(10, "invalid message"), //Group error ERROR_CODE_GROUP_ALREADY_EXIST(11, "group already exist"), ERROR_CODE_ALREADY_IN_GROUP(12, "member already in group"), //user error ERROR_CODE_FRIEND_ALREADY_REQUEST(16, "already send request"), ERROR_CODE_FRIEND_REQUEST_BLOCKED(18, "friend request blocked"), ERROR_CODE_FRIEND_REQUEST_EXPIRED(19, "friend request expired"), ERROR_CODE_NOT_IN_CHATROOM(20, "not in chatroom"), ERROR_CODE_NOT_IN_CHANNEL(21, "not in channel"), ERROR_CODE_NOT_LICENSED(22, "not licensed"), ERROR_CODE_ALREADY_FRIENDS(23, "already friends"), ERROR_CODE_RECALL_TIME_EXPIRED(24, "time expired"), ERROR_CODE_LOCK_ALREADY_LOCKED(25, "already locked"), ERROR_CODE_NOT_YOUR_LOCKED(26, "unload failure, not your lock"), ERROR_CODE_ROBOT_NO_TOKEN(27, "robot no token"), ERROR_CODE_WS_NOT_CONFIGURED_CORRECTLY(28, "ws not configured correctly"), ERROR_CODE_TIME_INCONSISTENT(30, "time inconsistent"), ERROR_CODE_MESSAGE_TOO_LARGE(35, "message too large"), ERROR_CODE_CONFERENCE_ROOM_NOT_EXIST(60, "conference room not exist"), ERROR_CODE_CONFERENCE_SERVICE_NOT_AVAILABLE(61, "conference service not available"), ERROR_CODE_APPLICATION_TOKEN_ERROR_OR_TIMEOUT(70, "application token error or timeout"), ERROR_CODE_SECRET_CHAT_ACCEPTED_BY_OTHER_CLIENT(81, "secret chat accepted by other client"), ERROR_CODE_SECRET_CHAT_SESSION_NOT_EXIST(82, "secret chat session not exist"), ERROR_CODE_SECRET_CHAT_NOT_SESSION_CLIENT(83, "not secret chat session client"), ERROR_CODE_SECRET_CHAT_SESSION_NOT_READY(84, "secret chat session not ready"), ERROR_CODE_SECRET_CHAT_SESSION_DESTROYED(85, "secret chat session destroyed"), ERROR_CODE_SECRET_CHAT_MO_DISABLED(86, "origin side disable secret chat"), ERROR_CODE_SECRET_CHAT_MT_DISABLED(87, "target side disable secret chat"), ERROR_CODE_CONFERENCE_ERROR(90, "Conference server response error"), ERROR_CODE_FUNCTION_DISABLED(220, "function disabled"), ERROR_CODE_SERVER_BUSY(221, "Server busy"), ERROR_CODE_PARTLY_SUCCESS(222, "Partly success"), ERROR_CODE_OTHER_CLIENT_ALREADY_IN_CHATROOM(225, "other client already in chatroom"), ERROR_CODE_CHANNEL_NO_EXIST(236, "channel no exist"), ERROR_CODE_CHANNEL_NO_SECRET(237, "channel no secret"), ERROR_CODE_USER_NOT_PREPARED(238, "user not prepared"), ERROR_CODE_API_NOT_SIGNED(239, "api not signed or sign parameter not completion"), ERROR_CODE_GROUP_EXCEED_MAX_MEMBER_COUNT(240, "group exceed max member count"), ERROR_CODE_GROUP_MUTED(241, "group is muted"), ERROR_CODE_SENSITIVE_MATCHED(242, "sensitive matched"), ERROR_CODE_SIGN_EXPIRED(243, "sign expired"), ERROR_CODE_AUTH_FAILURE(244, "auth failure"), ERROR_CODE_USER_BLOCKED(245, "user is blocked"), ERROR_CODE_IN_BLACK_LIST(246, "user in black list"), ERROR_CODE_FORBIDDEN_SEND_MSG(247, "forbidden send msg globally"), ERROR_CODE_NOT_RIGHT(248, "no right to operate"), ERROR_CODE_TIMEOUT(249, "timeout"), ERROR_CODE_OVER_FREQUENCY(250, "over frequency"), INVALID_PARAMETER(251, "Invalid parameter"), INVALID_ASYNC_HANDLING(252, "Async handling"), ERROR_CODE_NOT_EXIST(253, "not exist"), ERROR_CODE_NOT_IMPLEMENT(254, "not implement"), ERROR_CODE_SUCCESS_GZIPED(255, "success withe gzip response"),; public int code; public String msg; ErrorCode(int code, String msg) { this.code = code; this.msg = msg; } public static ErrorCode fromCode(int code) { for (ErrorCode errorCode : ErrorCode.values()) { if(errorCode.code == (code&0xff)) { return errorCode; } } return ERROR_CODE_SERVER_ERROR; } public int getCode() { return code; } public String getMsg() { return msg; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/common/IMExceptionEvent.java ================================================ package cn.wildfirechat.common; /** * IM异常事件类 *

* 用于记录和传递IM系统中的异常事件信息。 *

*/ public class IMExceptionEvent { /** * 事件类型接口 *

* 定义了各种异常事件的类型常量。 *

*/ public interface EventType { int RDBS_Exception = 1; int MONGO_Exception = 2; int RPC_Exception = 3; int PUSH_SERVER_Exception = 4; int ADMIN_API_Exception = 5; int CHANNEL_API_Exception = 6; int ROBOT_API_Exception = 7; int SHORT_LINK_Exception = 8; int EVENT_CALLBACK_Exception = 9; int CONFERENCE_Exception = 10; int HEART_BEAT = 100; } public int event_type; public String msg; public String call_stack; public int count; public int node_id; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/ArticleContent.java ================================================ package cn.wildfirechat.pojos; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Base64; import java.util.List; public class ArticleContent { public static class Article { public String id; public String cover; public String title; public String digest; public String url; public boolean rr; public Article() { } public Article(String id, String cover, String title, String digest, String url, boolean rr) { this.id = id; this.cover = cover; this.title = title; this.digest = digest; this.url = url; this.rr = rr; } } public Article top; public List
subArticles; public ArticleContent() { } public ArticleContent(String id, String cover, String title, String digest, String url, boolean rr) { this.top = new Article(id, cover, title, digest, url, rr); } public ArticleContent addSubArticle(String id, String cover, String title, String digest, String url, boolean rr) { if (subArticles == null) subArticles = new ArrayList<>(); subArticles.add(new Article(id, cover, title, digest, url, rr)); return this; } public MessagePayload toPayload() { MessagePayload payload = new MessagePayload(); payload.setType(13); payload.setSearchableContent(top.title); payload.setBase64edData(Base64.getEncoder().encodeToString(new GsonBuilder().disableHtmlEscaping().create().toJson(this).getBytes(StandardCharsets.UTF_8))); return payload; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/BroadMessageData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; public class BroadMessageData { private String sender; private int line; private MessagePayload payload; public String getSender() { return sender; } public void setSender(String sender) { this.sender = sender; } public int getLine() { return line; } public void setLine(int line) { this.line = line; } public MessagePayload getPayload() { return payload; } public void setPayload(MessagePayload payload) { this.payload = payload; } public static boolean isValide(BroadMessageData sendMessageData) { if(sendMessageData == null || StringUtil.isNullOrEmpty(sendMessageData.getSender()) || sendMessageData.getPayload() == null) { return false; } return true; } public WFCMessage.Message toProtoMessage() { return WFCMessage.Message.newBuilder().setFromUser(sender) .setConversation(WFCMessage.Conversation.newBuilder().setType(ProtoConstants.ConversationType.ConversationType_Private).setTarget(sender).setLine(line)) .setContent(payload.toProtoMessageContent()) .build(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/BroadMessageResult.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class BroadMessageResult { private long messageUid; private long count; public BroadMessageResult() { } public BroadMessageResult(long messageUid, long count) { this.messageUid = messageUid; this.count = count; } public long getMessageUid() { return messageUid; } public void setMessageUid(long messageUid) { this.messageUid = messageUid; } public long getCount() { return count; } public void setCount(long count) { this.count = count; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/ChannelUpdateEvent.java ================================================ package cn.wildfirechat.pojos; public class ChannelUpdateEvent { public String operatorId; public String channelId; public int type; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/ChatroomMemberUpdateEvent.java ================================================ package cn.wildfirechat.pojos; import java.util.List; public class ChatroomMemberUpdateEvent { public String operatorId; public String chatroomId; public List memberIds; public int type; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/ChatroomUpdateEvent.java ================================================ package cn.wildfirechat.pojos; public class ChatroomUpdateEvent { public String chatroomId; public int type; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/ConferenceCreateEvent.java ================================================ package cn.wildfirechat.pojos; public class ConferenceCreateEvent { public String userId; public String roomId; public String serverId; public String description; public String pin; public int max_publishers; public int bitrate; public boolean advance; public boolean recording; public long timestamp; public ConferenceCreateEvent() { timestamp = System.currentTimeMillis(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/ConferenceDestroyEvent.java ================================================ package cn.wildfirechat.pojos; public class ConferenceDestroyEvent { public String userId; public String roomId; public long timestamp; public ConferenceDestroyEvent() { timestamp = System.currentTimeMillis(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/ConferenceJoinEvent.java ================================================ package cn.wildfirechat.pojos; public class ConferenceJoinEvent { public String userId; public String roomId; public boolean screenSharing; public long timestamp; public ConferenceJoinEvent() { timestamp = System.currentTimeMillis(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/ConferenceLeaveEvent.java ================================================ package cn.wildfirechat.pojos; public class ConferenceLeaveEvent { public String userId; public String roomId; public boolean rejoin; public boolean kicked; public boolean screenSharing; public long timestamp; public ConferenceLeaveEvent() { timestamp = System.currentTimeMillis(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/ConferencePublishEvent.java ================================================ package cn.wildfirechat.pojos; public class ConferencePublishEvent { public String userId; public boolean video; public String roomId; public boolean screenSharing; public long timestamp; public ConferencePublishEvent() { timestamp = System.currentTimeMillis(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/ConferenceUnpublishEvent.java ================================================ package cn.wildfirechat.pojos; public class ConferenceUnpublishEvent { public String userId; public String roomId; public boolean screenSharing; public long timestamp; public ConferenceUnpublishEvent() { timestamp = System.currentTimeMillis(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/Conversation.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; /** * 会话类 *

* 表示一个会话对象,包含会话类型、目标ID和线路信息。 * 用于标识消息发送或接收的目标会话。 *

*/ public class Conversation { private int type; private String target; private int line; public Conversation() { } public Conversation(int type, String target, int line) { this.type = type; this.target = target; this.line = line; } public int getType() { return type; } public void setType(int type) { this.type = type; } public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } public int getLine() { return line; } public void setLine(int line) { this.line = line; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/DeleteMessageData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class DeleteMessageData { private long messageUid; public long getMessageUid() { return messageUid; } public void setMessageUid(long messageUid) { this.messageUid = messageUid; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/FilesPojo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.ArrayList; import java.util.List; public class FilesPojo { public int total; public List files; public static class FilePojo { public long messageId; public String sender; public int conversationType; public String target; public int line; public String name; public String url; public int size; public int downloadCount; public long timestamp; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/ForwardDeviceMessageData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class ForwardDeviceMessageData { private String deviceId; private int type; private byte[] data; public ForwardDeviceMessageData() { } public ForwardDeviceMessageData(String deviceId, int type, byte[] data) { this.deviceId = deviceId; this.type = type; this.data = data; } public String getDeviceId() { return deviceId; } public void setDeviceId(String deviceId) { this.deviceId = deviceId; } public int getType() { return type; } public void setType(int type) { this.type = type; } public byte[] getData() { return data; } public void setData(byte[] data) { this.data = data; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/GetConversationFilesPojo.java ================================================ package cn.wildfirechat.pojos; public class GetConversationFilesPojo { public int conversationType; public String target; public int line; public String userId; public int offset; public boolean desc; public int count; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/GetOnlineUserCountResult.java ================================================ package cn.wildfirechat.pojos; import java.util.ArrayList; public class GetOnlineUserCountResult extends ArrayList { public static class Node { public int node; public int count; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/GetOnlineUserRequest.java ================================================ package cn.wildfirechat.pojos; import java.util.ArrayList; public class GetOnlineUserRequest { public int nodeId; public int offset; public int count; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/GetOnlineUserResult.java ================================================ package cn.wildfirechat.pojos; import java.util.ArrayList; public class GetOnlineUserResult { public static class UserClient { public String userId; public String clientId; public int platform; public String ip; } public ArrayList userClients; public int totalCount; public int offset; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/GetUserFilesPojo.java ================================================ package cn.wildfirechat.pojos; public class GetUserFilesPojo { public String userId; public int offset; public boolean desc; public int count; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/GetUserSessionResult.java ================================================ package cn.wildfirechat.pojos; import java.util.ArrayList; import java.util.List; public class GetUserSessionResult { public static class UserSession { public String userId; public String clientId; public int platform; public int pushType; public String deviceToken; public String deviceVoipToken; boolean isOnline; public UserSession() { } public UserSession(String userId, String clientId, int platform, int pushType, String deviceToken, String deviceVoipToken, boolean isOnline) { this.userId = userId; this.clientId = clientId; this.platform = platform; this.pushType = pushType; this.deviceToken = deviceToken; this.deviceVoipToken = deviceVoipToken; this.isOnline = isOnline; } } public List userSessions; public GetUserSessionResult() { userSessions = new ArrayList<>(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/GroupMemberUpdateEvent.java ================================================ package cn.wildfirechat.pojos; import java.util.List; public class GroupMemberUpdateEvent { public String operatorId; public String groupId; public List memberIds; public int type; public String value; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/GroupNotificationBinaryContent.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.protobuf.ByteString; import io.netty.util.internal.StringUtil; import java.util.List; import java.util.Map; public class GroupNotificationBinaryContent { //groupId private String g; //operator private String o; //value1(name or something) private String n; //members private List ms; //value2(member or something) private String m; private Map mi; private String extra; public GroupNotificationBinaryContent() { } public GroupNotificationBinaryContent(String g, String o, String n, String m) { this.g = g; this.o = o; this.n = n; this.m = m; } public GroupNotificationBinaryContent(String g, String operator, String name, List members) { this.g = g; this.o = operator; this.n = name; this.ms = members; } public String getG() { return g; } public void setG(String g) { this.g = g; } public String getM() { return m; } public void setM(String m) { this.m = m; } public String getO() { return o; } public void setO(String o) { this.o = o; } public String getN() { return n; } public void setN(String n) { this.n = n; } public List getMs() { return ms; } public void setMs(List ms) { this.ms = ms; } public GroupNotificationBinaryContent setMi(Map mi) { this.mi = mi; return this; } public GroupNotificationBinaryContent setExtra(String extra) { this.extra = extra; return this; } public WFCMessage.MessageContent getGroupNotifyContent(int groupContentType) { WFCMessage.MessageContent.Builder builder = WFCMessage.MessageContent.newBuilder().setType(groupContentType).setData(ByteString.copyFromUtf8(new GsonBuilder().disableHtmlEscaping().create().toJson(this))); if(!StringUtil.isNullOrEmpty(extra)) { builder.setExtra(extra); } return builder.build(); } public WFCMessage.MessageContent getAddGroupNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_ADD_GROUP_MEMBER); } public WFCMessage.MessageContent getCreateGroupNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CREATE_GROUP); } public WFCMessage.MessageContent getDismissGroupNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_DISMISS_GROUP); } public WFCMessage.MessageContent getKickokfMemberGroupNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_KICKOF_GROUP_MEMBER); } public WFCMessage.MessageContent getKickokfMemberVisibleGroupNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_KICKOF_GROUP_MEMBER_VISIBLE); } public WFCMessage.MessageContent getQuitGroupNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_QUIT_GROUP); } public WFCMessage.MessageContent getQuitVisibleGroupNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_QUIT_GROUP_VISIBLE); } public WFCMessage.MessageContent getTransferGroupNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_TRANSFER_GROUP_OWNER); } public WFCMessage.MessageContent getChangeGroupNameNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CHANGE_GROUP_NAME); } public WFCMessage.MessageContent getChangeGroupPortraitNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CHANGE_GROUP_PORTRAIT); } public WFCMessage.MessageContent getModifyGroupMemberAliasNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_MODIFY_GROUP_ALIAS); } public WFCMessage.MessageContent getModifyGroupMemberExtraNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_MODIFY_GROUP_MEMBER_EXTRA); } public WFCMessage.MessageContent getChangeGroupMuteNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CHANGE_MUTE); } public WFCMessage.MessageContent getChangeGroupJointypeNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CHANGE_JOINTYPE); } public WFCMessage.MessageContent getChangeGroupPrivatechatNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CHANGE_PRIVATECHAT); } public WFCMessage.MessageContent getChangeGroupSearchableNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_CHANGE_SEARCHABLE); } public WFCMessage.MessageContent getSetGroupManagerNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_SET_MANAGER); } public WFCMessage.MessageContent getMuteGroupMemberNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_MUTE_MEMBER); } public WFCMessage.MessageContent getAllowGroupMemberNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_ALLOW_MEMBER); } public WFCMessage.MessageContent getChangeGroupExtraNotifyContent() { return getGroupNotifyContent(ProtoConstants.MESSAGE_CONTENT_TYPE_MODIFY_GROUP_EXTRA); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/GroupUpdateEvent.java ================================================ package cn.wildfirechat.pojos; public class GroupUpdateEvent { public String operatorId; public String groupId; public int type; public PojoGroupInfo groupInfo; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/HealthCheckResult.java ================================================ package cn.wildfirechat.pojos; import java.util.ArrayList; import java.util.List; public class HealthCheckResult extends ArrayList { public static class Node { public String node; public CPU cpu; public Memory memory; public Disk disk; } public static class Memory { public long avail; public long max; public long free; } public static class Disk { public long usable; public long free; public long space; } public static class CPU { public int cores; public double load; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputAddFriendRequest.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputAddFriendRequest { private String userId; private String friendUid; private String reason; private boolean force; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getFriendUid() { return friendUid; } public void setFriendUid(String friendUid) { this.friendUid = friendUid; } public String getReason() { return reason; } public void setReason(String reason) { this.reason = reason; } public boolean isForce() { return force; } public void setForce(boolean force) { this.force = force; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputAddGroupMember.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; /** * 添加群组成员输入参数类 *

* 封装添加群组成员的输入参数,包括群组ID、成员列表、成员额外信息等。 *

*/ public class InputAddGroupMember extends InputGroupBase { private String group_id; private List members; private String member_extra; public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public List getMembers() { return members; } public void setMembers(List members) { this.members = members; } public String getMember_extra() { return member_extra; } public void setMemberExtra(String extra) { this.member_extra = extra; } public boolean isValide() { return true; } public WFCMessage.AddGroupMemberRequest toProtoGroupRequest() { WFCMessage.AddGroupMemberRequest.Builder addGroupBuilder = WFCMessage.AddGroupMemberRequest.newBuilder(); addGroupBuilder.setGroupId(group_id); if(!StringUtil.isNullOrEmpty(member_extra)) { addGroupBuilder.setExtra(member_extra); } for (PojoGroupMember pojoGroupMember : getMembers()) { WFCMessage.GroupMember.Builder groupMemberBuilder = WFCMessage.GroupMember.newBuilder().setMemberId(pojoGroupMember.getMember_id()); if (!StringUtil.isNullOrEmpty(pojoGroupMember.getAlias())) { groupMemberBuilder.setAlias(pojoGroupMember.getAlias()); } groupMemberBuilder.setType(pojoGroupMember.getType()); if(!StringUtil.isNullOrEmpty(pojoGroupMember.getExtra())) { groupMemberBuilder.setExtra(pojoGroupMember.getExtra()); } addGroupBuilder.addAddedMember(groupMemberBuilder); } if (to_lines != null) { for (Integer line : to_lines ) { addGroupBuilder.addToLine(line); } } if (notify_message != null) { addGroupBuilder.setNotifyContent(notify_message.toProtoMessageContent()); } return addGroupBuilder.build(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputApplicationGetUserInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputApplicationGetUserInfo { private String authCode; public String getAuthCode() { return authCode; } public void setAuthCode(String authCode) { this.authCode = authCode; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputBlacklistRequest.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputBlacklistRequest { private String userId; private String targetUid; private int status; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getTargetUid() { return targetUid; } public void setTargetUid(String targetUid) { this.targetUid = targetUid; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputChannelId.java ================================================ package cn.wildfirechat.pojos; public class InputChannelId { public String channelId; public InputChannelId() { } public InputChannelId(String channelId) { this.channelId = channelId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputChannelSubscribe.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputChannelSubscribe { private String target; private int subscribe; //1,订阅;0,取消订阅 public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } public int getSubscribe() { return subscribe; } public void setSubscribe(int subscribe) { this.subscribe = subscribe; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputChatroomId.java ================================================ package cn.wildfirechat.pojos; public class InputChatroomId { public String chatroomId; public InputChatroomId() { } public InputChatroomId(String chatroomId) { this.chatroomId = chatroomId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputChatroomMute.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputChatroomMute { private String chatroomId; private int status; public InputChatroomMute() { } public InputChatroomMute(String chatroomId, int status) { this.chatroomId = chatroomId; this.status = status; } public String getChatroomId() { return chatroomId; } public void setChatroomId(String chatroomId) { this.chatroomId = chatroomId; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputClearUserMessages.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputClearUserMessages { public InputClearUserMessages() { } public InputClearUserMessages(String userId, Conversation conversation, long startTime, long endTime) { this.userId = userId; this.conversation = conversation; this.startTime = startTime; this.endTime = endTime; } public String userId; public Conversation conversation; public long startTime; public long endTime; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputConferenceRequest.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information; please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputConferenceRequest { public String userId; public String clientId; public String request; public long sessionId; public String roomId; public String data; public boolean advance; public InputConferenceRequest() { } public InputConferenceRequest(String userId, String clientId, String request, long sessionId, String roomId, String data, boolean advance) { this.userId = userId; this.clientId = clientId; this.request = request; this.sessionId = sessionId; this.roomId = roomId; this.data = data; this.advance = advance; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputCountOffset.java ================================================ package cn.wildfirechat.pojos; public class InputCountOffset { public int count; public int offset; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputCreateChannel.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.List; public class InputCreateChannel { private String owner; private String name; private String targetId; private String callback; private String portrait; private int auto; private String secret; private String desc; private int state; private String extra; private long updateDt; public List menus; public WFCMessage.ChannelInfo toProtoChannelInfo() { WFCMessage.ChannelInfo.Builder builder = WFCMessage.ChannelInfo.newBuilder().setOwner(owner); if (!StringUtil.isNullOrEmpty(name)) builder = builder.setName(name); if (!StringUtil.isNullOrEmpty(targetId)) builder = builder.setTargetId(targetId); if (!StringUtil.isNullOrEmpty(callback)) builder = builder.setCallback(callback); if (!StringUtil.isNullOrEmpty(portrait)) builder = builder.setPortrait(portrait); builder = builder.setAutomatic(auto); if (!StringUtil.isNullOrEmpty(secret)) builder = builder.setSecret(secret); if (!StringUtil.isNullOrEmpty(desc)) builder = builder.setDesc(desc); builder = builder.setStatus(state); if (!StringUtil.isNullOrEmpty(extra)) builder = builder.setExtra(extra); if (!StringUtil.isNullOrEmpty(name)) builder = builder.setUpdateDt(updateDt); else builder = builder.setUpdateDt(System.currentTimeMillis()); if (menus != null && !menus.isEmpty()) { for (PojoChannelMenu menu : menus) { builder.addMenu(menu.toPbInfo()); } } return builder.build(); } public String getOwner() { return owner; } public void setOwner(String owner) { this.owner = owner; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getTargetId() { return targetId; } public void setTargetId(String targetId) { this.targetId = targetId; } public String getCallback() { return callback; } public void setCallback(String callback) { this.callback = callback; } public String getPortrait() { return portrait; } public void setPortrait(String portrait) { this.portrait = portrait; } public int getAuto() { return auto; } public void setAuto(int auto) { this.auto = auto; } public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public int getState() { return state; } public void setState(int state) { this.state = state; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public long getUpdateDt() { return updateDt; } public void setUpdateDt(long updateDt) { this.updateDt = updateDt; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputCreateChatroom.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; public class InputCreateChatroom { private String chatroomId; private String title; private String desc; private String portrait; private String extra; private Integer state; public WFCMessage.ChatroomInfo toChatroomInfo() { WFCMessage.ChatroomInfo.Builder builder = WFCMessage.ChatroomInfo.newBuilder().setTitle(title); if (!StringUtil.isNullOrEmpty(desc)) { builder.setDesc(desc); } if (!StringUtil.isNullOrEmpty(portrait)) { builder.setPortrait(portrait); } long current = System.currentTimeMillis(); builder.setCreateDt(current).setUpdateDt(current).setMemberCount(0); if (!StringUtil.isNullOrEmpty(extra)) { builder.setExtra(extra); } if (state == null || state == 0) { builder.setState(ProtoConstants.ChatroomState.Chatroom_State_Normal); } else if(state == 1) { builder.setState(ProtoConstants.ChatroomState.Chatroom_State_NotStart); } else { builder.setState(ProtoConstants.ChatroomState.Chatroom_State_End); } return builder.build(); } public InputCreateChatroom() { } public Integer getState() { return state; } public void setState(Integer state) { this.state = state; } public String getChatroomId() { return chatroomId; } public void setChatroomId(String chatroomId) { this.chatroomId = chatroomId; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public String getPortrait() { return portrait; } public void setPortrait(String portrait) { this.portrait = portrait; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputCreateDevice.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class InputCreateDevice { private String deviceId; private List owners; private String extra; public List getOwners() { return owners; } public void setOwners(List owners) { this.owners = owners; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public String getDeviceId() { return deviceId; } public void setDeviceId(String deviceId) { this.deviceId = deviceId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputCreateGroup.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; /** * 创建群组输入参数类 *

* 封装创建群组的输入参数,包括群组信息、成员列表、成员额外信息等。 *

*/ public class InputCreateGroup extends InputGroupBase { private PojoGroup group; private String member_extra; public boolean isValide() { return !StringUtil.isNullOrEmpty(operator) && group != null; } public WFCMessage.CreateGroupRequest toProtoGroupRequest() { WFCMessage.Group.Builder groupBuilder = WFCMessage.Group.newBuilder(); WFCMessage.GroupInfo.Builder groupInfoBuilder = WFCMessage.GroupInfo.newBuilder(); PojoGroupInfo group_info = group.getGroup_info(); if (!StringUtil.isNullOrEmpty(group_info.target_id)) { groupInfoBuilder.setTargetId(group_info.getTarget_id()); } if (!StringUtil.isNullOrEmpty(group_info.name)) { groupInfoBuilder.setName(group_info.getName()); } if (!StringUtil.isNullOrEmpty(group_info.portrait)) { groupInfoBuilder.setPortrait(group_info.getPortrait()); } if (!StringUtil.isNullOrEmpty(group_info.owner)) { groupInfoBuilder.setOwner(group_info.getOwner()); } groupInfoBuilder.setType(group_info.getType()); if (!StringUtil.isNullOrEmpty(group_info.extra)) { groupInfoBuilder.setExtra(group_info.getExtra()); } if (group_info.join_type > 0 && group_info.join_type < 128) { groupInfoBuilder.setJoinType(group_info.join_type); } if (group_info.mute > 0 && group_info.mute < 128) { groupInfoBuilder.setMute(group_info.mute); } if (group_info.private_chat > 0 && group_info.private_chat < 128) { groupInfoBuilder.setPrivateChat(group_info.private_chat); } if (group_info.searchable > 0 && group_info.searchable < 128) { groupInfoBuilder.setSearchable(group_info.searchable); } if(group_info.history_message > 0&& group_info.history_message < 128) { groupInfoBuilder.setHistoryMessage(group_info.history_message); } if(group_info.max_member_count > 0) { groupInfoBuilder.setMaxMemberCount(group_info.max_member_count); } if(group_info.isSuper_group()) { groupInfoBuilder.setSuperGroup(1); } groupInfoBuilder.setDeleted(0); groupBuilder.setGroupInfo(groupInfoBuilder); if(group.getMembers() != null) { for (PojoGroupMember pojoGroupMember : group.getMembers()) { WFCMessage.GroupMember.Builder groupMemberBuilder = WFCMessage.GroupMember.newBuilder().setMemberId(pojoGroupMember.getMember_id()); if (!StringUtil.isNullOrEmpty(pojoGroupMember.getAlias())) { groupMemberBuilder.setAlias(pojoGroupMember.getAlias()); } groupMemberBuilder.setType(pojoGroupMember.getType()); if (!StringUtil.isNullOrEmpty(pojoGroupMember.getExtra())) { groupMemberBuilder.setExtra(pojoGroupMember.extra); } groupBuilder.addMembers(groupMemberBuilder); } } WFCMessage.CreateGroupRequest.Builder createGroupReqBuilder = WFCMessage.CreateGroupRequest.newBuilder(); createGroupReqBuilder.setGroup(groupBuilder); if(!StringUtil.isNullOrEmpty(member_extra)) { createGroupReqBuilder.setMemberExtra(member_extra); } if (to_lines != null) { for (Integer line : to_lines ) { createGroupReqBuilder.addToLine(line); } } if (notify_message != null) { createGroupReqBuilder.setNotifyContent(notify_message.toProtoMessageContent()); } return createGroupReqBuilder.build(); } public PojoGroup getGroup() { return group; } public void setGroup(PojoGroup group) { this.group = group; } public String getMember_extra() { return member_extra; } public void setMember_extra(String member_extra) { this.member_extra = member_extra; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputCreateRobot.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; public class InputCreateRobot { private String userId; private String name; private String password; private String displayName; private String portrait; private int gender; private String mobile; private String email; private String address; private String company; private String social; private String extra; private long updateDt; private String owner; private String secret; private String callback; private String robotExtra; public String getSocial() { return social; } public void setSocial(String social) { this.social = social; } public WFCMessage.Robot toRobot() { WFCMessage.Robot.Builder builder = WFCMessage.Robot.newBuilder(); if (!StringUtil.isNullOrEmpty(userId)) builder.setUid(userId); if (!StringUtil.isNullOrEmpty(owner)) builder.setOwner(owner); if (!StringUtil.isNullOrEmpty(secret)) builder.setSecret(secret); if (!StringUtil.isNullOrEmpty(callback)) builder.setCallback(callback); if (!StringUtil.isNullOrEmpty(robotExtra)) builder.setExtra(robotExtra); builder.setState(0); return builder.build(); } public WFCMessage.User toUser() { WFCMessage.User.Builder newUserBuilder = WFCMessage.User.newBuilder() .setUid(userId); if (name != null) newUserBuilder.setName(name); if (displayName != null) newUserBuilder.setDisplayName(displayName); if (getPortrait() != null) newUserBuilder.setPortrait(getPortrait()); if (getEmail() != null) newUserBuilder.setEmail(getEmail()); if (getAddress() != null) newUserBuilder.setAddress(getAddress()); if (getCompany() != null) newUserBuilder.setCompany(getCompany()); if (getSocial() != null) newUserBuilder.setSocial(getSocial()); if (getMobile() != null) newUserBuilder.setMobile(getMobile()); if (getExtra() != null) newUserBuilder.setExtra(getExtra()); newUserBuilder.setType(ProtoConstants.UserType.UserType_Robot); newUserBuilder.setGender(gender); newUserBuilder.setUpdateDt(System.currentTimeMillis()); return newUserBuilder.build(); } public long getUpdateDt() { return updateDt; } public void setUpdateDt(long updateDt) { this.updateDt = updateDt; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public String getPortrait() { return portrait; } public void setPortrait(String portrait) { this.portrait = portrait; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getCompany() { return company; } public void setCompany(String company) { this.company = company; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public int getGender() { return gender; } public void setGender(int gender) { this.gender = gender; } public String getOwner() { return owner; } public void setOwner(String owner) { this.owner = owner; } public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } public String getCallback() { return callback; } public void setCallback(String callback) { this.callback = callback; } public String getRobotExtra() { return robotExtra; } public void setRobotExtra(String robotExtra) { this.robotExtra = robotExtra; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputDestoryChatroom.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputDestoryChatroom { private String chatroomId; public InputDestoryChatroom() { } public String getChatroomId() { return chatroomId; } public void setChatroomId(String chatroomId) { this.chatroomId = chatroomId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputDestroyUser.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputDestroyUser { private String userId; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputDeviceId.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputDeviceId { private String deviceId; public String getDeviceId() { return deviceId; } public void setDeviceId(String deviceId) { this.deviceId = deviceId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputDismissGroup.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class InputDismissGroup extends InputGroupBase { private String group_id; public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public boolean isValide() { if (StringUtil.isNullOrEmpty(group_id) || StringUtil.isNullOrEmpty(operator)) return false; return true; } public WFCMessage.DismissGroupRequest toProtoGroupRequest() { WFCMessage.DismissGroupRequest.Builder dismissGroupBuilder = WFCMessage.DismissGroupRequest.newBuilder(); dismissGroupBuilder.setGroupId(group_id); if (to_lines != null) { for (Integer line : to_lines ) { dismissGroupBuilder.addToLine(line); } } if (notify_message != null) { dismissGroupBuilder.setNotifyContent(notify_message.toProtoMessageContent()); } return dismissGroupBuilder.build(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetAlias.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputGetAlias { private String operator; private String targetId; public String getTargetId() { return targetId; } public void setTargetId(String targetId) { this.targetId = targetId; } public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetChannelInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputGetChannelInfo { private String channelId; public InputGetChannelInfo(String channelId) { this.channelId = channelId; } public String getChannelId() { return channelId; } public void setChannelId(String channelId) { this.channelId = channelId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetChatroomInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputGetChatroomInfo { private String chatroomId; public InputGetChatroomInfo(String chatroomId) { this.chatroomId = chatroomId; } public String getChatroomId() { return chatroomId; } public void setChatroomId(String chatroomId) { this.chatroomId = chatroomId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetConvReadTime.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputGetConvReadTime { private String userId; private int conversationType; private String target; private int line; public InputGetConvReadTime() { } public InputGetConvReadTime(String userId, int conversationType, String target, int line) { this.userId = userId; this.conversationType = conversationType; this.target = target; this.line = line; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public int getConversationType() { return conversationType; } public void setConversationType(int conversationType) { this.conversationType = conversationType; } public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } public int getLine() { return line; } public void setLine(int line) { this.line = line; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetFriendList.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; public class InputGetFriendList { private String userId; private int status; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetGroup.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputGetGroup { private String groupId; public String getGroupId() { return groupId; } public void setGroupId(String groupId) { this.groupId = groupId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetGroupMember.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputGetGroupMember { private String groupId; private String memberId; public String getGroupId() { return groupId; } public void setGroupId(String groupId) { this.groupId = groupId; } public String getMemberId() { return memberId; } public void setMemberId(String memberId) { this.memberId = memberId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetPresignedUploadUrl.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; /** * 请求预签名上传地址 *

* 请求封装预签名上传地址,包括: *

    *
  • 文件名
  • *
  • 文件类型
  • *
  • 媒体类型
  • *
*

*/ public class InputGetPresignedUploadUrl { public String fileName; public String contentType; public int mediaType; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetToken.java ================================================ package cn.wildfirechat.pojos; public class InputGetToken { private String userId; private String clientId; private Integer platform; public InputGetToken() { } public InputGetToken(String userId, String clientId, int platform) { this.userId = userId; this.clientId = clientId; this.platform = platform; } public Integer getPlatform() { return platform; } public void setPlatform(Integer platform) { this.platform = platform; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetUserGroupByType.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class InputGetUserGroupByType { private String userId; private List groupMemberTypes; public InputGetUserGroupByType() { } public InputGetUserGroupByType(String userId, List groupMemberTypes) { this.userId = userId; this.groupMemberTypes = groupMemberTypes; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public List getGroupMemberTypes() { return groupMemberTypes; } public void setGroupMemberTypes(List groupMemberTypes) { this.groupMemberTypes = groupMemberTypes; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetUserInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputGetUserInfo { private String userId; private String name; private String mobile; private boolean includeDeleted; public InputGetUserInfo() { } public InputGetUserInfo(String userId, String name, String mobile) { this.userId = userId; this.name = name; this.mobile = mobile; } public InputGetUserInfo(String userId, String name, String mobile, boolean includeDeleted) { this.userId = userId; this.name = name; this.mobile = mobile; this.includeDeleted = includeDeleted; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public boolean isIncludeDeleted() { return includeDeleted; } public void setIncludeDeleted(boolean includeDeleted) { this.includeDeleted = includeDeleted; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetUserList.java ================================================ package cn.wildfirechat.pojos; public class InputGetUserList { public int count; public int offset; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGetUserSK.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputGetUserSK { private String uid; private String cid; public InputGetUserSK(String uid, String cid) { this.uid = uid; this.cid = cid; } public String getUid() { return uid; } public void setUid(String uid) { this.uid = uid; } public String getCid() { return cid; } public void setCid(String cid) { this.cid = cid; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputGroupBase.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class InputGroupBase { public String operator; public List to_lines; public MessagePayload notify_message; private boolean isMeshMessage; public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public List getTo_lines() { return to_lines; } public void setTo_lines(List to_lines) { this.to_lines = to_lines; } public MessagePayload getNotify_message() { return notify_message; } public void setNotify_message(MessagePayload notify_message) { this.notify_message = notify_message; } public boolean isMeshMessage() { return isMeshMessage; } public void setMeshMessage(boolean meshMessage) { isMeshMessage = meshMessage; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputHandleFriendRequest.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputHandleFriendRequest { private String userId; private String friendUid; private int status; private boolean force; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getFriendUid() { return friendUid; } public void setFriendUid(String friendUid) { this.friendUid = friendUid; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public boolean isForce() { return force; } public void setForce(boolean force) { this.force = force; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputIntValue.java ================================================ package cn.wildfirechat.pojos; public class InputIntValue { public int value; public int getValue() { return value; } public void setValue(int value) { this.value = value; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputKickoffGroupMember.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class InputKickoffGroupMember extends InputGroupBase { private String group_id; private List members; public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public List getMembers() { return members; } public void setMembers(List members) { this.members = members; } public boolean isValide() { if (StringUtil.isNullOrEmpty(group_id) || StringUtil.isNullOrEmpty(operator) || members == null || members.isEmpty()) return false; return true; } public WFCMessage.RemoveGroupMemberRequest toProtoGroupRequest() { WFCMessage.RemoveGroupMemberRequest.Builder removedGroupBuilder = WFCMessage.RemoveGroupMemberRequest.newBuilder(); removedGroupBuilder.setGroupId(group_id); removedGroupBuilder.addAllRemovedMember(members); if (to_lines != null) { for (Integer line : to_lines ) { removedGroupBuilder.addToLine(line); } } if (notify_message != null) { removedGroupBuilder.setNotifyContent(notify_message.toProtoMessageContent()); } return removedGroupBuilder.build(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputMessageUid.java ================================================ package cn.wildfirechat.pojos; public class InputMessageUid { public long messageUid; public InputMessageUid() { } public InputMessageUid(long messageUid) { this.messageUid = messageUid; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputModifyChannelInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.Arrays; public class InputModifyChannelInfo { private int type; private String value; public int getType() { return type; } public void setType(int type) { this.type = type; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputModifyGroupInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.Arrays; import java.util.List; public class InputModifyGroupInfo extends InputGroupBase { private String group_id; //ModifyGroupInfoType private int type; private String value; public boolean isValide() { if (StringUtil.isNullOrEmpty(group_id) || StringUtil.isNullOrEmpty(operator)) return false; return true; } public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public int getType() { return type; } public void setType(int type) { this.type = type; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public WFCMessage.ModifyGroupInfoRequest toProtoGroupRequest() { if(notify_message != null && notify_message.getType() > 0) { return WFCMessage.ModifyGroupInfoRequest.newBuilder() .setGroupId(group_id) .setType(type) .setValue(value == null ? "" : value) .addAllToLine(to_lines == null || to_lines.isEmpty() ? Arrays.asList(0) : to_lines) .setNotifyContent(notify_message.toProtoMessageContent()) .build(); } else { return WFCMessage.ModifyGroupInfoRequest.newBuilder() .setGroupId(group_id) .setType(type) .setValue(value == null ? "" : value) .addAllToLine(to_lines == null || to_lines.isEmpty() ? Arrays.asList(0) : to_lines) .build(); } } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputMuteGroupMember.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class InputMuteGroupMember extends InputGroupBase { private String group_id; private List members; private boolean is_manager; public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public List getMembers() { return members; } public void setMembers(List members) { this.members = members; } public boolean isIs_manager() { return is_manager; } public void setIs_manager(boolean is_manager) { this.is_manager = is_manager; } public boolean isValide() { if (StringUtil.isNullOrEmpty(operator) || StringUtil.isNullOrEmpty(group_id) || members == null || members.isEmpty()) { return false; } return true; } public WFCMessage.SetGroupManagerRequest toProtoGroupRequest() { WFCMessage.SetGroupManagerRequest.Builder addGroupBuilder = WFCMessage.SetGroupManagerRequest.newBuilder(); addGroupBuilder.setGroupId(group_id); addGroupBuilder.addAllUserId(members); addGroupBuilder.setType(is_manager ? 1 : 0); if (to_lines != null) { for (Integer line : to_lines ) { addGroupBuilder.addToLine(line); } } if (notify_message != null) { addGroupBuilder.setNotifyContent(notify_message.toProtoMessageContent()); } return addGroupBuilder.build(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputOutputDomainInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputOutputDomainInfo { public String domainId; public String name; public String desc; public String email; public String tel; public String address; public String extra; public long dt; public String getDomainId() { return domainId; } public void setDomainId(String domainId) { this.domainId = domainId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getTel() { return tel; } public void setTel(String tel) { this.tel = tel; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public long getDt() { return dt; } public void setDt(long dt) { this.dt = dt; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputOutputDomainInfoList.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class InputOutputDomainInfoList { public List infos; public List getInfos() { return infos; } public void setInfos(List infos) { this.infos = infos; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputOutputSensitiveWords.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class InputOutputSensitiveWords { private List words; public List getWords() { return words; } public void setWords(List words) { this.words = words; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputOutputUserBlockStatus.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputOutputUserBlockStatus { private String userId; private int status; public InputOutputUserBlockStatus() { } public InputOutputUserBlockStatus(String userId, int status) { this.userId = userId; this.status = status; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputOutputUserInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; /** * 用户信息类 *

* 封装用户的所有信息,包括: *

    *
  • 用户ID、用户名、显示名称
  • *
  • 头像、性别
  • *
  • 手机号、邮箱、地址
  • *
  • 公司、社交信息
  • *
  • 用户类型、删除状态
  • *
  • 更新时间
  • *
  • 额外扩展信息
  • *
*

*/ public class InputOutputUserInfo { private String userId; private String name; private String password; private String displayName; private String portrait; private int gender; private String mobile; private String email; private String address; private String company; private String social; private String extra; private int type; private int deleted; private long updateDt; public static InputOutputUserInfo fromPbUser(WFCMessage.User pbUser) { InputOutputUserInfo inputCreateUser = new InputOutputUserInfo(); inputCreateUser.userId = pbUser.getUid(); inputCreateUser.name = pbUser.getName(); inputCreateUser.displayName = pbUser.getDisplayName(); inputCreateUser.portrait = pbUser.getPortrait(); inputCreateUser.gender = pbUser.getGender(); inputCreateUser.mobile = pbUser.getMobile(); inputCreateUser.email = pbUser.getEmail(); inputCreateUser.address = pbUser.getAddress(); inputCreateUser.company = pbUser.getCompany(); inputCreateUser.social = pbUser.getSocial(); inputCreateUser.extra = pbUser.getExtra(); inputCreateUser.type = pbUser.getType(); inputCreateUser.updateDt = pbUser.getUpdateDt(); inputCreateUser.deleted = pbUser.getDeleted(); return inputCreateUser; } public String getSocial() { return social; } public void setSocial(String social) { this.social = social; } public WFCMessage.User toUser() { WFCMessage.User.Builder newUserBuilder = WFCMessage.User.newBuilder() .setUid(userId); if (name != null) newUserBuilder.setName(name); if (displayName != null) newUserBuilder.setDisplayName(displayName); if (getPortrait() != null) newUserBuilder.setPortrait(getPortrait()); if (getEmail() != null) newUserBuilder.setEmail(getEmail()); if (getAddress() != null) newUserBuilder.setAddress(getAddress()); if (getCompany() != null) newUserBuilder.setCompany(getCompany()); if (getSocial() != null) newUserBuilder.setSocial(getSocial()); if (getMobile() != null) newUserBuilder.setMobile(getMobile()); if (getExtra() != null) newUserBuilder.setExtra(getExtra()); newUserBuilder.setGender(gender); newUserBuilder.setType(type); newUserBuilder.setDeleted(deleted); newUserBuilder.setUpdateDt(System.currentTimeMillis()); return newUserBuilder.build(); } public long getUpdateDt() { return updateDt; } public void setUpdateDt(long updateDt) { this.updateDt = updateDt; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public String getPortrait() { return portrait; } public void setPortrait(String portrait) { this.portrait = portrait; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getCompany() { return company; } public void setCompany(String company) { this.company = company; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public int getGender() { return gender; } public void setGender(int gender) { this.gender = gender; } public int getType() { return type; } public void setType(int type) { this.type = type; } public int getDeleted() { return deleted; } public void setDeleted(int deleted) { this.deleted = deleted; } @Override public String toString() { return "{" + "userId='" + userId + '\'' + ", name='" + name + '\'' + ", displayName='" + displayName + '\'' + ", portrait='" + portrait + '\'' + ", mobile='" + mobile + '\'' + ", updateDt=" + updateDt + '}'; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputQuitGroup.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class InputQuitGroup extends InputGroupBase { private String group_id; public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public boolean isValide() { if (StringUtil.isNullOrEmpty(group_id) || StringUtil.isNullOrEmpty(operator)) return false; return true; } public WFCMessage.QuitGroupRequest toProtoGroupRequest() { WFCMessage.QuitGroupRequest.Builder removedGroupBuilder = WFCMessage.QuitGroupRequest.newBuilder(); removedGroupBuilder.setGroupId(group_id); if (to_lines != null) { for (Integer line : to_lines ) { removedGroupBuilder.addToLine(line); } } if (notify_message != null) { removedGroupBuilder.setNotifyContent(notify_message.toProtoMessageContent()); } return removedGroupBuilder.build(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputRobotId.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputRobotId { private String robotId; public String getRobotId() { return robotId; } public void setRobotId(String robotId) { this.robotId = robotId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputSetChatroomBlacklist.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputSetChatroomBlacklist { private String chatroomId; private String userId; private int status; private long expiredTime; public InputSetChatroomBlacklist() { } public InputSetChatroomBlacklist(String chatroomId, String userId, int status, long expiredTime) { this.chatroomId = chatroomId; this.userId = userId; this.status = status; this.expiredTime = expiredTime; } public String getChatroomId() { return chatroomId; } public void setChatroomId(String chatroomId) { this.chatroomId = chatroomId; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public long getExpiredTime() { return expiredTime; } public void setExpiredTime(long expiredTime) { this.expiredTime = expiredTime; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputSetChatroomManager.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputSetChatroomManager { private String chatroomId; private String userId; private int status; public InputSetChatroomManager() { } public InputSetChatroomManager(String chatroomId, String userId, int status) { this.chatroomId = chatroomId; this.userId = userId; this.status = status; } public String getChatroomId() { return chatroomId; } public void setChatroomId(String chatroomId) { this.chatroomId = chatroomId; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputSetGroupManager.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class InputSetGroupManager extends InputGroupBase { private String group_id; private List members; private boolean is_manager; public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public List getMembers() { return members; } public void setMembers(List members) { this.members = members; } public boolean isIs_manager() { return is_manager; } public void setIs_manager(boolean is_manager) { this.is_manager = is_manager; } public boolean isValide() { if (StringUtil.isNullOrEmpty(operator) || StringUtil.isNullOrEmpty(group_id) || members == null || members.isEmpty()) { return false; } return true; } public WFCMessage.SetGroupManagerRequest toProtoGroupRequest() { WFCMessage.SetGroupManagerRequest.Builder addGroupBuilder = WFCMessage.SetGroupManagerRequest.newBuilder(); addGroupBuilder.setGroupId(group_id); addGroupBuilder.addAllUserId(members); addGroupBuilder.setType(is_manager ? 1 : 0); if (to_lines != null) { for (Integer line : to_lines ) { addGroupBuilder.addToLine(line); } } if (notify_message != null) { addGroupBuilder.setNotifyContent(notify_message.toProtoMessageContent()); } return addGroupBuilder.build(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputSetGroupMemberAlias.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class InputSetGroupMemberAlias extends InputGroupBase { private String group_id; private String memberId; private String alias; public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public boolean isValide() { return true; } public WFCMessage.ModifyGroupMemberAlias toProtoGroupRequest() { WFCMessage.ModifyGroupMemberAlias.Builder modifyAliasBuilder = WFCMessage.ModifyGroupMemberAlias.newBuilder(); modifyAliasBuilder.setGroupId(group_id); modifyAliasBuilder.setAlias(StringUtil.isNullOrEmpty(alias)?"":alias); modifyAliasBuilder.setMemberId(memberId); if (to_lines != null) { for (Integer line : to_lines) { modifyAliasBuilder.addToLine(line); } } if (notify_message != null) { modifyAliasBuilder.setNotifyContent(notify_message.toProtoMessageContent()); } return modifyAliasBuilder.build(); } public String getMemberId() { return memberId; } public void setMemberId(String memberId) { this.memberId = memberId; } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputSetGroupMemberExtra.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; public class InputSetGroupMemberExtra extends InputGroupBase { private String group_id; private String memberId; private String extra; public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public boolean isValide() { return true; } public WFCMessage.ModifyGroupMemberExtra toProtoGroupRequest() { WFCMessage.ModifyGroupMemberExtra.Builder modifyAliasBuilder = WFCMessage.ModifyGroupMemberExtra.newBuilder(); modifyAliasBuilder.setGroupId(group_id); modifyAliasBuilder.setMemberId(memberId); modifyAliasBuilder.setExtra(StringUtil.isNullOrEmpty(extra)?"": extra); if (to_lines != null) { for (Integer line : to_lines) { modifyAliasBuilder.addToLine(line); } } if (notify_message != null) { modifyAliasBuilder.setNotifyContent(notify_message.toProtoMessageContent()); } return modifyAliasBuilder.build(); } public String getMemberId() { return memberId; } public void setMemberId(String memberId) { this.memberId = memberId; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputStringList.java ================================================ package cn.wildfirechat.pojos; import java.util.List; public class InputStringList { private List list; public InputStringList() { } public InputStringList(List list) { this.list = list; } public List getList() { return list; } public void setList(List list) { this.list = list; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputStringValue.java ================================================ package cn.wildfirechat.pojos; public class InputStringValue { public String value; public String getValue() { return value; } public void setValue(String value) { this.value = value; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputSubscribeChannel.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputSubscribeChannel { private String channelId; private String userId; private int subscribe; //1,订阅;0,取消订阅 public InputSubscribeChannel() { } public InputSubscribeChannel(String channelId, String userId, int subscribe) { this.channelId = channelId; this.userId = userId; this.subscribe = subscribe; } public String getChannelId() { return channelId; } public void setChannelId(String channelId) { this.channelId = channelId; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public int getSubscribe() { return subscribe; } public void setSubscribe(int subscribe) { this.subscribe = subscribe; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputTransferGroup.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; public class InputTransferGroup extends InputGroupBase { private String group_id; private String new_owner; public boolean isValide() { if (StringUtil.isNullOrEmpty(group_id) || StringUtil.isNullOrEmpty(operator) || StringUtil.isNullOrEmpty(new_owner)) return false; return true; } public WFCMessage.TransferGroupRequest toProtoGroupRequest() { WFCMessage.TransferGroupRequest.Builder groupBuilder = WFCMessage.TransferGroupRequest.newBuilder(); groupBuilder.setGroupId(group_id); groupBuilder.setNewOwner(new_owner); if (to_lines != null) { for (Integer line : to_lines ) { groupBuilder.addToLine(line); } } if (notify_message != null) { groupBuilder.setNotifyContent(notify_message.toProtoMessageContent()); } return groupBuilder.build(); } public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public String getNew_owner() { return new_owner; } public void setNew_owner(String new_owner) { this.new_owner = new_owner; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputUpdateAlias.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputUpdateAlias { private String operator; private String targetId; private String alias; public String getTargetId() { return targetId; } public void setTargetId(String targetId) { this.targetId = targetId; } public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputUpdateFriendExtra.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputUpdateFriendExtra { private String operator; private String targetId; private String extra; public String getTargetId() { return targetId; } public void setTargetId(String targetId) { this.targetId = targetId; } public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputUpdateFriendStatusRequest.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputUpdateFriendStatusRequest { private String userId; private String friendUid; private int status; private String extra; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getFriendUid() { return friendUid; } public void setFriendUid(String friendUid) { this.friendUid = friendUid; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputUpdateUserInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; public class InputUpdateUserInfo { //UpdateUserInfoMask public int flag; public InputOutputUserInfo userInfo; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputUserConversation.java ================================================ package cn.wildfirechat.pojos; public class InputUserConversation { public String userId; public Conversation conversation; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputUserId.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputUserId { private String userId; public InputUserId() { } public InputUserId(String userId) { this.userId = userId; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/InputUserLogin.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class InputUserLogin { private String name; private String password; private String clientId; public String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/IntStringPairPojo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class IntStringPairPojo { private int intValue; private String strValue; public IntStringPairPojo() { } public IntStringPairPojo(int intValue, String strValue) { this.intValue = intValue; this.strValue = strValue; } public int getIntValue() { return intValue; } public void setIntValue(int intValue) { this.intValue = intValue; } public String getStrValue() { return strValue; } public void setStrValue(String strValue) { this.strValue = strValue; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/LongPojo.java ================================================ package cn.wildfirechat.pojos; public class LongPojo { public long value; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/MessagePayload.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import com.google.protobuf.ByteString; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.Base64; import java.util.List; /** * 消息内容负载类 *

* 封装消息的所有内容信息,包括: *

    *
  • 消息类型
  • *
  • 可搜索内容(文本消息的文本)
  • *
  • 推送内容和推送数据
  • *
  • 消息内容(二进制数据)
  • *
  • 媒体类型和远程URL
  • *
  • 持久化标志和过期时间
  • *
  • @提及信息
  • *
  • 额外数据
  • *
*

*/ public class MessagePayload { private int type; private String searchableContent; private String pushContent; private String pushData; private String content; private String base64edData; private int mediaType; private String remoteMediaUrl; private int persistFlag; private int expireDuration; private int mentionedType; private List mentionedTarget; private String extra; public int getType() { return type; } public void setType(int type) { this.type = type; } public String getSearchableContent() { return searchableContent; } public void setSearchableContent(String searchableContent) { this.searchableContent = searchableContent; } public String getPushContent() { return pushContent; } public void setPushContent(String pushContent) { this.pushContent = pushContent; } public String getContent() { return content; } public void setContent(String content) { this.content = content; } public String getBase64edData() { return base64edData; } public void setBase64edData(String base64edData) { this.base64edData = base64edData; } public int getMediaType() { return mediaType; } public void setMediaType(int mediaType) { this.mediaType = mediaType; } public String getRemoteMediaUrl() { return remoteMediaUrl; } public void setRemoteMediaUrl(String remoteMediaUrl) { this.remoteMediaUrl = remoteMediaUrl; } public int getPersistFlag() { return persistFlag; } public void setPersistFlag(int persistFlag) { this.persistFlag = persistFlag; } public int getExpireDuration() { return expireDuration; } public void setExpireDuration(int expireDuration) { this.expireDuration = expireDuration; } public int getMentionedType() { return mentionedType; } public void setMentionedType(int mentionedType) { this.mentionedType = mentionedType; } public List getMentionedTarget() { return mentionedTarget; } public void setMentionedTarget(List mentionedTarget) { this.mentionedTarget = mentionedTarget; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public String getPushData() { return pushData; } public void setPushData(String pushData) { this.pushData = pushData; } public WFCMessage.MessageContent toProtoMessageContent() { WFCMessage.MessageContent.Builder builder = WFCMessage.MessageContent.newBuilder() .setType(type) .setMediaType(mediaType) .setPersistFlag(persistFlag) .setExpireDuration(expireDuration) .setMentionedType(mentionedType); if (!StringUtil.isNullOrEmpty(searchableContent)) builder.setSearchableContent(searchableContent); if (!StringUtil.isNullOrEmpty(pushContent)) builder.setPushContent(pushContent); if (!StringUtil.isNullOrEmpty(content)) builder.setContent(content); if (!StringUtil.isNullOrEmpty(base64edData)) builder.setData(ByteString.copyFrom(Base64.getDecoder().decode(base64edData))); if (!StringUtil.isNullOrEmpty(remoteMediaUrl)) builder.setRemoteMediaUrl(remoteMediaUrl); if (mentionedTarget != null && mentionedTarget.size() > 0) builder.addAllMentionedTarget(mentionedTarget); if (!StringUtil.isNullOrEmpty(extra)) builder.setExtra(extra); if (!StringUtil.isNullOrEmpty(pushData)) builder.setPushData(pushData); return builder.build(); } public static MessagePayload fromProtoMessageContent(WFCMessage.MessageContent protoContent) { if (protoContent == null) return null; MessagePayload payload = new MessagePayload(); payload.type = protoContent.getType(); payload.searchableContent = protoContent.getSearchableContent(); payload.pushContent = protoContent.getPushContent(); payload.content = protoContent.getContent(); if (protoContent.getData() != null && protoContent.getData().size() > 0) payload.base64edData = Base64.getEncoder().encodeToString(protoContent.getData().toByteArray()); payload.mediaType = protoContent.getMediaType(); payload.remoteMediaUrl = protoContent.getRemoteMediaUrl(); payload.persistFlag = protoContent.getPersistFlag(); payload.expireDuration = protoContent.getExpireDuration(); payload.mentionedType = protoContent.getMentionedType(); payload.mentionedTarget = new ArrayList<>(); payload.mentionedTarget.addAll(protoContent.getMentionedTargetList()); payload.extra = protoContent.getExtra(); payload.pushData = protoContent.getPushData(); return payload; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/MultiMessageResult.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class MultiMessageResult { private long messageUid; private long timestamp; public MultiMessageResult() { } public MultiMessageResult(long messageUid, long timestamp) { this.messageUid = messageUid; this.timestamp = timestamp; } public long getMessageUid() { return messageUid; } public void setMessageUid(long messageUid) { this.messageUid = messageUid; } public long getTimestamp() { return timestamp; } public void setTimestamp(long timestamp) { this.timestamp = timestamp; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/MulticastMessageData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class MulticastMessageData { private String sender; private int line; private MessagePayload payload; private List targets; public String getSender() { return sender; } public void setSender(String sender) { this.sender = sender; } public int getLine() { return line; } public void setLine(int line) { this.line = line; } public MessagePayload getPayload() { return payload; } public void setPayload(MessagePayload payload) { this.payload = payload; } public static boolean isValide(MulticastMessageData sendMessageData) { if(sendMessageData == null || StringUtil.isNullOrEmpty(sendMessageData.getSender()) || sendMessageData.getPayload() == null) { return false; } return true; } public WFCMessage.MultiCastMessage toProtoMessage() { return WFCMessage.MultiCastMessage.newBuilder().setFromUser(sender) .setLine(line) .setContent(payload.toProtoMessageContent()) .addAllTo(targets) .build(); } public List getTargets() { return targets; } public void setTargets(List targets) { this.targets = targets; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/MyInfoType.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public interface MyInfoType { int Modify_DisplayName = 0; int Modify_Portrait = 1; int Modify_Gender = 2; int Modify_Mobile = 3; int Modify_Email = 4; int Modify_Address = 5; int Modify_Company = 6; int Modify_Social = 7; int Modify_Extra = 8; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputApplicationConfigData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputApplicationConfigData { private String appId; private int appType; private long timestamp; private String nonceStr; private String signature; public String getAppId() { return appId; } public void setAppId(String appId) { this.appId = appId; } public int getAppType() { return appType; } public void setAppType(int appType) { this.appType = appType; } public long getTimestamp() { return timestamp; } public void setTimestamp(long timestamp) { this.timestamp = timestamp; } public String getNonceStr() { return nonceStr; } public void setNonceStr(String nonceStr) { this.nonceStr = nonceStr; } public String getSignature() { return signature; } public void setSignature(String signature) { this.signature = signature; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputApplicationUserInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputApplicationUserInfo { private String userId; private String displayName; private String portraitUrl; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public String getPortraitUrl() { return portraitUrl; } public void setPortraitUrl(String portraitUrl) { this.portraitUrl = portraitUrl; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputBooleanValue.java ================================================ package cn.wildfirechat.pojos; public class OutputBooleanValue { public boolean value; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputChatroomBlackInfos.java ================================================ package cn.wildfirechat.pojos; import java.util.ArrayList; import java.util.List; public class OutputChatroomBlackInfos { public static class OutputChatroomBlackInfo { public String userId; public int state; public long expiredTime; public OutputChatroomBlackInfo() { } public OutputChatroomBlackInfo(String userId, int state, long expiredTime) { this.userId = userId; this.state = state; this.expiredTime = expiredTime; } } public List infos = new ArrayList<>(); public void addBlackInfo(String userId, int state, long expiredTime) { infos.add(new OutputChatroomBlackInfo(userId, state, expiredTime)); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputCheckUserOnline.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.ArrayList; import java.util.Collection; import java.util.List; public class OutputCheckUserOnline { public static class Session { public String clientId; public String userId; public int platform; public int status; //0 online, 1 have session offline public long lastSeen; public String packageName; public String ip; public Session() { } public Session(String clientId, String userId, int platform, int status, long lastSeen, String packageName, String ip) { this.clientId = clientId; this.userId = userId; this.platform = platform; this.status = status; this.lastSeen = lastSeen; this.packageName = packageName; this.ip = ip; } } public void addSession(String userId, String clientId, int platform, int status, long lastSeen, String packageName, String ip) { Session session = new Session(clientId, userId, platform, status, lastSeen, packageName, ip); sessions.add(session); } private List sessions = new ArrayList<>(); public List getSessions() { return sessions; } public void setSessions(List sessions) { this.sessions = sessions; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputClient.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class OutputClient { private int platform; private String clientId; public OutputClient() { } public OutputClient(int platform, String clientId) { this.platform = platform; this.clientId = clientId; } public int getPlatform() { return platform; } public void setPlatform(int platform) { this.platform = platform; } public String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputCreateChannel.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; public class OutputCreateChannel { private String targetId; private String secret; public OutputCreateChannel(String targetId, String secret) { this.targetId = targetId; this.secret = secret; } public String getTargetId() { return targetId; } public void setTargetId(String targetId) { this.targetId = targetId; } public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputCreateChatroom.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputCreateChatroom { private String chatroomId; public OutputCreateChatroom() { } public OutputCreateChatroom(String chatroomId) { this.chatroomId = chatroomId; } public String getChatroomId() { return chatroomId; } public void setChatroomId(String chatroomId) { this.chatroomId = chatroomId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputCreateDevice.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputCreateDevice { private String deviceId; private String token; private String secret; public OutputCreateDevice() { } public OutputCreateDevice(String userId, String token, String secret) { this.deviceId = userId; this.token = token; this.secret = secret; } public String getDeviceId() { return deviceId; } public void setDeviceId(String deviceId) { this.deviceId = deviceId; } public String getToken() { return token; } public void setToken(String token) { this.token = token; } public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputCreateGroupResult.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class OutputCreateGroupResult { private String group_id; public OutputCreateGroupResult(String group_id) { this.group_id = group_id; } public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputCreateRobot.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputCreateRobot { private String userId; private String secret; public OutputCreateRobot() { } public OutputCreateRobot(String userId, String secret) { this.userId = userId; this.secret = secret; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputCreateUser.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputCreateUser { private String userId; private String name; public OutputCreateUser() { } public OutputCreateUser(String userId, String name) { this.userId = userId; this.name = name; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getName() { return name; } public void setName(String name) { this.name = name; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputDevice.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import java.util.List; public class OutputDevice { private int state; private String deviceId; private String token; private String secret; private List owners; private String extra; public OutputDevice() { } public OutputDevice(String deviceId, String token, String secret) { this.deviceId = deviceId; this.token = token; this.secret = secret; } public String getDeviceId() { return deviceId; } public void setDeviceId(String deviceId) { this.deviceId = deviceId; } public String getToken() { return token; } public void setToken(String token) { this.token = token; } public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } public int getState() { return state; } public void setState(int state) { this.state = state; } public List getOwners() { return owners; } public void setOwners(List owners) { this.owners = owners; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputDeviceHost.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class OutputDeviceHost { private String host; public String getHost() { return host; } public void setHost(String host) { this.host = host; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputDeviceList.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class OutputDeviceList { private List devices; public List getDevices() { return devices; } public void setDevices(List devices) { this.devices = devices; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputGetAlias.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputGetAlias { private String operator; private String targetId; private String alias; public OutputGetAlias() { } public OutputGetAlias(String operator, String targetId) { this.operator = operator; this.targetId = targetId; } public String getTargetId() { return targetId; } public void setTargetId(String targetId) { this.targetId = targetId; } public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputGetChannelInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.List; public class OutputGetChannelInfo { public static class OutputMenuList extends ArrayList { } private String channelId; private String name; private String desc; private String portrait; private String extra; private String owner; private int state; private int status; private long updateDt; private String callback; private int automatic; private String secret; public List menus; public String getChannelId() { return channelId; } public void setChannelId(String channelId) { this.channelId = channelId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public String getPortrait() { return portrait; } public void setPortrait(String portrait) { this.portrait = portrait; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public String getOwner() { return owner; } public void setOwner(String owner) { this.owner = owner; } public int getState() { return state; } public void setState(int state) { this.state = state; } public long getUpdateDt() { return updateDt; } public void setUpdateDt(long updateDt) { this.updateDt = updateDt; } public String getCallback() { return callback; } public void setCallback(String callback) { this.callback = callback; } public int getAutomatic() { return automatic; } public void setAutomatic(int automatic) { this.automatic = automatic; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } public static OutputGetChannelInfo fromPbInfo(WFCMessage.ChannelInfo channelInfo) { OutputGetChannelInfo out = new OutputGetChannelInfo(); out.automatic = channelInfo.getAutomatic(); out.callback = channelInfo.getCallback(); out.channelId = channelInfo.getTargetId(); out.desc = channelInfo.getDesc(); out.extra = channelInfo.getExtra(); out.name = channelInfo.getName(); out.owner = channelInfo.getOwner(); out.portrait = channelInfo.getPortrait(); out.state = channelInfo.getStatus(); out.status = channelInfo.getStatus();; out.updateDt = channelInfo.getUpdateDt(); out.secret = channelInfo.getSecret(); if (channelInfo.getMenuCount() > 0) { out.menus = new ArrayList<>(); for (WFCMessage.ChannelMenu channelMenuMenu : channelInfo.getMenuList()) { out.menus.add(PojoChannelMenu.fromPbInfo(channelMenuMenu)); } } return out; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputGetChatroomInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; public class OutputGetChatroomInfo { private String chatroomId; private String title; private String desc; private String portrait; private String extra; private int state; private int memberCount; private long createDt; private long updateDt; public OutputGetChatroomInfo(String chatroomId, int memberCount, WFCMessage.ChatroomInfo chatroomInfo) { this.chatroomId = chatroomId; this.title = chatroomInfo.getTitle(); this.desc = chatroomInfo.getDesc(); this.portrait = chatroomInfo.getPortrait(); this.memberCount = memberCount; this.extra = chatroomInfo.getExtra(); this.state = chatroomInfo.getState(); this.createDt = chatroomInfo.getCreateDt(); this.updateDt = chatroomInfo.getUpdateDt(); } public OutputGetChatroomInfo() { } public int getMemberCount() { return memberCount; } public void setMemberCount(int memberCount) { this.memberCount = memberCount; } public long getCreateDt() { return createDt; } public void setCreateDt(long createDt) { this.createDt = createDt; } public long getUpdateDt() { return updateDt; } public void setUpdateDt(long updateDt) { this.updateDt = updateDt; } public String getChatroomId() { return chatroomId; } public void setChatroomId(String chatroomId) { this.chatroomId = chatroomId; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDesc() { return desc; } public void setDesc(String desc) { this.desc = desc; } public String getPortrait() { return portrait; } public void setPortrait(String portrait) { this.portrait = portrait; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public int getState() { return state; } public void setState(int state) { this.state = state; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputGetFriendList.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; import java.util.Map; public class OutputGetFriendList { private List friends; public List getFriends() { return friends; } public void setFriends(List friends) { this.friends = friends; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputGetIMTokenData.java ================================================ package cn.wildfirechat.pojos; public class OutputGetIMTokenData { private String userId; private String token; private String serverLabel; public OutputGetIMTokenData() { } public OutputGetIMTokenData(String userId, String imToken, String label) { this.userId = userId; this.token = imToken; this.serverLabel = label; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getToken() { return token; } public void setToken(String token) { this.token = token; } public String getServerLabel() { return serverLabel; } public void setServerLabel(String serverLabel) { this.serverLabel = serverLabel; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputGetUserList.java ================================================ package cn.wildfirechat.pojos; import java.util.List; public class OutputGetUserList { public List userInfoList; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputGroupIds.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class OutputGroupIds { private List groupIds; public List getGroupIds() { return groupIds; } public void setGroupIds(List groupIds) { this.groupIds = groupIds; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputGroupMemberList.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class OutputGroupMemberList { private List members; public List getMembers() { return members; } public void setMembers(List members) { this.members = members; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputLoginData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class OutputLoginData { private String userId; private String token; public OutputLoginData() { } public OutputLoginData(String userId, String token) { this.userId = userId; this.token = token; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getToken() { return token; } public void setToken(String token) { this.token = token; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputMessageData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class OutputMessageData { private long messageId; private String sender; private Conversation conv; private MessagePayload payload; private List toUsers; private long timestamp; private OutputClient client; private InputOutputUserInfo senderUserInfo; private InputOutputUserInfo targetUserInfo; private PojoGroupInfo targetGroupInfo; private OutputGetChannelInfo targetChannelInfo; private String toRobotId; public String getSender() { return sender; } public void setSender(String sender) { this.sender = sender; } public Conversation getConv() { return conv; } public void setConv(Conversation conv) { this.conv = conv; } public MessagePayload getPayload() { return payload; } public void setPayload(MessagePayload payload) { this.payload = payload; } public List getToUsers() { return toUsers; } public void setToUsers(List toUsers) { this.toUsers = toUsers; } public long getMessageId() { return messageId; } public void setMessageId(long messageId) { this.messageId = messageId; } public long getTimestamp() { return timestamp; } public void setTimestamp(long timestamp) { this.timestamp = timestamp; } public OutputClient getClient() { return client; } public void setClient(OutputClient client) { this.client = client; } public InputOutputUserInfo getSenderUserInfo() { return senderUserInfo; } public void setSenderUserInfo(InputOutputUserInfo senderUserInfo) { this.senderUserInfo = senderUserInfo; } public InputOutputUserInfo getTargetUserInfo() { return targetUserInfo; } public void setTargetUserInfo(InputOutputUserInfo targetUserInfo) { this.targetUserInfo = targetUserInfo; } public PojoGroupInfo getTargetGroupInfo() { return targetGroupInfo; } public void setTargetGroupInfo(PojoGroupInfo targetGroupInfo) { this.targetGroupInfo = targetGroupInfo; } public OutputGetChannelInfo getTargetChannelInfo() { return targetChannelInfo; } public void setTargetChannelInfo(OutputGetChannelInfo targetChannelInfo) { this.targetChannelInfo = targetChannelInfo; } public static OutputMessageData fromProtoMessage(WFCMessage.Message protoMessage) { return fromProtoMessage(protoMessage, null); } public String getToRobotId() { return toRobotId; } public void setToRobotId(String toRobotId) { this.toRobotId = toRobotId; } public static OutputMessageData fromProtoMessage(WFCMessage.Message protoMessage, OutputClient fromClient) { OutputMessageData data = new OutputMessageData(); data.messageId = protoMessage.getMessageId(); data.sender = protoMessage.getFromUser(); data.conv = new Conversation(); data.conv.setTarget(protoMessage.getConversation().getTarget()); data.conv.setType(protoMessage.getConversation().getType()); data.conv.setLine(protoMessage.getConversation().getLine()); data.payload = MessagePayload.fromProtoMessageContent(protoMessage.getContent()); data.timestamp = protoMessage.getServerTimestamp(); data.toUsers = protoMessage.getToList(); data.client = fromClient; return data; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputNotifyChannelSubscribeStatus.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputNotifyChannelSubscribeStatus { private String userId; private String channelId; private int status; public OutputNotifyChannelSubscribeStatus() { } public OutputNotifyChannelSubscribeStatus(String userId, String channelId, boolean subscirbed) { this.userId = userId; this.channelId = channelId; this.status = subscirbed ? 1 : 0; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getChannelId() { return channelId; } public void setChannelId(String channelId) { this.channelId = channelId; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputPresignedUploadUrl.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; /** * 预签名上传地址 *

* 封装预签名上传地址,包括: *

    *
  • 上传地址
  • *
  • 备选上传地址
  • *
  • 下载地址
  • *
  • 类型
  • *
*

*/ public class OutputPresignedUploadUrl { public String uploadUrl; public String backupUploadUrl; public String downloadUrl; public int type; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputReadData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputReadData { public String user; public Conversation conversation; public long readTime; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputRecallMessageData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputRecallMessageData { private OutputMessageData message; private String userId; private long timestamp; private boolean isAdmin; public OutputRecallMessageData() { } public OutputRecallMessageData(OutputMessageData message, String userId, long timestamp, boolean isAdmin) { this.message = message; this.userId = userId; this.timestamp = timestamp; this.isAdmin = isAdmin; } public OutputMessageData getMessage() { return message; } public void setMessage(OutputMessageData message) { this.message = message; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public long getTimestamp() { return timestamp; } public void setTimestamp(long timestamp) { this.timestamp = timestamp; } public boolean isAdmin() { return isAdmin; } public void setAdmin(boolean admin) { isAdmin = admin; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputRobot.java ================================================ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; public class OutputRobot { private String userId; private String name; private String password; private String displayName; private String portrait; private int gender; private String mobile; private String email; private String address; private String company; private String social; private String extra; private long updateDt; private String owner; private String secret; private String callback; private String robotExtra; public String getSocial() { return social; } public void setSocial(String social) { this.social = social; } public long getUpdateDt() { return updateDt; } public void setUpdateDt(long updateDt) { this.updateDt = updateDt; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public String getPortrait() { return portrait; } public void setPortrait(String portrait) { this.portrait = portrait; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getCompany() { return company; } public void setCompany(String company) { this.company = company; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public int getGender() { return gender; } public void setGender(int gender) { this.gender = gender; } public String getOwner() { return owner; } public void setOwner(String owner) { this.owner = owner; } public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } public String getCallback() { return callback; } public void setCallback(String callback) { this.callback = callback; } public String getRobotExtra() { return robotExtra; } public void setRobotExtra(String robotExtra) { this.robotExtra = robotExtra; } public void fromUser(WFCMessage.User user) { userId = user.getUid(); name = user.getName(); displayName = user.getDisplayName(); portrait = user.getPortrait(); gender = user.getGender(); mobile = user.getMobile(); email = user.getEmail(); address = user.getAddress(); company = user.getCompany(); social = user.getSocial(); extra = user.getExtra(); updateDt = user.getUpdateDt(); } public void fromRobot(WFCMessage.Robot robot, boolean withSecret) { setOwner(robot.getOwner()); if(withSecret) { setSecret(robot.getSecret()); } setCallback(robot.getCallback()); setRobotExtra(robot.getExtra()); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputRouteData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class OutputRouteData { ; private List serverIPs; private int longPort; private int shortPort; private String secret; public OutputRouteData() { } public OutputRouteData(List serverIPs, int longPort, int shortPort, String secret) { this.serverIPs = serverIPs; this.longPort = longPort; this.shortPort = shortPort; this.secret = secret; } public int getLongPort() { return longPort; } public void setLongPort(int longPort) { this.longPort = longPort; } public int getShortPort() { return shortPort; } public void setShortPort(int shortPort) { this.shortPort = shortPort; } public List getServerIPs() { return serverIPs; } public void setServerIPs(List serverIPs) { this.serverIPs = serverIPs; } public String getSecret() { return secret; } public void setSecret(String secret) { this.secret = secret; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputStringList.java ================================================ package cn.wildfirechat.pojos; import java.util.List; public class OutputStringList { private List list; public OutputStringList() { } public OutputStringList(List list) { this.list = list; } public List getList() { return list; } public void setList(List list) { this.list = list; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputTimestamp.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputTimestamp { private long timestamp; public OutputTimestamp() { } public OutputTimestamp(long timestamp) { this.timestamp = timestamp; } public long getTimestamp() { return timestamp; } public void setTimestamp(long timestamp) { this.timestamp = timestamp; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputUserBlockStatusList.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class OutputUserBlockStatusList { private List statusList; public List getStatusList() { return statusList; } public void setStatusList(List statusList) { this.statusList = statusList; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputUserChatroom.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputUserChatroom { public String userId; public String chatroomId; public String clientId; public int/*ProtoConstants.Platform*/ platform; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputUserInfoList.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import java.util.List; public class OutputUserInfoList { public List userInfos; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/OutputUserStatus.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class OutputUserStatus { private int status; public OutputUserStatus() { } public OutputUserStatus(int status) { this.status = status; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoChannelMenu.java ================================================ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.List; public class PojoChannelMenu { public String menuId; public String type; public String name; public String key; public String url; public String mediaId; public String articleId; public String appId; public String appPage; public String extra; public List subMenus; public static PojoChannelMenu fromPbInfo(WFCMessage.ChannelMenu channelMenuMenu) { PojoChannelMenu out = new PojoChannelMenu(); out.menuId = channelMenuMenu.getMenuId(); out.type = channelMenuMenu.getType(); out.name = channelMenuMenu.getName(); out.key = channelMenuMenu.getKey(); out.url = channelMenuMenu.getUrl(); out.mediaId = channelMenuMenu.getMediaId(); out.articleId = channelMenuMenu.getArticleId(); out.appId = channelMenuMenu.getAppId(); out.appPage = channelMenuMenu.getAppPage(); out.extra = channelMenuMenu.getExtra(); if (channelMenuMenu.getSubMenuCount() > 0) { out.subMenus = new ArrayList<>(); for (WFCMessage.ChannelMenu menuMenu : channelMenuMenu.getSubMenuList()) { out.subMenus.add(fromPbInfo(menuMenu)); } } return out; } public WFCMessage.ChannelMenu.Builder toPbInfo() { WFCMessage.ChannelMenu.Builder builder = WFCMessage.ChannelMenu.newBuilder(); builder.setType(type); builder.setName(name); if (!StringUtil.isNullOrEmpty(menuId)) builder.setMenuId(menuId); if (!StringUtil.isNullOrEmpty(key)) builder.setKey(key); if (!StringUtil.isNullOrEmpty(url)) builder.setUrl(url); if (!StringUtil.isNullOrEmpty(mediaId)) builder.setMediaId(mediaId); if (!StringUtil.isNullOrEmpty(articleId)) builder.setArticleId(articleId); if (!StringUtil.isNullOrEmpty(appId)) builder.setAppId(appId); if (!StringUtil.isNullOrEmpty(appPage)) builder.setAppPage(appPage); if (!StringUtil.isNullOrEmpty(extra)) builder.setExtra(extra); if (subMenus != null && !subMenus.isEmpty()) { subMenus.forEach(menuMenu -> builder.addSubMenu(menuMenu.toPbInfo())); } return builder; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoConferenceCreate.java ================================================ package cn.wildfirechat.pojos; public class PojoConferenceCreate { public String roomId; public String description; public String pin; public int max_publishers; public int bitrate; public boolean advance; public boolean recording; public boolean permanent; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoConferenceInfo.java ================================================ package cn.wildfirechat.pojos; public class PojoConferenceInfo { public String roomId; public String description; public int max_publishers; public boolean advance; public boolean recording; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoConferenceInfoList.java ================================================ package cn.wildfirechat.pojos; import java.util.ArrayList; import java.util.List; public class PojoConferenceInfoList { public PojoConferenceInfoList(List conferenceInfoList) { this.conferenceInfoList = conferenceInfoList; } public PojoConferenceInfoList() { conferenceInfoList = new ArrayList<>(); } public List conferenceInfoList; public void addConferenceInfo(PojoConferenceInfo conferenceInfo) { this.conferenceInfoList.add(conferenceInfo); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoConferenceParticipant.java ================================================ package cn.wildfirechat.pojos; import java.util.List; public class PojoConferenceParticipant { public static class Stream { public String type; public String mid; public String codec; } public String userId; public boolean publishing; public List streams; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoConferenceParticipantList.java ================================================ package cn.wildfirechat.pojos; import java.util.ArrayList; import java.util.List; public class PojoConferenceParticipantList { public PojoConferenceParticipantList(List participantList) { this.participantList = participantList; } public PojoConferenceParticipantList() { participantList = new ArrayList<>(); } public List participantList; public void addConferenceInfo(PojoConferenceParticipant participant) { this.participantList.add(participant); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoConferenceRecording.java ================================================ package cn.wildfirechat.pojos; public class PojoConferenceRecording { public String roomId; public boolean recording; public boolean advance; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoConferenceRoomId.java ================================================ package cn.wildfirechat.pojos; public class PojoConferenceRoomId { public String roomId; public boolean advance; public PojoConferenceRoomId() { } public PojoConferenceRoomId(String roomId, boolean advance) { this.roomId = roomId; this.advance = advance; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoConferenceRtpForwardReq.java ================================================ package cn.wildfirechat.pojos; public class PojoConferenceRtpForwardReq { public String roomId; public String publisherId; public String host; public int audioPort; public int audioPt; public long audioSSRC; public int videoPort; public int videoPt; public long videoSSRC; public PojoConferenceRtpForwardReq() { } public PojoConferenceRtpForwardReq(String roomId, String publisherId, String host, int audioPort, int audioPt, long audioSSRC, int videoPort, int videoPt, long videoSSRC) { this.roomId = roomId; this.publisherId = publisherId; this.host = host; this.audioPort = audioPort; this.audioPt = audioPt; this.audioSSRC = audioSSRC; this.videoPort = videoPort; this.videoPt = videoPt; this.videoSSRC = videoSSRC; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoConferenceRtpForwarders.java ================================================ package cn.wildfirechat.pojos; import java.util.List; public class PojoConferenceRtpForwarders { public static class RtpForwarder { public static class RtpStream { public long streamId; public String type; public String host; public int port; public long ssrc; public int pt; } public String publisherId; public List streams; } public String roomId; public List forwarders; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoConferenceStopRtpForwardReq.java ================================================ package cn.wildfirechat.pojos; public class PojoConferenceStopRtpForwardReq { public String roomId; public String publisherId; public long streamId; public PojoConferenceStopRtpForwardReq() { } public PojoConferenceStopRtpForwardReq(String roomId, String publisherId, long streamId) { this.roomId = roomId; this.publisherId = publisherId; this.streamId = streamId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoGroup.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; /** * 群组对象类 *

* 封装创建群组时使用的参数,包含群组信息和成员列表。 *

*/ public class PojoGroup { private PojoGroupInfo group_info; private List members; public PojoGroupInfo getGroup_info() { return group_info; } public void setGroup_info(PojoGroupInfo group_info) { this.group_info = group_info; } public List getMembers() { return members; } public void setMembers(List members) { this.members = members; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoGroupInfo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; /** * 群组信息类 *

* 封装群组的信息,包括: *

    *
  • 群组ID、名称、头像、所有者
  • *
  • 群组类型、成员数量、最大成员数
  • *
  • 群组设置(禁言、加群方式、私聊、可搜索、历史消息)
  • *
  • 是否超级群、是否已删除
  • *
  • 更新时间
  • *
*

*/ public class PojoGroupInfo { String target_id; String name; String portrait; String owner; int type; int member_count; String extra; int mute; int join_type; int private_chat; int searchable; int max_member_count; int history_message; boolean super_group; boolean deleted; long update_dt; long member_update_dt; public String getTarget_id() { return target_id; } public void setTarget_id(String target_id) { this.target_id = target_id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPortrait() { return portrait; } public void setPortrait(String portrait) { this.portrait = portrait; } public String getOwner() { return owner; } public void setOwner(String owner) { this.owner = owner; } public int getType() { return type; } public void setType(int type) { this.type = type; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public int getMax_member_count() { return max_member_count; } public void setMax_member_count(int max_member_count) { this.max_member_count = max_member_count; } public int getMute() { return mute; } public void setMute(int mute) { this.mute = mute; } public int getJoin_type() { return join_type; } public void setJoin_type(int join_type) { this.join_type = join_type; } public int getPrivate_chat() { return private_chat; } public void setPrivate_chat(int private_chat) { this.private_chat = private_chat; } public int getSearchable() { return searchable; } public void setSearchable(int searchable) { this.searchable = searchable; } public int getHistory_message() { return history_message; } public void setHistory_message(int history_message) { this.history_message = history_message; } public boolean isSuper_group() { return super_group; } public void setSuper_group(boolean super_group) { this.super_group = super_group; } public boolean isDeleted() { return deleted; } public void setDeleted(boolean deleted) { this.deleted = deleted; } public long getUpdate_dt() { return update_dt; } public void setUpdate_dt(long update_dt) { this.update_dt = update_dt; } public int getMember_count() { return member_count; } public void setMember_count(int member_count) { this.member_count = member_count; } public long getMember_update_dt() { return member_update_dt; } public void setMember_update_dt(long member_update_dt) { this.member_update_dt = member_update_dt; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoGroupInfoList.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class PojoGroupInfoList { public List groupInfoList; public List getGroupInfoList() { return groupInfoList; } public void setGroupInfoList(List groupInfoList) { this.groupInfoList = groupInfoList; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/PojoGroupMember.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; /** * 群组成员类 *

* 封装群组成员的信息,包括: *

    *
  • 成员ID
  • *
  • 群组内别名
  • *
  • 成员类型
  • *
  • 扩展信息
  • *
  • 更新时间和创建时间
  • *
*

*/ public class PojoGroupMember { String member_id; String alias; int type; String extra; long updateDt; long createDt; public String getMember_id() { return member_id; } public void setMember_id(String member_id) { this.member_id = member_id; } public String getAlias() { return alias; } public void setAlias(String alias) { this.alias = alias; } public int getType() { return type; } public void setType(int type) { this.type = type; } public String getExtra() { return extra; } public void setExtra(String extra) { this.extra = extra; } public long getUpdateDt() { return updateDt; } public void setUpdateDt(long updateDt) { this.updateDt = updateDt; } public long getCreateDt() { return createDt; } public void setCreateDt(long createDt) { this.createDt = createDt; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/RecallMessageData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; public class RecallMessageData { private String operator; private long messageUid; private boolean isUserRecall; public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public long getMessageUid() { return messageUid; } public void setMessageUid(long messageUid) { this.messageUid = messageUid; } public boolean isUserRecall() { return isUserRecall; } public void setUserRecall(boolean userRecall) { isUserRecall = userRecall; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/RecallMultiCastMessageData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class RecallMultiCastMessageData { public String operator; public long messageUid; public List receivers; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/RelationPojo.java ================================================ package cn.wildfirechat.pojos; public class RelationPojo { public String userId; public String targetId; public boolean isFriend; public boolean isBlacked; public String alias; public String extra; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/RelationUpdateEvent.java ================================================ package cn.wildfirechat.pojos; public class RelationUpdateEvent { public String userId; public String targetId; public int type; public String value; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/ReplyMessageData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class ReplyMessageData { private long messageUid; private MessagePayload payload; private boolean only2Sender; public long getMessageUid() { return messageUid; } public void setMessageUid(long messageUid) { this.messageUid = messageUid; } public MessagePayload getPayload() { return payload; } public void setPayload(MessagePayload payload) { this.payload = payload; } public boolean isOnly2Sender() { return only2Sender; } public void setOnly2Sender(boolean only2Sender) { this.only2Sender = only2Sender; } public static boolean isValide(ReplyMessageData sendMessageData) { if(sendMessageData.messageUid <=0 || sendMessageData.getPayload() == null) { return false; } return true; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/RepublishChannelMessageData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import java.util.List; public class RepublishChannelMessageData { private List targets; private long messageId; public List getTargets() { return targets; } public void setTargets(List targets) { this.targets = targets; } public long getMessageId() { return messageId; } public void setMessageId(long messageId) { this.messageId = messageId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/RobotCallbackPojo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class RobotCallbackPojo { private String url; public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/SendChannelMessageData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.ArrayList; import java.util.List; public class SendChannelMessageData { private List targets; private int line; private MessagePayload payload; public List getTargets() { return targets; } public void setTargets(List targets) { this.targets = targets; } public int getLine() { return line; } public void setLine(int line) { this.line = line; } public MessagePayload getPayload() { return payload; } public void setPayload(MessagePayload payload) { this.payload = payload; } public static boolean isValide(SendChannelMessageData sendMessageData) { if(sendMessageData == null || sendMessageData.getPayload() == null) { return false; } return true; } public WFCMessage.Message toProtoMessage(String channelId, String channelOwner) { if (targets == null) { targets = new ArrayList<>(); } return WFCMessage.Message.newBuilder().setFromUser(channelOwner) .setConversation(WFCMessage.Conversation.newBuilder().setType(ProtoConstants.ConversationType.ConversationType_Channel).setTarget(channelId).setLine(line)) .addAllTo(targets) .setContent(payload.toProtoMessageContent()) .build(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/SendMessageData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; import java.util.List; public class SendMessageData { private String sender; private Conversation conv; private MessagePayload payload; private List toUsers; private boolean isMeshMessage; private boolean isUserMessage; public String getSender() { return sender; } public void setSender(String sender) { this.sender = sender; } public Conversation getConv() { return conv; } public void setConv(Conversation conv) { this.conv = conv; } public MessagePayload getPayload() { return payload; } public void setPayload(MessagePayload payload) { this.payload = payload; } public List getToUsers() { return toUsers; } public void setToUsers(List toUsers) { this.toUsers = toUsers; } public boolean isMeshMessage() { return isMeshMessage; } public void setMeshMessage(boolean meshMessage) { isMeshMessage = meshMessage; } public boolean isUserMessage() { return isUserMessage; } public void setUserMessage(boolean userMessage) { isUserMessage = userMessage; } public static boolean isValide(SendMessageData sendMessageData) { if(sendMessageData == null || sendMessageData.getConv() == null || sendMessageData.getConv().getType() < 0 || sendMessageData.getConv().getType() > 6 || StringUtil.isNullOrEmpty(sendMessageData.getConv().getTarget()) || StringUtil.isNullOrEmpty(sendMessageData.getSender()) || sendMessageData.getPayload() == null) { return false; } return true; } public WFCMessage.Message toProtoMessage() { if (toUsers != null && toUsers.size() > 0) { return WFCMessage.Message.newBuilder().setFromUser(sender) .setConversation(WFCMessage.Conversation.newBuilder().setType(conv.getType()).setTarget(conv.getTarget()).setLine(conv.getLine())) .setContent(payload.toProtoMessageContent()) .addAllTo(toUsers) .build(); } else { return WFCMessage.Message.newBuilder().setFromUser(sender) .setConversation(WFCMessage.Conversation.newBuilder().setType(conv.getType()).setTarget(conv.getTarget()).setLine(conv.getLine())) .setContent(payload.toProtoMessageContent()) .build(); } } public static SendMessageData fromProtoMessage(WFCMessage.Message protoMessage) { SendMessageData data = new SendMessageData(); data.sender = protoMessage.getFromUser(); data.conv = new Conversation(); data.conv.setTarget(protoMessage.getConversation().getTarget()); data.conv.setType(protoMessage.getConversation().getType()); data.conv.setLine(protoMessage.getConversation().getLine()); data.payload = MessagePayload.fromProtoMessageContent(protoMessage.getContent()); return data; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/SendMessageResult.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; /** * 发送消息结果类 *

* 封装发送消息后的返回结果,包含消息UID和时间戳。 *

*/ public class SendMessageResult { private long messageUid; private long timestamp; public SendMessageResult() { } public SendMessageResult(long messageUid, long timestamp) { this.messageUid = messageUid; this.timestamp = timestamp; } public long getMessageUid() { return messageUid; } public void setMessageUid(long messageUid) { this.messageUid = messageUid; } public long getTimestamp() { return timestamp; } public void setTimestamp(long timestamp) { this.timestamp = timestamp; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/StringPairPojo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class StringPairPojo { private String first; private String second; public StringPairPojo() { } public StringPairPojo(String first, String second) { this.first = first; this.second = second; } public String getFirst() { return first; } public void setFirst(String first) { this.first = first; } public String getSecond() { return second; } public void setSecond(String second) { this.second = second; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/SystemSettingPojo.java ================================================ package cn.wildfirechat.pojos; public class SystemSettingPojo { public int id; public String value; public String desc; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/UpdateMessageContentData.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; public class UpdateMessageContentData { private String operator; private long messageUid; private MessagePayload payload; private int distribute; private int updateTimestamp; private int meshLocal; public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public long getMessageUid() { return messageUid; } public void setMessageUid(long messageUid) { this.messageUid = messageUid; } public MessagePayload getPayload() { return payload; } public void setPayload(MessagePayload payload) { this.payload = payload; } public int getDistribute() { return distribute; } public void setDistribute(int distribute) { this.distribute = distribute; } public int getUpdateTimestamp() { return updateTimestamp; } public void setUpdateTimestamp(int updateTimestamp) { this.updateTimestamp = updateTimestamp; } public int getMeshLocal() { return meshLocal; } public void setMeshLocal(int meshLocal) { this.meshLocal = meshLocal; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/UserOnlineStatus.java ================================================ package cn.wildfirechat.pojos; import java.util.List; public class UserOnlineStatus { public static final int ONLINE = 0; public static final int OFFLINE = 1; public static final int LOGOUT = -1; public String userId; public String clientId; public int platform; public int status; public long timestamp; public String packageName; public int customState; public String customText; public List sessions; public UserOnlineStatus() { } public UserOnlineStatus(String userId, String clientId, int platform, int status, String packageName) { this.userId = userId; this.clientId = clientId; this.platform = platform; this.status = status; this.packageName = packageName; this.timestamp = System.currentTimeMillis(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/UserSettingPojo.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos; import cn.wildfirechat.proto.WFCMessage; import io.netty.util.internal.StringUtil; public class UserSettingPojo { private String userId; private int scope; private String key; private String value; public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public int getScope() { return scope; } public void setScope(int scope) { this.scope = scope; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public WFCMessage.ModifyUserSettingReq toProtoRequest() { WFCMessage.ModifyUserSettingReq.Builder builder = WFCMessage.ModifyUserSettingReq.newBuilder(); builder.setScope(scope); if (!StringUtil.isNullOrEmpty(key)) builder.setKey(key); if(!StringUtil.isNullOrEmpty(value)) builder.setValue(value); return builder.build(); } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/MeshRestResult.java ================================================ package cn.wildfirechat.pojos.mesh; import com.google.gson.Gson; public class MeshRestResult { private static Gson gson = new Gson(); public enum MeshRestCode { SUCCESS(0, "success"), ERROR_INVALID_MOBILE(1, "无效的电话号码"), ERROR_SEND_SMS_OVER_FREQUENCY(3, "请求验证码太频繁"), ERROR_SERVER_ERROR(4, "服务器异常"), ERROR_CODE_EXPIRED(5, "验证码已过期"), ERROR_CODE_INCORRECT(6, "验证码或密码错误"), ERROR_SERVER_CONFIG_ERROR(7, "服务器配置错误"), ERROR_SESSION_EXPIRED(8, "会话不存在或已过期"), ERROR_SESSION_NOT_VERIFIED(9, "会话没有验证"), ERROR_SESSION_NOT_SCANED(10, "会话没有被扫码"), ERROR_SERVER_NOT_IMPLEMENT(11, "功能没有实现"), ERROR_GROUP_ANNOUNCEMENT_NOT_EXIST(12, "群公告不存在"), ERROR_NOT_LOGIN(13, "没有登录"), ERROR_NO_RIGHT(14, "没有权限"), ERROR_INVALID_PARAMETER(15, "无效参数"), ERROR_NOT_EXIST(16, "对象不存在"), ERROR_USER_NAME_ALREADY_EXIST(17, "用户名已经存在"), ERROR_SESSION_CANCELED(18, "会话已经取消"), ERROR_PASSWORD_INCORRECT(19, "密码错误"), ERROR_FAILURE_TOO_MUCH_TIMES(20, "密码错误次数太多,请等5分钟再试试"), ERROR_USER_FORBIDDEN(21, "用户被封禁"); public int code; public String msg; MeshRestCode(int code, String msg) { this.code = code; this.msg = msg; } } private int remote_im_code; private int remote_mesh_code; private int local_mesh_code; private String error_message; private T result; @Override public String toString() { return gson.toJson(this); } public static MeshRestResult ok() { return new MeshRestResult(); } public static MeshRestResult ok(Object object) { return new MeshRestResult(object); } public static MeshRestResult remoteIMError(int code, String message) { MeshRestResult r = new MeshRestResult(); r.remote_im_code = code; r.error_message = message; return r; } public static MeshRestResult remoteMeshError(int code, String message) { MeshRestResult r = new MeshRestResult(); r.remote_mesh_code = code; r.error_message = message; return r; } public MeshRestResult addRemoteMeshError(int code, String message) { MeshRestResult r = new MeshRestResult(); remote_mesh_code = code; error_message = message; return this; } public static MeshRestResult localMeshError(int code, String message) { MeshRestResult r = new MeshRestResult(); r.local_mesh_code = code; r.error_message = message; return r; } public MeshRestResult addLocalMeshError(int code, String message) { local_mesh_code = code; error_message = message; return this; } public MeshRestResult() { } public MeshRestResult(T object) { result = object; } public T getResult() { return result; } public void setResult(T result) { this.result = result; } public int getRemote_im_code() { return remote_im_code; } public void setRemote_im_code(int remote_im_code) { this.remote_im_code = remote_im_code; } public int getRemote_mesh_code() { return remote_mesh_code; } public void setRemote_mesh_code(int remote_mesh_code) { this.remote_mesh_code = remote_mesh_code; } public int getLocal_mesh_code() { return local_mesh_code; } public void setLocal_mesh_code(int local_mesh_code) { this.local_mesh_code = local_mesh_code; } public String getError_message() { return error_message; } public void setError_message(String error_message) { this.error_message = error_message; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoAddFriendReq.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoAddFriendReq { public String fromUserId; public String reason; public String targetUserId; public String domainId; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoAddGroupMember.java ================================================ package cn.wildfirechat.pojos.mesh; import cn.wildfirechat.pojos.PojoGroupMember; import java.util.List; public class PojoAddGroupMember { public String domainId; public String operator; public String group_id; public List members; public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public List getMembers() { return members; } public void setMembers(List members) { this.members = members; } public String getDomainId() { return domainId; } public void setDomainId(String domainId) { this.domainId = domainId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoAddJoinGroupRequest.java ================================================ package cn.wildfirechat.pojos.mesh; import java.util.List; public class PojoAddJoinGroupRequest { public String domainId; public String operator; public String group_id; public List userIds; public String reason; public String extra; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoDeleteFriend.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoDeleteFriend { public String domainId; public String operator; public String friendUid; public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getFriendUid() { return friendUid; } public void setFriendUid(String friendUid) { this.friendUid = friendUid; } public String getDomainId() { return domainId; } public void setDomainId(String domainId) { this.domainId = domainId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoDismissGroup.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoDismissGroup { public String domainId; public String operator; public String group_id; public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public String getDomainId() { return domainId; } public void setDomainId(String domainId) { this.domainId = domainId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoDomainPingRequest.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos.mesh; public class PojoDomainPingRequest { public String domainId; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoDomainPingResponse.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.pojos.mesh; public class PojoDomainPingResponse { public boolean success; public String errorMessage; public String myDomainName; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoGroupUpdated.java ================================================ package cn.wildfirechat.pojos.mesh; import cn.wildfirechat.pojos.PojoGroupInfo; import cn.wildfirechat.pojos.PojoGroupMember; import java.util.List; public class PojoGroupUpdated { public List domainIds; public PojoGroupInfo groupInfo; public List members; public List getDomainIds() { return domainIds; } public void setDomainIds(List domainIds) { this.domainIds = domainIds; } public PojoGroupInfo getGroupInfo() { return groupInfo; } public void setGroupInfo(PojoGroupInfo groupInfo) { this.groupInfo = groupInfo; } public List getMembers() { return members; } public void setMembers(List members) { this.members = members; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoHandleFriendRequestReq.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoHandleFriendRequestReq { public String userId; public int status; public String targetUserId; public String domainId; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoKickoffGroupMember.java ================================================ package cn.wildfirechat.pojos.mesh; import java.util.List; public class PojoKickoffGroupMember { public String domainId; public String operator; public String group_id; public List members; public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public String getDomainId() { return domainId; } public void setDomainId(String domainId) { this.domainId = domainId; } public List getMembers() { return members; } public void setMembers(List members) { this.members = members; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoModifyGroupInfo.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoModifyGroupInfo { public String domainId; public String operator; public String group_id; public int type; public String value; public String getDomainId() { return domainId; } public void setDomainId(String domainId) { this.domainId = domainId; } public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public int getType() { return type; } public void setType(int type) { this.type = type; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoPublishMessageReq.java ================================================ package cn.wildfirechat.pojos.mesh; import cn.wildfirechat.pojos.SendMessageData; import java.util.List; public class PojoPublishMessageReq { public SendMessageData messageData; public List receivers; public String domainId; public long messageId; public boolean republish; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoQuitGroup.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoQuitGroup { public String domainId; public String operator; public String group_id; public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public String getDomainId() { return domainId; } public void setDomainId(String domainId) { this.domainId = domainId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoRecallMessageReq.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoRecallMessageReq { public String domainId; public long messageId; public String operator; public boolean isSenderRecall; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoSearchUserReq.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoSearchUserReq { public String keyword; public int searchType; public int userType; public int page; public String domainId; public String getKeyword() { return keyword; } public void setKeyword(String keyword) { this.keyword = keyword; } public int getSearchType() { return searchType; } public void setSearchType(int searchType) { this.searchType = searchType; } public int getUserType() { return userType; } public void setUserType(int userType) { this.userType = userType; } public int getPage() { return page; } public void setPage(int page) { this.page = page; } public String getDomainId() { return domainId; } public void setDomainId(String domainId) { this.domainId = domainId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoSearchUserRes.java ================================================ package cn.wildfirechat.pojos.mesh; import cn.wildfirechat.pojos.InputOutputUserInfo; import java.util.List; public class PojoSearchUserRes { public List userInfos; public String keyword; public List getUserInfos() { return userInfos; } public void setUserInfos(List userInfos) { this.userInfos = userInfos; } public String getKeyword() { return keyword; } public void setKeyword(String keyword) { this.keyword = keyword; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoSendMessageReq.java ================================================ package cn.wildfirechat.pojos.mesh; import cn.wildfirechat.pojos.SendMessageData; public class PojoSendMessageReq { public SendMessageData messageData; public String clientId; public String domainId; public long messageId; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoString.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoString { public String domainId; public String string; public String getString() { return string; } public void setString(String string) { this.string = string; } public String getDomainId() { return domainId; } public void setDomainId(String domainId) { this.domainId = domainId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoStringList.java ================================================ package cn.wildfirechat.pojos.mesh; import java.util.List; public class PojoStringList { public String domainId; public List stringList; public List getStringList() { return stringList; } public void setStringList(List stringList) { this.stringList = stringList; } public String getDomainId() { return domainId; } public void setDomainId(String domainId) { this.domainId = domainId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoTransferGroup.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoTransferGroup { public String domainId; public String operator; public String newOwner; public String group_id; public String getOperator() { return operator; } public void setOperator(String operator) { this.operator = operator; } public String getGroup_id() { return group_id; } public void setGroup_id(String group_id) { this.group_id = group_id; } public String getNewOwner() { return newOwner; } public void setNewOwner(String newOwner) { this.newOwner = newOwner; } public String getDomainId() { return domainId; } public void setDomainId(String domainId) { this.domainId = domainId; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoUserConferenceEvent.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoUserConferenceEvent { public String domainId; public String data; public String userId; public String clientId; public boolean isRobot; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoUserConferenceRequest.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoUserConferenceRequest { public String domainId; public String clientID; public String fromUser; public String request; public long sessionId; public String roomId; public String data; public boolean advanced; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/mesh/PojoUserConferenceResponse.java ================================================ package cn.wildfirechat.pojos.mesh; public class PojoUserConferenceResponse { public String data; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/CommentMsgPojo.java ================================================ package cn.wildfirechat.pojos.moments; import java.util.List; public class CommentMsgPojo { //commentId; public long commentId; //sender; public String sender; //timestamp public long serverTime; //feedId public long feedId; //type public int type; //content public String text; //to replyTo public String replyTo; //extra public String extra; public int ftype; public String fcontent; public String fsender; public List fmedias; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/CommentPojo.java ================================================ package cn.wildfirechat.pojos.moments; public class CommentPojo { //commentId; public long commentId; //replyId; public long replyId; //sender; public String sender; //timestamp public long timestamp; //feedId public long feedId; //type public int type; //content public String text; //to replyTo public String replyTo; //extra public String extra; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/FeedPojo.java ================================================ package cn.wildfirechat.pojos.moments; import java.util.List; public class FeedPojo { //feedid public long feedId; //sender public String sender; //timestamp public long timestamp; //type public int type; //content public String text; //media urls public List medias; //to users public List to; //excloud users public List ex; //mentioned users public List mu; //extra public String extra; public List comments; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/FeedsPojo.java ================================================ package cn.wildfirechat.pojos.moments; import java.util.List; public class FeedsPojo { public List feeds; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/IdPojo.java ================================================ package cn.wildfirechat.pojos.moments; public class IdPojo { //feedid public long id; //feedid public long id2; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/MediaEntry.java ================================================ package cn.wildfirechat.pojos.moments; public class MediaEntry { public String m; public String t; public int w; public int h; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/MomentProfilePojo.java ================================================ package cn.wildfirechat.pojos.moments; import java.io.IOException; import java.util.Arrays; import java.util.List; public class MomentProfilePojo { public String bgUrl; public List blackList; public List blockList; //stranger visiable count public int svc; public int visiableScope; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/PostFeedResult.java ================================================ package cn.wildfirechat.pojos.moments; public class PostFeedResult { public long id; public long timestamp; public PostFeedResult(long id, long timestamp) { this.id = id; this.timestamp = timestamp; } } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/PullCommentsRequestPojo.java ================================================ package cn.wildfirechat.pojos.moments; import java.util.List; public class PullCommentsRequestPojo { public static class IdPair { public long fid; public long cid; } public List ids; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/PullFeedRequestPojo.java ================================================ package cn.wildfirechat.pojos.moments; public class PullFeedRequestPojo { //feedid public long feedId; public int count; public String user; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/PullOneFeedRequestPojo.java ================================================ package cn.wildfirechat.pojos.moments; public class PullOneFeedRequestPojo { public long feedId; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/PullProfileRequestPojo.java ================================================ package cn.wildfirechat.pojos.moments; public class PullProfileRequestPojo { //userId public String u; //update date public long d; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/PushProfileListRequestPojo.java ================================================ package cn.wildfirechat.pojos.moments; import java.util.List; public class PushProfileListRequestPojo { //block or black public boolean b; //add user list public List al; //remove user list public List rl; } ================================================ FILE: common/src/main/java/cn/wildfirechat/pojos/moments/PushProfileValueRequestPojo.java ================================================ package cn.wildfirechat.pojos.moments; public class PushProfileValueRequestPojo { /* WFMUpdateUserProfileType_BackgroudUrl, WFMUpdateUserProfileType_StrangerVisiableCount, WFMUpdateUserProfileType_VisiableScope */ public int t; //string value depends on t public String v; //int value depends on t public int i; } ================================================ FILE: common/src/main/java/cn/wildfirechat/proto/ProtoConstants.java ================================================ package cn.wildfirechat.proto; public class ProtoConstants { //message Conversation -> type public interface ConversationType { int ConversationType_Private = 0; int ConversationType_Group = 1; int ConversationType_ChatRoom = 2; int ConversationType_Channel = 3; int ConversationType_Things = 4; int ConversationType_SecretChat = 5; } //message GroupInfo -> type public interface GroupType { //member can add quit change group name and portrait, owner can do all the operations int GroupType_Normal = 0; //every member can add quit change group name and portrait, no one can kickoff others int GroupType_Free = 1; //member can only quit, owner can do all the operations int GroupType_Restricted = 2; //member can not do anything, server api manage the group int GroupType_Organization = 3; } //message GroupMember -> type public interface GroupMemberType { int GroupMemberType_Normal = 0; int GroupMemberType_Manager = 1; int GroupMemberType_Owner = 2; int GroupMemberType_Silent = 3; int GroupMemberType_Removed = 4; int GroupMemberType_Allowed = 5; } //message FriendRequest -> status public interface FriendRequestStatus { int RequestStatus_Sent = 0; int RequestStatus_Accepted = 1; int RequestStatus_Rejected = 2; } //message UploadDeviceTokenRequest -> platform public interface Platform { int Platform_UNSET = 0; int Platform_iOS = 1; int Platform_Android = 2; int Platform_Windows = 3; int Platform_OSX = 4; int Platform_WEB = 5; int Platform_WX = 6; int Platform_LINUX = 7; int Platform_iPad = 8; int Platform_APad = 9; int Platform_Harmony = 10; int Platform_HarmonyPad = 11; int Platform_HarmonyPC = 12; // 穿戴端 (Wearable) int Platform_AndroidWearable = 13; int Platform_HarmonyWearable = 14; // TV端 int Platform_AndroidTV = 15; int Platform_AppleTV = 16; int Platform_HarmonyTV = 17; int Platform_MAX = Platform_HarmonyTV; } //message NotifyMessage & PullMessageRequest -> type public interface PullType { int Pull_Normal = 0; int Pull_ChatRoom = 1; int Pull_Group = 2; } //message UserResult -> code public interface UserResultCode { int Success = 0; int NotFound = 1; int NotModified = 2; } //message ChatroomInfo -> state public interface ChatroomState { int Chatroom_State_Normal = 0; int Chatroom_State_NotStart = 1; int Chatroom_State_End = 2; } //message MessageContent -> contentType public interface ContentType { int Unknown = 0; int Text = 1; int Voice = 2; int Image = 3; int Location = 4; int File = 5; int Video = 6; int Sticker = 7; int Link = 8; int P_TEXT = 9; int Name_Card = 10; int Composited = 11; int Rich_Notification = 12; int Articles = 13; int StreamingText_Generationg = 14; int StreamingText_Generated = 15; int Not_Delivered = 16; int Ptt_Voice = 23; int Enter_Channel_Chat = 71; int Leave_Channel_Chat = 72; int Recall = 80; int Delete = 81; int Tip = 90; int Typing = 91; int Friend_Greeting = 92; int Friend_Added = 93; int PC_Login_Request = 94; int Create_Group = 104; int Add_Group_Member = 105; int Kickoff_Group_Member = 106; int Quit_Group = 107; int Dismiss_Group = 108; int Transfer_Group_Owner = 109; int Change_Group_Name = 110;; int Modify_Group_Alias = 111; int Change_Group_Portrait = 112; int Change_Group_Mute = 113; int Change_Group_JoinType = 114; int Change_Group_PrivateChat = 115; int Change_Group_Searchable = 116; int Set_Group_Manager = 117; int Mute_Group_Member = 118; int Allow_Group_Member = 119; int Kickoff_Group_Member_Visible_Notification = 120; int Quit_Group_Visible_Notification = 121; int Modify_Group_Extra = 122; int Modify_Group_Member_Extra = 123; int Call_Start = 400; int Call_Accept = 401; int Call_End = 402; int Call_Add_Participant = 406; int Call_Multi_Call_Ongoing = 416; } public interface MessagePersistFlag { int NOT_PERSIST = 0; int PERSIST = 1; int PERSIST_AND_COUNT = 3; int TRANSPARENT = 4; } public interface MessageMediaType { int GENERAL = 0; int IMAGE = 1; int VOICE = 2; int VIDEO = 3; int FILE = 4; int PORTRAIT = 5; int FAVORITE = 6; int STICKER = 7; int MOMENTS = 8; } //ModifyGroupInfoRequest -> type public interface ModifyGroupInfoType { int Modify_Group_Name = 0; int Modify_Group_Portrait = 1; int Modify_Group_Extra = 2; int Modify_Group_Mute = 3; int Modify_Group_JoinType = 4; int Modify_Group_PrivateChat = 5; int Modify_Group_Searchable = 6; //仅专业版支持 int Modify_Group_History_Message = 7; //仅专业版的server api支持 int Modify_Group_Max_Member_Count = 8; //仅专业版的server api支持 int Modify_Group_Super_Group = 9; int Modify_Group_Type = 10; } //ModifyGroupInfoRequest -> type public interface PersistFlag { int Not_Persist = 0; int Persist = 1; int Persist_And_Count = 3; int Transparent = 4; } //ModifyChannelInfoRequest -> type public interface ModifyChannelInfoType { int Modify_Channel_Name = 0; int Modify_Channel_Portrait = 1; int Modify_Channel_Desc = 2; int Modify_Channel_Extra = 3; int Modify_Channel_Secret = 4; int Modify_Channel_Callback = 5; int Modify_Channel_OnlyCallback = 6; int Modify_Channel_Menu = 7; } //Channel -> status //第0位表示是否允许查看用户所有信息,还是只允许看用户id,用户名称,用户昵称和用户头像 //第1位表示是否允许查看非订阅用户信息 //第2位表示是否允许主动添加用户订阅关系 //第3位表示是否允许给非订阅用户发送消息 //第4位表示是否私有,不可以被用户搜索和主动订阅 //第6位表示是否删除 //第8位表示是否是全局频道,全局频道没有订阅关系,会发送给系统内所有成员。可以给非订阅用户单独发消息。 public interface ChannelState { int Channel_State_Mask_FullInfo = 0x01; int Channel_State_Mask_Unsubscribed_User_Access = 0x02; int Channel_State_Mask_Active_Subscribe = 0x04; int Channel_State_Mask_Message_Unsubscribed = 0x08; int Channel_State_Mask_Private = 0x10; int Channel_State_Mask_Deleted = 0x40; int Channel_State_Mask_Global = 0x80; } public interface UserType { int UserType_Normal = 0; int UserType_Robot = 1; int UserType_Device = 2; int UserType_Admin = 3; int UserType_Super_Admin = 100; } public interface SystemSettingType { int Group_Max_Member_Count = 1; int NOT_ALLOW_USER_NAMES = 2; } public interface SearchUserType { int SearchUserType_General = 0; int SearchUserType_Name_Mobile = 1; int SearchUserType_Name = 2; int SearchUserType_Mobile = 3; int SearchUserType_UserId = 4; int SearchUserType_Name_Mobile_UserId = 5; int SearchUserType_Name_Mobile_DisplayName = 100; } public interface UserSearchUserType { int UserSearchUserType_ALL = 0; int UserSearchUserType_ONLY_USER = 1; int UserSearchUserType_ONLY_ROBOT = 2; } public interface DisableSearchMask { int DisableSearchDisplayNameMask = 1; int DisableSearchNameMask = 2; int DisableSearchMobileMask = 4; int DisableSearchUserIdMask = 8; } public interface UserStatus { int Normal = 0; int Muted = 1; int Forbidden = 2; } public interface BlacklistStrategy { int Message_Reject = 0; int Message_Ignore = 1; } public interface GroupUpdateEventType { int Group_Event_Create = 0; int Group_Event_Update = 1; int Group_Event_Transfer = 2; int Group_Event_Mute = 3; int Group_Event_Unmute = 4; int Group_Event_Destroy = 5; } public interface GroupMemberUpdateEventType { int Group_Member_Event_Join = 0; int Group_Member_Event_Leave = 1; int Group_Member_Event_Kickoff = 2; int Group_Member_Event_Type_Update = 3; int Group_Member_Event_Alias = 4; int Group_Member_Event_Extra = 5; } public interface ChannelUpdateEventType { int Channel_Event_Create = 0; int Channel_Event_Update = 1; int Channel_Event_Transfer = 2; int Channel_Event_Destroy = 3; } public interface ChatroomUpdateEventType { int Chatroom_Event_Create = 0; int Chatroom_Event_Destroy = 1; } public interface ChatroomMemberUpdateEventType { int Chatroom_Member_Event_Join = 0; int Chatroom_Member_Event_Leave = 1; int Chatroom_Member_Event_Kickoff = 2; int Chatroom_Member_Event_Mute = 3; int Chatroom_Member_Event_Unmute = 4; } public interface UpdateUserInfoMask { int Update_User_DisplayName = 0x01; int Update_User_Portrait = 0x02; int Update_User_Gender = 0x04; int Update_User_Mobile = 0x08; int Update_User_Email = 0x10; int Update_User_Address = 0x20; int Update_User_Company = 0x40; int Update_User_Social = 0x80; int Update_User_Extra = 0x100; int Update_User_Name = 0x200; } public enum RequestSourceType { Request_From_User, Request_From_Admin, Request_From_Robot, Request_From_Channel; } public interface ApplicationType { int ApplicationType_Robot = 0; int ApplicationType_Channel = 1; int ApplicationType_Admin = 2; } //禁止客户端群操作。 // 第1位是禁止创建群组, // 第2位是禁止销毁群组, // 3位禁止加入群, // 4位禁止退出群, // 5位禁止邀请群成员, // 6位禁止移出群成员, // 7位禁止转移群 // 8位禁止设置群管理员 // 9位禁止允许群成员(专业版支持), // 10位禁止群禁言 // 11位禁止修改群组信息, // 12位禁止群成员禁言(专业版支持) public interface ForbiddenClientGroupOperationMask { int Forbidden_Create_Group = 0x01; int Forbidden_Dismiss_Group = 0x02; int Forbidden_Join_Group = 0x04; int Forbidden_Quit_Group = 0x08; int Forbidden_Invite_Group_Member = 0x10; int Forbidden_Kickoff_Group_Member = 0x20; int Forbidden_Transfer_Group = 0x40; int Forbidden_Set_Group_Manage = 0x80; int Forbidden_Allow_Group_Member = 0x100; int Forbidden_Mute_Group = 0x200; int Forbidden_Modify_Group_Info = 0x400; int Forbidden_Mute_Group_Member = 0x800; } public interface MomentsContentType { int Moments_Content_Text_Type = 0; int Moments_Content_Image_Type = 1; int Moments_Content_Video_Type = 2; int Moments_Content_Link_Type = 3; } public interface MomentsCommentType { int Moments_Comment_Text_Type = 0; int Moments_Comment_Thumbup_Type = 1; } public interface MomentsVisibleScope { int Moments_VisibleScope_NoLimit = 0; int Moments_VisibleScope_3Days = 1; int Moments_VisibleScope_1Month = 2; int Moments_VisibleScope_6Months = 3; }; public static final int MESSAGE_CONTENT_TYPE_CREATE_GROUP = 104; public static final int MESSAGE_CONTENT_TYPE_ADD_GROUP_MEMBER = 105; public static final int MESSAGE_CONTENT_TYPE_KICKOF_GROUP_MEMBER = 106; public static final int MESSAGE_CONTENT_TYPE_QUIT_GROUP = 107; public static final int MESSAGE_CONTENT_TYPE_DISMISS_GROUP = 108; public static final int MESSAGE_CONTENT_TYPE_TRANSFER_GROUP_OWNER = 109; public static final int MESSAGE_CONTENT_TYPE_CHANGE_GROUP_NAME = 110; public static final int MESSAGE_CONTENT_TYPE_MODIFY_GROUP_ALIAS = 111; public static final int MESSAGE_CONTENT_TYPE_CHANGE_GROUP_PORTRAIT = 112; public static final int MESSAGE_CONTENT_TYPE_CHANGE_MUTE = 113; public static final int MESSAGE_CONTENT_TYPE_CHANGE_JOINTYPE = 114; public static final int MESSAGE_CONTENT_TYPE_CHANGE_PRIVATECHAT = 115; public static final int MESSAGE_CONTENT_TYPE_CHANGE_SEARCHABLE = 116; public static final int MESSAGE_CONTENT_TYPE_SET_MANAGER = 117; public static final int MESSAGE_CONTENT_TYPE_MUTE_MEMBER = 118; public static final int MESSAGE_CONTENT_TYPE_ALLOW_MEMBER = 119; public static final int MESSAGE_CONTENT_TYPE_KICKOF_GROUP_MEMBER_VISIBLE = 120; public static final int MESSAGE_CONTENT_TYPE_QUIT_GROUP_VISIBLE = 121; public static final int MESSAGE_CONTENT_TYPE_MODIFY_GROUP_EXTRA = 122; public static final int MESSAGE_CONTENT_TYPE_MODIFY_GROUP_MEMBER_EXTRA = 123; public static final int MESSAGE_CONTENT_TYPE_MODIFY_GROUP_SETTINGS = 124; public static final int MESSAGE_CONTENT_TYPE_REJECT_JOIN_GROUP = 125; } ================================================ FILE: common/src/main/java/cn/wildfirechat/proto/WFCMessage.java ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! // source: wfcmessage_community.proto package cn.wildfirechat.proto; public final class WFCMessage { private WFCMessage() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { } public interface AddFriendRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string target_uid = 1; /** * required string target_uid = 1; */ boolean hasTargetUid(); /** * required string target_uid = 1; */ java.lang.String getTargetUid(); /** * required string target_uid = 1; */ com.google.protobuf.ByteString getTargetUidBytes(); // required string reason = 2; /** * required string reason = 2; */ boolean hasReason(); /** * required string reason = 2; */ java.lang.String getReason(); /** * required string reason = 2; */ com.google.protobuf.ByteString getReasonBytes(); // optional string extra = 3; /** * optional string extra = 3; */ boolean hasExtra(); /** * optional string extra = 3; */ java.lang.String getExtra(); /** * optional string extra = 3; */ com.google.protobuf.ByteString getExtraBytes(); } /** * Protobuf type {@code AddFriendRequest} */ public static final class AddFriendRequest extends com.google.protobuf.GeneratedMessage implements AddFriendRequestOrBuilder { // Use AddFriendRequest.newBuilder() to construct. private AddFriendRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private AddFriendRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final AddFriendRequest defaultInstance; public static AddFriendRequest getDefaultInstance() { return defaultInstance; } public AddFriendRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private AddFriendRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; targetUid_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; reason_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; extra_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_AddFriendRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_AddFriendRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.AddFriendRequest.class, cn.wildfirechat.proto.WFCMessage.AddFriendRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public AddFriendRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new AddFriendRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string target_uid = 1; public static final int TARGET_UID_FIELD_NUMBER = 1; private java.lang.Object targetUid_; /** * required string target_uid = 1; */ public boolean hasTargetUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string target_uid = 1; */ public java.lang.String getTargetUid() { java.lang.Object ref = targetUid_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { targetUid_ = s; } return s; } } /** * required string target_uid = 1; */ public com.google.protobuf.ByteString getTargetUidBytes() { java.lang.Object ref = targetUid_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); targetUid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string reason = 2; public static final int REASON_FIELD_NUMBER = 2; private java.lang.Object reason_; /** * required string reason = 2; */ public boolean hasReason() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string reason = 2; */ public java.lang.String getReason() { java.lang.Object ref = reason_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { reason_ = s; } return s; } } /** * required string reason = 2; */ public com.google.protobuf.ByteString getReasonBytes() { java.lang.Object ref = reason_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); reason_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string extra = 3; public static final int EXTRA_FIELD_NUMBER = 3; private java.lang.Object extra_; /** * optional string extra = 3; */ public boolean hasExtra() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string extra = 3; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 3; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { targetUid_ = ""; reason_ = ""; extra_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTargetUid()) { memoizedIsInitialized = 0; return false; } if (!hasReason()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTargetUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getReasonBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getExtraBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTargetUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getReasonBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getExtraBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.AddFriendRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.AddFriendRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.AddFriendRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.AddFriendRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.AddFriendRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.AddFriendRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.AddFriendRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.AddFriendRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.AddFriendRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.AddFriendRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.AddFriendRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code AddFriendRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.AddFriendRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_AddFriendRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_AddFriendRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.AddFriendRequest.class, cn.wildfirechat.proto.WFCMessage.AddFriendRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.AddFriendRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); targetUid_ = ""; bitField0_ = (bitField0_ & ~0x00000001); reason_ = ""; bitField0_ = (bitField0_ & ~0x00000002); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_AddFriendRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.AddFriendRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.AddFriendRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.AddFriendRequest build() { cn.wildfirechat.proto.WFCMessage.AddFriendRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.AddFriendRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.AddFriendRequest result = new cn.wildfirechat.proto.WFCMessage.AddFriendRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.targetUid_ = targetUid_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.reason_ = reason_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.extra_ = extra_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.AddFriendRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.AddFriendRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.AddFriendRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.AddFriendRequest.getDefaultInstance()) return this; if (other.hasTargetUid()) { bitField0_ |= 0x00000001; targetUid_ = other.targetUid_; onChanged(); } if (other.hasReason()) { bitField0_ |= 0x00000002; reason_ = other.reason_; onChanged(); } if (other.hasExtra()) { bitField0_ |= 0x00000004; extra_ = other.extra_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTargetUid()) { return false; } if (!hasReason()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.AddFriendRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.AddFriendRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string target_uid = 1; private java.lang.Object targetUid_ = ""; /** * required string target_uid = 1; */ public boolean hasTargetUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string target_uid = 1; */ public java.lang.String getTargetUid() { java.lang.Object ref = targetUid_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); targetUid_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string target_uid = 1; */ public com.google.protobuf.ByteString getTargetUidBytes() { java.lang.Object ref = targetUid_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); targetUid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string target_uid = 1; */ public Builder setTargetUid( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; targetUid_ = value; onChanged(); return this; } /** * required string target_uid = 1; */ public Builder clearTargetUid() { bitField0_ = (bitField0_ & ~0x00000001); targetUid_ = getDefaultInstance().getTargetUid(); onChanged(); return this; } /** * required string target_uid = 1; */ public Builder setTargetUidBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; targetUid_ = value; onChanged(); return this; } // required string reason = 2; private java.lang.Object reason_ = ""; /** * required string reason = 2; */ public boolean hasReason() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string reason = 2; */ public java.lang.String getReason() { java.lang.Object ref = reason_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); reason_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string reason = 2; */ public com.google.protobuf.ByteString getReasonBytes() { java.lang.Object ref = reason_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); reason_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string reason = 2; */ public Builder setReason( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; reason_ = value; onChanged(); return this; } /** * required string reason = 2; */ public Builder clearReason() { bitField0_ = (bitField0_ & ~0x00000002); reason_ = getDefaultInstance().getReason(); onChanged(); return this; } /** * required string reason = 2; */ public Builder setReasonBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; reason_ = value; onChanged(); return this; } // optional string extra = 3; private java.lang.Object extra_ = ""; /** * optional string extra = 3; */ public boolean hasExtra() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string extra = 3; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 3; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 3; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; extra_ = value; onChanged(); return this; } /** * optional string extra = 3; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000004); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 3; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; extra_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:AddFriendRequest) } static { defaultInstance = new AddFriendRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:AddFriendRequest) } public interface ConversationOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int32 type = 1; /** * required int32 type = 1; */ boolean hasType(); /** * required int32 type = 1; */ int getType(); // required string target = 2; /** * required string target = 2; */ boolean hasTarget(); /** * required string target = 2; */ java.lang.String getTarget(); /** * required string target = 2; */ com.google.protobuf.ByteString getTargetBytes(); // required int32 line = 3; /** * required int32 line = 3; */ boolean hasLine(); /** * required int32 line = 3; */ int getLine(); } /** * Protobuf type {@code Conversation} */ public static final class Conversation extends com.google.protobuf.GeneratedMessage implements ConversationOrBuilder { // Use Conversation.newBuilder() to construct. private Conversation(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private Conversation(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final Conversation defaultInstance; public static Conversation getDefaultInstance() { return defaultInstance; } public Conversation getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Conversation( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; type_ = input.readInt32(); break; } case 18: { bitField0_ |= 0x00000002; target_ = input.readBytes(); break; } case 24: { bitField0_ |= 0x00000004; line_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_Conversation_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_Conversation_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.Conversation.class, cn.wildfirechat.proto.WFCMessage.Conversation.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public Conversation parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Conversation(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int32 type = 1; public static final int TYPE_FIELD_NUMBER = 1; private int type_; /** * required int32 type = 1; */ public boolean hasType() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 type = 1; */ public int getType() { return type_; } // required string target = 2; public static final int TARGET_FIELD_NUMBER = 2; private java.lang.Object target_; /** * required string target = 2; */ public boolean hasTarget() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string target = 2; */ public java.lang.String getTarget() { java.lang.Object ref = target_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { target_ = s; } return s; } } /** * required string target = 2; */ public com.google.protobuf.ByteString getTargetBytes() { java.lang.Object ref = target_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); target_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 line = 3; public static final int LINE_FIELD_NUMBER = 3; private int line_; /** * required int32 line = 3; */ public boolean hasLine() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int32 line = 3; */ public int getLine() { return line_; } private void initFields() { type_ = 0; target_ = ""; line_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasType()) { memoizedIsInitialized = 0; return false; } if (!hasTarget()) { memoizedIsInitialized = 0; return false; } if (!hasLine()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, type_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getTargetBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(3, line_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, type_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getTargetBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(3, line_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.Conversation parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.Conversation parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Conversation parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.Conversation parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Conversation parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Conversation parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Conversation parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Conversation parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Conversation parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Conversation parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.Conversation prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code Conversation} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_Conversation_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_Conversation_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.Conversation.class, cn.wildfirechat.proto.WFCMessage.Conversation.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.Conversation.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); type_ = 0; bitField0_ = (bitField0_ & ~0x00000001); target_ = ""; bitField0_ = (bitField0_ & ~0x00000002); line_ = 0; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_Conversation_descriptor; } public cn.wildfirechat.proto.WFCMessage.Conversation getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.Conversation.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.Conversation build() { cn.wildfirechat.proto.WFCMessage.Conversation result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.Conversation buildPartial() { cn.wildfirechat.proto.WFCMessage.Conversation result = new cn.wildfirechat.proto.WFCMessage.Conversation(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.type_ = type_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.target_ = target_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.line_ = line_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.Conversation) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.Conversation)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.Conversation other) { if (other == cn.wildfirechat.proto.WFCMessage.Conversation.getDefaultInstance()) return this; if (other.hasType()) { setType(other.getType()); } if (other.hasTarget()) { bitField0_ |= 0x00000002; target_ = other.target_; onChanged(); } if (other.hasLine()) { setLine(other.getLine()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasType()) { return false; } if (!hasTarget()) { return false; } if (!hasLine()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.Conversation parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.Conversation) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int32 type = 1; private int type_ ; /** * required int32 type = 1; */ public boolean hasType() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 type = 1; */ public int getType() { return type_; } /** * required int32 type = 1; */ public Builder setType(int value) { bitField0_ |= 0x00000001; type_ = value; onChanged(); return this; } /** * required int32 type = 1; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000001); type_ = 0; onChanged(); return this; } // required string target = 2; private java.lang.Object target_ = ""; /** * required string target = 2; */ public boolean hasTarget() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string target = 2; */ public java.lang.String getTarget() { java.lang.Object ref = target_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); target_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string target = 2; */ public com.google.protobuf.ByteString getTargetBytes() { java.lang.Object ref = target_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); target_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string target = 2; */ public Builder setTarget( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; target_ = value; onChanged(); return this; } /** * required string target = 2; */ public Builder clearTarget() { bitField0_ = (bitField0_ & ~0x00000002); target_ = getDefaultInstance().getTarget(); onChanged(); return this; } /** * required string target = 2; */ public Builder setTargetBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; target_ = value; onChanged(); return this; } // required int32 line = 3; private int line_ ; /** * required int32 line = 3; */ public boolean hasLine() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int32 line = 3; */ public int getLine() { return line_; } /** * required int32 line = 3; */ public Builder setLine(int value) { bitField0_ |= 0x00000004; line_ = value; onChanged(); return this; } /** * required int32 line = 3; */ public Builder clearLine() { bitField0_ = (bitField0_ & ~0x00000004); line_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:Conversation) } static { defaultInstance = new Conversation(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:Conversation) } public interface GroupInfoOrBuilder extends com.google.protobuf.MessageOrBuilder { // optional string target_id = 1; /** * optional string target_id = 1; */ boolean hasTargetId(); /** * optional string target_id = 1; */ java.lang.String getTargetId(); /** * optional string target_id = 1; */ com.google.protobuf.ByteString getTargetIdBytes(); // required string name = 2; /** * required string name = 2; */ boolean hasName(); /** * required string name = 2; */ java.lang.String getName(); /** * required string name = 2; */ com.google.protobuf.ByteString getNameBytes(); // optional string portrait = 3; /** * optional string portrait = 3; */ boolean hasPortrait(); /** * optional string portrait = 3; */ java.lang.String getPortrait(); /** * optional string portrait = 3; */ com.google.protobuf.ByteString getPortraitBytes(); // optional string owner = 4; /** * optional string owner = 4; */ boolean hasOwner(); /** * optional string owner = 4; */ java.lang.String getOwner(); /** * optional string owner = 4; */ com.google.protobuf.ByteString getOwnerBytes(); // required int32 type = 5; /** * required int32 type = 5; */ boolean hasType(); /** * required int32 type = 5; */ int getType(); // optional int32 member_count = 6; /** * optional int32 member_count = 6; */ boolean hasMemberCount(); /** * optional int32 member_count = 6; */ int getMemberCount(); // optional string extra = 7; /** * optional string extra = 7; */ boolean hasExtra(); /** * optional string extra = 7; */ java.lang.String getExtra(); /** * optional string extra = 7; */ com.google.protobuf.ByteString getExtraBytes(); // optional int64 update_dt = 8; /** * optional int64 update_dt = 8; */ boolean hasUpdateDt(); /** * optional int64 update_dt = 8; */ long getUpdateDt(); // optional int64 member_update_dt = 9; /** * optional int64 member_update_dt = 9; */ boolean hasMemberUpdateDt(); /** * optional int64 member_update_dt = 9; */ long getMemberUpdateDt(); // optional int32 mute = 10; /** * optional int32 mute = 10; */ boolean hasMute(); /** * optional int32 mute = 10; */ int getMute(); // optional int32 join_type = 11; /** * optional int32 join_type = 11; */ boolean hasJoinType(); /** * optional int32 join_type = 11; */ int getJoinType(); // optional int32 private_chat = 12; /** * optional int32 private_chat = 12; */ boolean hasPrivateChat(); /** * optional int32 private_chat = 12; */ int getPrivateChat(); // optional int32 searchable = 13; /** * optional int32 searchable = 13; */ boolean hasSearchable(); /** * optional int32 searchable = 13; */ int getSearchable(); // optional int32 max_member_count = 14; /** * optional int32 max_member_count = 14; */ boolean hasMaxMemberCount(); /** * optional int32 max_member_count = 14; */ int getMaxMemberCount(); // optional int32 history_message = 15; /** * optional int32 history_message = 15; */ boolean hasHistoryMessage(); /** * optional int32 history_message = 15; */ int getHistoryMessage(); // optional int32 super_group = 16; /** * optional int32 super_group = 16; */ boolean hasSuperGroup(); /** * optional int32 super_group = 16; */ int getSuperGroup(); // optional int32 deleted = 17; /** * optional int32 deleted = 17; */ boolean hasDeleted(); /** * optional int32 deleted = 17; */ int getDeleted(); } /** * Protobuf type {@code GroupInfo} */ public static final class GroupInfo extends com.google.protobuf.GeneratedMessage implements GroupInfoOrBuilder { // Use GroupInfo.newBuilder() to construct. private GroupInfo(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private GroupInfo(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final GroupInfo defaultInstance; public static GroupInfo getDefaultInstance() { return defaultInstance; } public GroupInfo getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GroupInfo( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; targetId_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; name_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; portrait_ = input.readBytes(); break; } case 34: { bitField0_ |= 0x00000008; owner_ = input.readBytes(); break; } case 40: { bitField0_ |= 0x00000010; type_ = input.readInt32(); break; } case 48: { bitField0_ |= 0x00000020; memberCount_ = input.readInt32(); break; } case 58: { bitField0_ |= 0x00000040; extra_ = input.readBytes(); break; } case 64: { bitField0_ |= 0x00000080; updateDt_ = input.readInt64(); break; } case 72: { bitField0_ |= 0x00000100; memberUpdateDt_ = input.readInt64(); break; } case 80: { bitField0_ |= 0x00000200; mute_ = input.readInt32(); break; } case 88: { bitField0_ |= 0x00000400; joinType_ = input.readInt32(); break; } case 96: { bitField0_ |= 0x00000800; privateChat_ = input.readInt32(); break; } case 104: { bitField0_ |= 0x00001000; searchable_ = input.readInt32(); break; } case 112: { bitField0_ |= 0x00002000; maxMemberCount_ = input.readInt32(); break; } case 120: { bitField0_ |= 0x00004000; historyMessage_ = input.readInt32(); break; } case 128: { bitField0_ |= 0x00008000; superGroup_ = input.readInt32(); break; } case 136: { bitField0_ |= 0x00010000; deleted_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GroupInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GroupInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GroupInfo.class, cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public GroupInfo parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GroupInfo(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // optional string target_id = 1; public static final int TARGET_ID_FIELD_NUMBER = 1; private java.lang.Object targetId_; /** * optional string target_id = 1; */ public boolean hasTargetId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * optional string target_id = 1; */ public java.lang.String getTargetId() { java.lang.Object ref = targetId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { targetId_ = s; } return s; } } /** * optional string target_id = 1; */ public com.google.protobuf.ByteString getTargetIdBytes() { java.lang.Object ref = targetId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); targetId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string name = 2; public static final int NAME_FIELD_NUMBER = 2; private java.lang.Object name_; /** * required string name = 2; */ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string name = 2; */ public java.lang.String getName() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } } /** * required string name = 2; */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string portrait = 3; public static final int PORTRAIT_FIELD_NUMBER = 3; private java.lang.Object portrait_; /** * optional string portrait = 3; */ public boolean hasPortrait() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string portrait = 3; */ public java.lang.String getPortrait() { java.lang.Object ref = portrait_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { portrait_ = s; } return s; } } /** * optional string portrait = 3; */ public com.google.protobuf.ByteString getPortraitBytes() { java.lang.Object ref = portrait_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); portrait_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string owner = 4; public static final int OWNER_FIELD_NUMBER = 4; private java.lang.Object owner_; /** * optional string owner = 4; */ public boolean hasOwner() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string owner = 4; */ public java.lang.String getOwner() { java.lang.Object ref = owner_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { owner_ = s; } return s; } } /** * optional string owner = 4; */ public com.google.protobuf.ByteString getOwnerBytes() { java.lang.Object ref = owner_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); owner_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 type = 5; public static final int TYPE_FIELD_NUMBER = 5; private int type_; /** * required int32 type = 5; */ public boolean hasType() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * required int32 type = 5; */ public int getType() { return type_; } // optional int32 member_count = 6; public static final int MEMBER_COUNT_FIELD_NUMBER = 6; private int memberCount_; /** * optional int32 member_count = 6; */ public boolean hasMemberCount() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional int32 member_count = 6; */ public int getMemberCount() { return memberCount_; } // optional string extra = 7; public static final int EXTRA_FIELD_NUMBER = 7; private java.lang.Object extra_; /** * optional string extra = 7; */ public boolean hasExtra() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string extra = 7; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 7; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int64 update_dt = 8; public static final int UPDATE_DT_FIELD_NUMBER = 8; private long updateDt_; /** * optional int64 update_dt = 8; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional int64 update_dt = 8; */ public long getUpdateDt() { return updateDt_; } // optional int64 member_update_dt = 9; public static final int MEMBER_UPDATE_DT_FIELD_NUMBER = 9; private long memberUpdateDt_; /** * optional int64 member_update_dt = 9; */ public boolean hasMemberUpdateDt() { return ((bitField0_ & 0x00000100) == 0x00000100); } /** * optional int64 member_update_dt = 9; */ public long getMemberUpdateDt() { return memberUpdateDt_; } // optional int32 mute = 10; public static final int MUTE_FIELD_NUMBER = 10; private int mute_; /** * optional int32 mute = 10; */ public boolean hasMute() { return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional int32 mute = 10; */ public int getMute() { return mute_; } // optional int32 join_type = 11; public static final int JOIN_TYPE_FIELD_NUMBER = 11; private int joinType_; /** * optional int32 join_type = 11; */ public boolean hasJoinType() { return ((bitField0_ & 0x00000400) == 0x00000400); } /** * optional int32 join_type = 11; */ public int getJoinType() { return joinType_; } // optional int32 private_chat = 12; public static final int PRIVATE_CHAT_FIELD_NUMBER = 12; private int privateChat_; /** * optional int32 private_chat = 12; */ public boolean hasPrivateChat() { return ((bitField0_ & 0x00000800) == 0x00000800); } /** * optional int32 private_chat = 12; */ public int getPrivateChat() { return privateChat_; } // optional int32 searchable = 13; public static final int SEARCHABLE_FIELD_NUMBER = 13; private int searchable_; /** * optional int32 searchable = 13; */ public boolean hasSearchable() { return ((bitField0_ & 0x00001000) == 0x00001000); } /** * optional int32 searchable = 13; */ public int getSearchable() { return searchable_; } // optional int32 max_member_count = 14; public static final int MAX_MEMBER_COUNT_FIELD_NUMBER = 14; private int maxMemberCount_; /** * optional int32 max_member_count = 14; */ public boolean hasMaxMemberCount() { return ((bitField0_ & 0x00002000) == 0x00002000); } /** * optional int32 max_member_count = 14; */ public int getMaxMemberCount() { return maxMemberCount_; } // optional int32 history_message = 15; public static final int HISTORY_MESSAGE_FIELD_NUMBER = 15; private int historyMessage_; /** * optional int32 history_message = 15; */ public boolean hasHistoryMessage() { return ((bitField0_ & 0x00004000) == 0x00004000); } /** * optional int32 history_message = 15; */ public int getHistoryMessage() { return historyMessage_; } // optional int32 super_group = 16; public static final int SUPER_GROUP_FIELD_NUMBER = 16; private int superGroup_; /** * optional int32 super_group = 16; */ public boolean hasSuperGroup() { return ((bitField0_ & 0x00008000) == 0x00008000); } /** * optional int32 super_group = 16; */ public int getSuperGroup() { return superGroup_; } // optional int32 deleted = 17; public static final int DELETED_FIELD_NUMBER = 17; private int deleted_; /** * optional int32 deleted = 17; */ public boolean hasDeleted() { return ((bitField0_ & 0x00010000) == 0x00010000); } /** * optional int32 deleted = 17; */ public int getDeleted() { return deleted_; } private void initFields() { targetId_ = ""; name_ = ""; portrait_ = ""; owner_ = ""; type_ = 0; memberCount_ = 0; extra_ = ""; updateDt_ = 0L; memberUpdateDt_ = 0L; mute_ = 0; joinType_ = 0; privateChat_ = 0; searchable_ = 0; maxMemberCount_ = 0; historyMessage_ = 0; superGroup_ = 0; deleted_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasName()) { memoizedIsInitialized = 0; return false; } if (!hasType()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTargetIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getPortraitBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getOwnerBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeInt32(5, type_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeInt32(6, memberCount_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, getExtraBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeInt64(8, updateDt_); } if (((bitField0_ & 0x00000100) == 0x00000100)) { output.writeInt64(9, memberUpdateDt_); } if (((bitField0_ & 0x00000200) == 0x00000200)) { output.writeInt32(10, mute_); } if (((bitField0_ & 0x00000400) == 0x00000400)) { output.writeInt32(11, joinType_); } if (((bitField0_ & 0x00000800) == 0x00000800)) { output.writeInt32(12, privateChat_); } if (((bitField0_ & 0x00001000) == 0x00001000)) { output.writeInt32(13, searchable_); } if (((bitField0_ & 0x00002000) == 0x00002000)) { output.writeInt32(14, maxMemberCount_); } if (((bitField0_ & 0x00004000) == 0x00004000)) { output.writeInt32(15, historyMessage_); } if (((bitField0_ & 0x00008000) == 0x00008000)) { output.writeInt32(16, superGroup_); } if (((bitField0_ & 0x00010000) == 0x00010000)) { output.writeInt32(17, deleted_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTargetIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getPortraitBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getOwnerBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(5, type_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(6, memberCount_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(7, getExtraBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(8, updateDt_); } if (((bitField0_ & 0x00000100) == 0x00000100)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(9, memberUpdateDt_); } if (((bitField0_ & 0x00000200) == 0x00000200)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(10, mute_); } if (((bitField0_ & 0x00000400) == 0x00000400)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(11, joinType_); } if (((bitField0_ & 0x00000800) == 0x00000800)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(12, privateChat_); } if (((bitField0_ & 0x00001000) == 0x00001000)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(13, searchable_); } if (((bitField0_ & 0x00002000) == 0x00002000)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(14, maxMemberCount_); } if (((bitField0_ & 0x00004000) == 0x00004000)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(15, historyMessage_); } if (((bitField0_ & 0x00008000) == 0x00008000)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(16, superGroup_); } if (((bitField0_ & 0x00010000) == 0x00010000)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(17, deleted_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.GroupInfo parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GroupInfo parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GroupInfo parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GroupInfo parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GroupInfo parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GroupInfo parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GroupInfo parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GroupInfo parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GroupInfo parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GroupInfo parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.GroupInfo prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code GroupInfo} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GroupInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GroupInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GroupInfo.class, cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.GroupInfo.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); targetId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); name_ = ""; bitField0_ = (bitField0_ & ~0x00000002); portrait_ = ""; bitField0_ = (bitField0_ & ~0x00000004); owner_ = ""; bitField0_ = (bitField0_ & ~0x00000008); type_ = 0; bitField0_ = (bitField0_ & ~0x00000010); memberCount_ = 0; bitField0_ = (bitField0_ & ~0x00000020); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000040); updateDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000080); memberUpdateDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000100); mute_ = 0; bitField0_ = (bitField0_ & ~0x00000200); joinType_ = 0; bitField0_ = (bitField0_ & ~0x00000400); privateChat_ = 0; bitField0_ = (bitField0_ & ~0x00000800); searchable_ = 0; bitField0_ = (bitField0_ & ~0x00001000); maxMemberCount_ = 0; bitField0_ = (bitField0_ & ~0x00002000); historyMessage_ = 0; bitField0_ = (bitField0_ & ~0x00004000); superGroup_ = 0; bitField0_ = (bitField0_ & ~0x00008000); deleted_ = 0; bitField0_ = (bitField0_ & ~0x00010000); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_GroupInfo_descriptor; } public cn.wildfirechat.proto.WFCMessage.GroupInfo getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.GroupInfo.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.GroupInfo build() { cn.wildfirechat.proto.WFCMessage.GroupInfo result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.GroupInfo buildPartial() { cn.wildfirechat.proto.WFCMessage.GroupInfo result = new cn.wildfirechat.proto.WFCMessage.GroupInfo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.targetId_ = targetId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.name_ = name_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.portrait_ = portrait_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.owner_ = owner_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.type_ = type_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.memberCount_ = memberCount_; if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000040; } result.extra_ = extra_; if (((from_bitField0_ & 0x00000080) == 0x00000080)) { to_bitField0_ |= 0x00000080; } result.updateDt_ = updateDt_; if (((from_bitField0_ & 0x00000100) == 0x00000100)) { to_bitField0_ |= 0x00000100; } result.memberUpdateDt_ = memberUpdateDt_; if (((from_bitField0_ & 0x00000200) == 0x00000200)) { to_bitField0_ |= 0x00000200; } result.mute_ = mute_; if (((from_bitField0_ & 0x00000400) == 0x00000400)) { to_bitField0_ |= 0x00000400; } result.joinType_ = joinType_; if (((from_bitField0_ & 0x00000800) == 0x00000800)) { to_bitField0_ |= 0x00000800; } result.privateChat_ = privateChat_; if (((from_bitField0_ & 0x00001000) == 0x00001000)) { to_bitField0_ |= 0x00001000; } result.searchable_ = searchable_; if (((from_bitField0_ & 0x00002000) == 0x00002000)) { to_bitField0_ |= 0x00002000; } result.maxMemberCount_ = maxMemberCount_; if (((from_bitField0_ & 0x00004000) == 0x00004000)) { to_bitField0_ |= 0x00004000; } result.historyMessage_ = historyMessage_; if (((from_bitField0_ & 0x00008000) == 0x00008000)) { to_bitField0_ |= 0x00008000; } result.superGroup_ = superGroup_; if (((from_bitField0_ & 0x00010000) == 0x00010000)) { to_bitField0_ |= 0x00010000; } result.deleted_ = deleted_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.GroupInfo) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.GroupInfo)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.GroupInfo other) { if (other == cn.wildfirechat.proto.WFCMessage.GroupInfo.getDefaultInstance()) return this; if (other.hasTargetId()) { bitField0_ |= 0x00000001; targetId_ = other.targetId_; onChanged(); } if (other.hasName()) { bitField0_ |= 0x00000002; name_ = other.name_; onChanged(); } if (other.hasPortrait()) { bitField0_ |= 0x00000004; portrait_ = other.portrait_; onChanged(); } if (other.hasOwner()) { bitField0_ |= 0x00000008; owner_ = other.owner_; onChanged(); } if (other.hasType()) { setType(other.getType()); } if (other.hasMemberCount()) { setMemberCount(other.getMemberCount()); } if (other.hasExtra()) { bitField0_ |= 0x00000040; extra_ = other.extra_; onChanged(); } if (other.hasUpdateDt()) { setUpdateDt(other.getUpdateDt()); } if (other.hasMemberUpdateDt()) { setMemberUpdateDt(other.getMemberUpdateDt()); } if (other.hasMute()) { setMute(other.getMute()); } if (other.hasJoinType()) { setJoinType(other.getJoinType()); } if (other.hasPrivateChat()) { setPrivateChat(other.getPrivateChat()); } if (other.hasSearchable()) { setSearchable(other.getSearchable()); } if (other.hasMaxMemberCount()) { setMaxMemberCount(other.getMaxMemberCount()); } if (other.hasHistoryMessage()) { setHistoryMessage(other.getHistoryMessage()); } if (other.hasSuperGroup()) { setSuperGroup(other.getSuperGroup()); } if (other.hasDeleted()) { setDeleted(other.getDeleted()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasName()) { return false; } if (!hasType()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.GroupInfo parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.GroupInfo) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // optional string target_id = 1; private java.lang.Object targetId_ = ""; /** * optional string target_id = 1; */ public boolean hasTargetId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * optional string target_id = 1; */ public java.lang.String getTargetId() { java.lang.Object ref = targetId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); targetId_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string target_id = 1; */ public com.google.protobuf.ByteString getTargetIdBytes() { java.lang.Object ref = targetId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); targetId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string target_id = 1; */ public Builder setTargetId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; targetId_ = value; onChanged(); return this; } /** * optional string target_id = 1; */ public Builder clearTargetId() { bitField0_ = (bitField0_ & ~0x00000001); targetId_ = getDefaultInstance().getTargetId(); onChanged(); return this; } /** * optional string target_id = 1; */ public Builder setTargetIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; targetId_ = value; onChanged(); return this; } // required string name = 2; private java.lang.Object name_ = ""; /** * required string name = 2; */ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string name = 2; */ public java.lang.String getName() { java.lang.Object ref = name_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); name_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string name = 2; */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string name = 2; */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; name_ = value; onChanged(); return this; } /** * required string name = 2; */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000002); name_ = getDefaultInstance().getName(); onChanged(); return this; } /** * required string name = 2; */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; name_ = value; onChanged(); return this; } // optional string portrait = 3; private java.lang.Object portrait_ = ""; /** * optional string portrait = 3; */ public boolean hasPortrait() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string portrait = 3; */ public java.lang.String getPortrait() { java.lang.Object ref = portrait_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); portrait_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string portrait = 3; */ public com.google.protobuf.ByteString getPortraitBytes() { java.lang.Object ref = portrait_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); portrait_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string portrait = 3; */ public Builder setPortrait( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; portrait_ = value; onChanged(); return this; } /** * optional string portrait = 3; */ public Builder clearPortrait() { bitField0_ = (bitField0_ & ~0x00000004); portrait_ = getDefaultInstance().getPortrait(); onChanged(); return this; } /** * optional string portrait = 3; */ public Builder setPortraitBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; portrait_ = value; onChanged(); return this; } // optional string owner = 4; private java.lang.Object owner_ = ""; /** * optional string owner = 4; */ public boolean hasOwner() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string owner = 4; */ public java.lang.String getOwner() { java.lang.Object ref = owner_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); owner_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string owner = 4; */ public com.google.protobuf.ByteString getOwnerBytes() { java.lang.Object ref = owner_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); owner_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string owner = 4; */ public Builder setOwner( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; owner_ = value; onChanged(); return this; } /** * optional string owner = 4; */ public Builder clearOwner() { bitField0_ = (bitField0_ & ~0x00000008); owner_ = getDefaultInstance().getOwner(); onChanged(); return this; } /** * optional string owner = 4; */ public Builder setOwnerBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; owner_ = value; onChanged(); return this; } // required int32 type = 5; private int type_ ; /** * required int32 type = 5; */ public boolean hasType() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * required int32 type = 5; */ public int getType() { return type_; } /** * required int32 type = 5; */ public Builder setType(int value) { bitField0_ |= 0x00000010; type_ = value; onChanged(); return this; } /** * required int32 type = 5; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000010); type_ = 0; onChanged(); return this; } // optional int32 member_count = 6; private int memberCount_ ; /** * optional int32 member_count = 6; */ public boolean hasMemberCount() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional int32 member_count = 6; */ public int getMemberCount() { return memberCount_; } /** * optional int32 member_count = 6; */ public Builder setMemberCount(int value) { bitField0_ |= 0x00000020; memberCount_ = value; onChanged(); return this; } /** * optional int32 member_count = 6; */ public Builder clearMemberCount() { bitField0_ = (bitField0_ & ~0x00000020); memberCount_ = 0; onChanged(); return this; } // optional string extra = 7; private java.lang.Object extra_ = ""; /** * optional string extra = 7; */ public boolean hasExtra() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string extra = 7; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 7; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 7; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; extra_ = value; onChanged(); return this; } /** * optional string extra = 7; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000040); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 7; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; extra_ = value; onChanged(); return this; } // optional int64 update_dt = 8; private long updateDt_ ; /** * optional int64 update_dt = 8; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional int64 update_dt = 8; */ public long getUpdateDt() { return updateDt_; } /** * optional int64 update_dt = 8; */ public Builder setUpdateDt(long value) { bitField0_ |= 0x00000080; updateDt_ = value; onChanged(); return this; } /** * optional int64 update_dt = 8; */ public Builder clearUpdateDt() { bitField0_ = (bitField0_ & ~0x00000080); updateDt_ = 0L; onChanged(); return this; } // optional int64 member_update_dt = 9; private long memberUpdateDt_ ; /** * optional int64 member_update_dt = 9; */ public boolean hasMemberUpdateDt() { return ((bitField0_ & 0x00000100) == 0x00000100); } /** * optional int64 member_update_dt = 9; */ public long getMemberUpdateDt() { return memberUpdateDt_; } /** * optional int64 member_update_dt = 9; */ public Builder setMemberUpdateDt(long value) { bitField0_ |= 0x00000100; memberUpdateDt_ = value; onChanged(); return this; } /** * optional int64 member_update_dt = 9; */ public Builder clearMemberUpdateDt() { bitField0_ = (bitField0_ & ~0x00000100); memberUpdateDt_ = 0L; onChanged(); return this; } // optional int32 mute = 10; private int mute_ ; /** * optional int32 mute = 10; */ public boolean hasMute() { return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional int32 mute = 10; */ public int getMute() { return mute_; } /** * optional int32 mute = 10; */ public Builder setMute(int value) { bitField0_ |= 0x00000200; mute_ = value; onChanged(); return this; } /** * optional int32 mute = 10; */ public Builder clearMute() { bitField0_ = (bitField0_ & ~0x00000200); mute_ = 0; onChanged(); return this; } // optional int32 join_type = 11; private int joinType_ ; /** * optional int32 join_type = 11; */ public boolean hasJoinType() { return ((bitField0_ & 0x00000400) == 0x00000400); } /** * optional int32 join_type = 11; */ public int getJoinType() { return joinType_; } /** * optional int32 join_type = 11; */ public Builder setJoinType(int value) { bitField0_ |= 0x00000400; joinType_ = value; onChanged(); return this; } /** * optional int32 join_type = 11; */ public Builder clearJoinType() { bitField0_ = (bitField0_ & ~0x00000400); joinType_ = 0; onChanged(); return this; } // optional int32 private_chat = 12; private int privateChat_ ; /** * optional int32 private_chat = 12; */ public boolean hasPrivateChat() { return ((bitField0_ & 0x00000800) == 0x00000800); } /** * optional int32 private_chat = 12; */ public int getPrivateChat() { return privateChat_; } /** * optional int32 private_chat = 12; */ public Builder setPrivateChat(int value) { bitField0_ |= 0x00000800; privateChat_ = value; onChanged(); return this; } /** * optional int32 private_chat = 12; */ public Builder clearPrivateChat() { bitField0_ = (bitField0_ & ~0x00000800); privateChat_ = 0; onChanged(); return this; } // optional int32 searchable = 13; private int searchable_ ; /** * optional int32 searchable = 13; */ public boolean hasSearchable() { return ((bitField0_ & 0x00001000) == 0x00001000); } /** * optional int32 searchable = 13; */ public int getSearchable() { return searchable_; } /** * optional int32 searchable = 13; */ public Builder setSearchable(int value) { bitField0_ |= 0x00001000; searchable_ = value; onChanged(); return this; } /** * optional int32 searchable = 13; */ public Builder clearSearchable() { bitField0_ = (bitField0_ & ~0x00001000); searchable_ = 0; onChanged(); return this; } // optional int32 max_member_count = 14; private int maxMemberCount_ ; /** * optional int32 max_member_count = 14; */ public boolean hasMaxMemberCount() { return ((bitField0_ & 0x00002000) == 0x00002000); } /** * optional int32 max_member_count = 14; */ public int getMaxMemberCount() { return maxMemberCount_; } /** * optional int32 max_member_count = 14; */ public Builder setMaxMemberCount(int value) { bitField0_ |= 0x00002000; maxMemberCount_ = value; onChanged(); return this; } /** * optional int32 max_member_count = 14; */ public Builder clearMaxMemberCount() { bitField0_ = (bitField0_ & ~0x00002000); maxMemberCount_ = 0; onChanged(); return this; } // optional int32 history_message = 15; private int historyMessage_ ; /** * optional int32 history_message = 15; */ public boolean hasHistoryMessage() { return ((bitField0_ & 0x00004000) == 0x00004000); } /** * optional int32 history_message = 15; */ public int getHistoryMessage() { return historyMessage_; } /** * optional int32 history_message = 15; */ public Builder setHistoryMessage(int value) { bitField0_ |= 0x00004000; historyMessage_ = value; onChanged(); return this; } /** * optional int32 history_message = 15; */ public Builder clearHistoryMessage() { bitField0_ = (bitField0_ & ~0x00004000); historyMessage_ = 0; onChanged(); return this; } // optional int32 super_group = 16; private int superGroup_ ; /** * optional int32 super_group = 16; */ public boolean hasSuperGroup() { return ((bitField0_ & 0x00008000) == 0x00008000); } /** * optional int32 super_group = 16; */ public int getSuperGroup() { return superGroup_; } /** * optional int32 super_group = 16; */ public Builder setSuperGroup(int value) { bitField0_ |= 0x00008000; superGroup_ = value; onChanged(); return this; } /** * optional int32 super_group = 16; */ public Builder clearSuperGroup() { bitField0_ = (bitField0_ & ~0x00008000); superGroup_ = 0; onChanged(); return this; } // optional int32 deleted = 17; private int deleted_ ; /** * optional int32 deleted = 17; */ public boolean hasDeleted() { return ((bitField0_ & 0x00010000) == 0x00010000); } /** * optional int32 deleted = 17; */ public int getDeleted() { return deleted_; } /** * optional int32 deleted = 17; */ public Builder setDeleted(int value) { bitField0_ |= 0x00010000; deleted_ = value; onChanged(); return this; } /** * optional int32 deleted = 17; */ public Builder clearDeleted() { bitField0_ = (bitField0_ & ~0x00010000); deleted_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:GroupInfo) } static { defaultInstance = new GroupInfo(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:GroupInfo) } public interface GroupMemberOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string member_id = 1; /** * required string member_id = 1; */ boolean hasMemberId(); /** * required string member_id = 1; */ java.lang.String getMemberId(); /** * required string member_id = 1; */ com.google.protobuf.ByteString getMemberIdBytes(); // optional string alias = 2; /** * optional string alias = 2; */ boolean hasAlias(); /** * optional string alias = 2; */ java.lang.String getAlias(); /** * optional string alias = 2; */ com.google.protobuf.ByteString getAliasBytes(); // required int32 type = 3; /** * required int32 type = 3; */ boolean hasType(); /** * required int32 type = 3; */ int getType(); // optional int64 update_dt = 4; /** * optional int64 update_dt = 4; */ boolean hasUpdateDt(); /** * optional int64 update_dt = 4; */ long getUpdateDt(); // optional int64 create_dt = 5; /** * optional int64 create_dt = 5; */ boolean hasCreateDt(); /** * optional int64 create_dt = 5; */ long getCreateDt(); // optional string extra = 6; /** * optional string extra = 6; */ boolean hasExtra(); /** * optional string extra = 6; */ java.lang.String getExtra(); /** * optional string extra = 6; */ com.google.protobuf.ByteString getExtraBytes(); } /** * Protobuf type {@code GroupMember} */ public static final class GroupMember extends com.google.protobuf.GeneratedMessage implements GroupMemberOrBuilder { // Use GroupMember.newBuilder() to construct. private GroupMember(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private GroupMember(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final GroupMember defaultInstance; public static GroupMember getDefaultInstance() { return defaultInstance; } public GroupMember getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GroupMember( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; memberId_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; alias_ = input.readBytes(); break; } case 24: { bitField0_ |= 0x00000004; type_ = input.readInt32(); break; } case 32: { bitField0_ |= 0x00000008; updateDt_ = input.readInt64(); break; } case 40: { bitField0_ |= 0x00000010; createDt_ = input.readInt64(); break; } case 50: { bitField0_ |= 0x00000020; extra_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GroupMember_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GroupMember_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GroupMember.class, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public GroupMember parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GroupMember(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string member_id = 1; public static final int MEMBER_ID_FIELD_NUMBER = 1; private java.lang.Object memberId_; /** * required string member_id = 1; */ public boolean hasMemberId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string member_id = 1; */ public java.lang.String getMemberId() { java.lang.Object ref = memberId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { memberId_ = s; } return s; } } /** * required string member_id = 1; */ public com.google.protobuf.ByteString getMemberIdBytes() { java.lang.Object ref = memberId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); memberId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string alias = 2; public static final int ALIAS_FIELD_NUMBER = 2; private java.lang.Object alias_; /** * optional string alias = 2; */ public boolean hasAlias() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional string alias = 2; */ public java.lang.String getAlias() { java.lang.Object ref = alias_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { alias_ = s; } return s; } } /** * optional string alias = 2; */ public com.google.protobuf.ByteString getAliasBytes() { java.lang.Object ref = alias_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); alias_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 type = 3; public static final int TYPE_FIELD_NUMBER = 3; private int type_; /** * required int32 type = 3; */ public boolean hasType() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int32 type = 3; */ public int getType() { return type_; } // optional int64 update_dt = 4; public static final int UPDATE_DT_FIELD_NUMBER = 4; private long updateDt_; /** * optional int64 update_dt = 4; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int64 update_dt = 4; */ public long getUpdateDt() { return updateDt_; } // optional int64 create_dt = 5; public static final int CREATE_DT_FIELD_NUMBER = 5; private long createDt_; /** * optional int64 create_dt = 5; */ public boolean hasCreateDt() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int64 create_dt = 5; */ public long getCreateDt() { return createDt_; } // optional string extra = 6; public static final int EXTRA_FIELD_NUMBER = 6; private java.lang.Object extra_; /** * optional string extra = 6; */ public boolean hasExtra() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string extra = 6; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 6; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { memberId_ = ""; alias_ = ""; type_ = 0; updateDt_ = 0L; createDt_ = 0L; extra_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasMemberId()) { memoizedIsInitialized = 0; return false; } if (!hasType()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getMemberIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getAliasBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(3, type_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeInt64(4, updateDt_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeInt64(5, createDt_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, getExtraBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getMemberIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getAliasBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(3, type_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(4, updateDt_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(5, createDt_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(6, getExtraBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.GroupMember parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GroupMember parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GroupMember parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GroupMember parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GroupMember parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GroupMember parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GroupMember parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GroupMember parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GroupMember parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GroupMember parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.GroupMember prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code GroupMember} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GroupMember_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GroupMember_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GroupMember.class, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.GroupMember.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); memberId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); alias_ = ""; bitField0_ = (bitField0_ & ~0x00000002); type_ = 0; bitField0_ = (bitField0_ & ~0x00000004); updateDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000008); createDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000010); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000020); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_GroupMember_descriptor; } public cn.wildfirechat.proto.WFCMessage.GroupMember getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.GroupMember.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.GroupMember build() { cn.wildfirechat.proto.WFCMessage.GroupMember result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.GroupMember buildPartial() { cn.wildfirechat.proto.WFCMessage.GroupMember result = new cn.wildfirechat.proto.WFCMessage.GroupMember(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.memberId_ = memberId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.alias_ = alias_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.type_ = type_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.updateDt_ = updateDt_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.createDt_ = createDt_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.extra_ = extra_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.GroupMember) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.GroupMember)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.GroupMember other) { if (other == cn.wildfirechat.proto.WFCMessage.GroupMember.getDefaultInstance()) return this; if (other.hasMemberId()) { bitField0_ |= 0x00000001; memberId_ = other.memberId_; onChanged(); } if (other.hasAlias()) { bitField0_ |= 0x00000002; alias_ = other.alias_; onChanged(); } if (other.hasType()) { setType(other.getType()); } if (other.hasUpdateDt()) { setUpdateDt(other.getUpdateDt()); } if (other.hasCreateDt()) { setCreateDt(other.getCreateDt()); } if (other.hasExtra()) { bitField0_ |= 0x00000020; extra_ = other.extra_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasMemberId()) { return false; } if (!hasType()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.GroupMember parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.GroupMember) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string member_id = 1; private java.lang.Object memberId_ = ""; /** * required string member_id = 1; */ public boolean hasMemberId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string member_id = 1; */ public java.lang.String getMemberId() { java.lang.Object ref = memberId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); memberId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string member_id = 1; */ public com.google.protobuf.ByteString getMemberIdBytes() { java.lang.Object ref = memberId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); memberId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string member_id = 1; */ public Builder setMemberId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; memberId_ = value; onChanged(); return this; } /** * required string member_id = 1; */ public Builder clearMemberId() { bitField0_ = (bitField0_ & ~0x00000001); memberId_ = getDefaultInstance().getMemberId(); onChanged(); return this; } /** * required string member_id = 1; */ public Builder setMemberIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; memberId_ = value; onChanged(); return this; } // optional string alias = 2; private java.lang.Object alias_ = ""; /** * optional string alias = 2; */ public boolean hasAlias() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional string alias = 2; */ public java.lang.String getAlias() { java.lang.Object ref = alias_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); alias_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string alias = 2; */ public com.google.protobuf.ByteString getAliasBytes() { java.lang.Object ref = alias_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); alias_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string alias = 2; */ public Builder setAlias( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; alias_ = value; onChanged(); return this; } /** * optional string alias = 2; */ public Builder clearAlias() { bitField0_ = (bitField0_ & ~0x00000002); alias_ = getDefaultInstance().getAlias(); onChanged(); return this; } /** * optional string alias = 2; */ public Builder setAliasBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; alias_ = value; onChanged(); return this; } // required int32 type = 3; private int type_ ; /** * required int32 type = 3; */ public boolean hasType() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int32 type = 3; */ public int getType() { return type_; } /** * required int32 type = 3; */ public Builder setType(int value) { bitField0_ |= 0x00000004; type_ = value; onChanged(); return this; } /** * required int32 type = 3; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000004); type_ = 0; onChanged(); return this; } // optional int64 update_dt = 4; private long updateDt_ ; /** * optional int64 update_dt = 4; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int64 update_dt = 4; */ public long getUpdateDt() { return updateDt_; } /** * optional int64 update_dt = 4; */ public Builder setUpdateDt(long value) { bitField0_ |= 0x00000008; updateDt_ = value; onChanged(); return this; } /** * optional int64 update_dt = 4; */ public Builder clearUpdateDt() { bitField0_ = (bitField0_ & ~0x00000008); updateDt_ = 0L; onChanged(); return this; } // optional int64 create_dt = 5; private long createDt_ ; /** * optional int64 create_dt = 5; */ public boolean hasCreateDt() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int64 create_dt = 5; */ public long getCreateDt() { return createDt_; } /** * optional int64 create_dt = 5; */ public Builder setCreateDt(long value) { bitField0_ |= 0x00000010; createDt_ = value; onChanged(); return this; } /** * optional int64 create_dt = 5; */ public Builder clearCreateDt() { bitField0_ = (bitField0_ & ~0x00000010); createDt_ = 0L; onChanged(); return this; } // optional string extra = 6; private java.lang.Object extra_ = ""; /** * optional string extra = 6; */ public boolean hasExtra() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string extra = 6; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 6; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 6; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; extra_ = value; onChanged(); return this; } /** * optional string extra = 6; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000020); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 6; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; extra_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:GroupMember) } static { defaultInstance = new GroupMember(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:GroupMember) } public interface GroupOrBuilder extends com.google.protobuf.MessageOrBuilder { // required .GroupInfo group_info = 1; /** * required .GroupInfo group_info = 1; */ boolean hasGroupInfo(); /** * required .GroupInfo group_info = 1; */ cn.wildfirechat.proto.WFCMessage.GroupInfo getGroupInfo(); /** * required .GroupInfo group_info = 1; */ cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder getGroupInfoOrBuilder(); // repeated .GroupMember members = 2; /** * repeated .GroupMember members = 2; */ java.util.List getMembersList(); /** * repeated .GroupMember members = 2; */ cn.wildfirechat.proto.WFCMessage.GroupMember getMembers(int index); /** * repeated .GroupMember members = 2; */ int getMembersCount(); /** * repeated .GroupMember members = 2; */ java.util.List getMembersOrBuilderList(); /** * repeated .GroupMember members = 2; */ cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder getMembersOrBuilder( int index); } /** * Protobuf type {@code Group} */ public static final class Group extends com.google.protobuf.GeneratedMessage implements GroupOrBuilder { // Use Group.newBuilder() to construct. private Group(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private Group(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final Group defaultInstance; public static Group getDefaultInstance() { return defaultInstance; } public Group getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Group( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder subBuilder = null; if (((bitField0_ & 0x00000001) == 0x00000001)) { subBuilder = groupInfo_.toBuilder(); } groupInfo_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.GroupInfo.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(groupInfo_); groupInfo_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000001; break; } case 18: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { members_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; } members_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.GroupMember.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { members_ = java.util.Collections.unmodifiableList(members_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_Group_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_Group_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.Group.class, cn.wildfirechat.proto.WFCMessage.Group.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public Group parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Group(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required .GroupInfo group_info = 1; public static final int GROUP_INFO_FIELD_NUMBER = 1; private cn.wildfirechat.proto.WFCMessage.GroupInfo groupInfo_; /** * required .GroupInfo group_info = 1; */ public boolean hasGroupInfo() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required .GroupInfo group_info = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupInfo getGroupInfo() { return groupInfo_; } /** * required .GroupInfo group_info = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder getGroupInfoOrBuilder() { return groupInfo_; } // repeated .GroupMember members = 2; public static final int MEMBERS_FIELD_NUMBER = 2; private java.util.List members_; /** * repeated .GroupMember members = 2; */ public java.util.List getMembersList() { return members_; } /** * repeated .GroupMember members = 2; */ public java.util.List getMembersOrBuilderList() { return members_; } /** * repeated .GroupMember members = 2; */ public int getMembersCount() { return members_.size(); } /** * repeated .GroupMember members = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMember getMembers(int index) { return members_.get(index); } /** * repeated .GroupMember members = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder getMembersOrBuilder( int index) { return members_.get(index); } private void initFields() { groupInfo_ = cn.wildfirechat.proto.WFCMessage.GroupInfo.getDefaultInstance(); members_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasGroupInfo()) { memoizedIsInitialized = 0; return false; } if (!getGroupInfo().isInitialized()) { memoizedIsInitialized = 0; return false; } for (int i = 0; i < getMembersCount(); i++) { if (!getMembers(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeMessage(1, groupInfo_); } for (int i = 0; i < members_.size(); i++) { output.writeMessage(2, members_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, groupInfo_); } for (int i = 0; i < members_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, members_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.Group parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.Group parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Group parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.Group parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Group parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Group parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Group parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Group parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Group parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Group parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.Group prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code Group} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GroupOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_Group_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_Group_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.Group.class, cn.wildfirechat.proto.WFCMessage.Group.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.Group.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getGroupInfoFieldBuilder(); getMembersFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (groupInfoBuilder_ == null) { groupInfo_ = cn.wildfirechat.proto.WFCMessage.GroupInfo.getDefaultInstance(); } else { groupInfoBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); if (membersBuilder_ == null) { members_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); } else { membersBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_Group_descriptor; } public cn.wildfirechat.proto.WFCMessage.Group getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.Group.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.Group build() { cn.wildfirechat.proto.WFCMessage.Group result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.Group buildPartial() { cn.wildfirechat.proto.WFCMessage.Group result = new cn.wildfirechat.proto.WFCMessage.Group(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } if (groupInfoBuilder_ == null) { result.groupInfo_ = groupInfo_; } else { result.groupInfo_ = groupInfoBuilder_.build(); } if (membersBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002)) { members_ = java.util.Collections.unmodifiableList(members_); bitField0_ = (bitField0_ & ~0x00000002); } result.members_ = members_; } else { result.members_ = membersBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.Group) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.Group)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.Group other) { if (other == cn.wildfirechat.proto.WFCMessage.Group.getDefaultInstance()) return this; if (other.hasGroupInfo()) { mergeGroupInfo(other.getGroupInfo()); } if (membersBuilder_ == null) { if (!other.members_.isEmpty()) { if (members_.isEmpty()) { members_ = other.members_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureMembersIsMutable(); members_.addAll(other.members_); } onChanged(); } } else { if (!other.members_.isEmpty()) { if (membersBuilder_.isEmpty()) { membersBuilder_.dispose(); membersBuilder_ = null; members_ = other.members_; bitField0_ = (bitField0_ & ~0x00000002); membersBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getMembersFieldBuilder() : null; } else { membersBuilder_.addAllMessages(other.members_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasGroupInfo()) { return false; } if (!getGroupInfo().isInitialized()) { return false; } for (int i = 0; i < getMembersCount(); i++) { if (!getMembers(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.Group parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.Group) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required .GroupInfo group_info = 1; private cn.wildfirechat.proto.WFCMessage.GroupInfo groupInfo_ = cn.wildfirechat.proto.WFCMessage.GroupInfo.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupInfo, cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder, cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder> groupInfoBuilder_; /** * required .GroupInfo group_info = 1; */ public boolean hasGroupInfo() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required .GroupInfo group_info = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupInfo getGroupInfo() { if (groupInfoBuilder_ == null) { return groupInfo_; } else { return groupInfoBuilder_.getMessage(); } } /** * required .GroupInfo group_info = 1; */ public Builder setGroupInfo(cn.wildfirechat.proto.WFCMessage.GroupInfo value) { if (groupInfoBuilder_ == null) { if (value == null) { throw new NullPointerException(); } groupInfo_ = value; onChanged(); } else { groupInfoBuilder_.setMessage(value); } bitField0_ |= 0x00000001; return this; } /** * required .GroupInfo group_info = 1; */ public Builder setGroupInfo( cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder builderForValue) { if (groupInfoBuilder_ == null) { groupInfo_ = builderForValue.build(); onChanged(); } else { groupInfoBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000001; return this; } /** * required .GroupInfo group_info = 1; */ public Builder mergeGroupInfo(cn.wildfirechat.proto.WFCMessage.GroupInfo value) { if (groupInfoBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && groupInfo_ != cn.wildfirechat.proto.WFCMessage.GroupInfo.getDefaultInstance()) { groupInfo_ = cn.wildfirechat.proto.WFCMessage.GroupInfo.newBuilder(groupInfo_).mergeFrom(value).buildPartial(); } else { groupInfo_ = value; } onChanged(); } else { groupInfoBuilder_.mergeFrom(value); } bitField0_ |= 0x00000001; return this; } /** * required .GroupInfo group_info = 1; */ public Builder clearGroupInfo() { if (groupInfoBuilder_ == null) { groupInfo_ = cn.wildfirechat.proto.WFCMessage.GroupInfo.getDefaultInstance(); onChanged(); } else { groupInfoBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); return this; } /** * required .GroupInfo group_info = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder getGroupInfoBuilder() { bitField0_ |= 0x00000001; onChanged(); return getGroupInfoFieldBuilder().getBuilder(); } /** * required .GroupInfo group_info = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder getGroupInfoOrBuilder() { if (groupInfoBuilder_ != null) { return groupInfoBuilder_.getMessageOrBuilder(); } else { return groupInfo_; } } /** * required .GroupInfo group_info = 1; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupInfo, cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder, cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder> getGroupInfoFieldBuilder() { if (groupInfoBuilder_ == null) { groupInfoBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupInfo, cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder, cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder>( groupInfo_, getParentForChildren(), isClean()); groupInfo_ = null; } return groupInfoBuilder_; } // repeated .GroupMember members = 2; private java.util.List members_ = java.util.Collections.emptyList(); private void ensureMembersIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { members_ = new java.util.ArrayList(members_); bitField0_ |= 0x00000002; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupMember, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder, cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder> membersBuilder_; /** * repeated .GroupMember members = 2; */ public java.util.List getMembersList() { if (membersBuilder_ == null) { return java.util.Collections.unmodifiableList(members_); } else { return membersBuilder_.getMessageList(); } } /** * repeated .GroupMember members = 2; */ public int getMembersCount() { if (membersBuilder_ == null) { return members_.size(); } else { return membersBuilder_.getCount(); } } /** * repeated .GroupMember members = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMember getMembers(int index) { if (membersBuilder_ == null) { return members_.get(index); } else { return membersBuilder_.getMessage(index); } } /** * repeated .GroupMember members = 2; */ public Builder setMembers( int index, cn.wildfirechat.proto.WFCMessage.GroupMember value) { if (membersBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMembersIsMutable(); members_.set(index, value); onChanged(); } else { membersBuilder_.setMessage(index, value); } return this; } /** * repeated .GroupMember members = 2; */ public Builder setMembers( int index, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder builderForValue) { if (membersBuilder_ == null) { ensureMembersIsMutable(); members_.set(index, builderForValue.build()); onChanged(); } else { membersBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .GroupMember members = 2; */ public Builder addMembers(cn.wildfirechat.proto.WFCMessage.GroupMember value) { if (membersBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMembersIsMutable(); members_.add(value); onChanged(); } else { membersBuilder_.addMessage(value); } return this; } /** * repeated .GroupMember members = 2; */ public Builder addMembers( int index, cn.wildfirechat.proto.WFCMessage.GroupMember value) { if (membersBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMembersIsMutable(); members_.add(index, value); onChanged(); } else { membersBuilder_.addMessage(index, value); } return this; } /** * repeated .GroupMember members = 2; */ public Builder addMembers( cn.wildfirechat.proto.WFCMessage.GroupMember.Builder builderForValue) { if (membersBuilder_ == null) { ensureMembersIsMutable(); members_.add(builderForValue.build()); onChanged(); } else { membersBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .GroupMember members = 2; */ public Builder addMembers( int index, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder builderForValue) { if (membersBuilder_ == null) { ensureMembersIsMutable(); members_.add(index, builderForValue.build()); onChanged(); } else { membersBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .GroupMember members = 2; */ public Builder addAllMembers( java.lang.Iterable values) { if (membersBuilder_ == null) { ensureMembersIsMutable(); super.addAll(values, members_); onChanged(); } else { membersBuilder_.addAllMessages(values); } return this; } /** * repeated .GroupMember members = 2; */ public Builder clearMembers() { if (membersBuilder_ == null) { members_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); } else { membersBuilder_.clear(); } return this; } /** * repeated .GroupMember members = 2; */ public Builder removeMembers(int index) { if (membersBuilder_ == null) { ensureMembersIsMutable(); members_.remove(index); onChanged(); } else { membersBuilder_.remove(index); } return this; } /** * repeated .GroupMember members = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMember.Builder getMembersBuilder( int index) { return getMembersFieldBuilder().getBuilder(index); } /** * repeated .GroupMember members = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder getMembersOrBuilder( int index) { if (membersBuilder_ == null) { return members_.get(index); } else { return membersBuilder_.getMessageOrBuilder(index); } } /** * repeated .GroupMember members = 2; */ public java.util.List getMembersOrBuilderList() { if (membersBuilder_ != null) { return membersBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(members_); } } /** * repeated .GroupMember members = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMember.Builder addMembersBuilder() { return getMembersFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.GroupMember.getDefaultInstance()); } /** * repeated .GroupMember members = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMember.Builder addMembersBuilder( int index) { return getMembersFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.GroupMember.getDefaultInstance()); } /** * repeated .GroupMember members = 2; */ public java.util.List getMembersBuilderList() { return getMembersFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupMember, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder, cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder> getMembersFieldBuilder() { if (membersBuilder_ == null) { membersBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupMember, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder, cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder>( members_, ((bitField0_ & 0x00000002) == 0x00000002), getParentForChildren(), isClean()); members_ = null; } return membersBuilder_; } // @@protoc_insertion_point(builder_scope:Group) } static { defaultInstance = new Group(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:Group) } public interface ChannelMenuOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string type = 1; /** * required string type = 1; */ boolean hasType(); /** * required string type = 1; */ java.lang.String getType(); /** * required string type = 1; */ com.google.protobuf.ByteString getTypeBytes(); // required string name = 2; /** * required string name = 2; */ boolean hasName(); /** * required string name = 2; */ java.lang.String getName(); /** * required string name = 2; */ com.google.protobuf.ByteString getNameBytes(); // optional string key = 3; /** * optional string key = 3; */ boolean hasKey(); /** * optional string key = 3; */ java.lang.String getKey(); /** * optional string key = 3; */ com.google.protobuf.ByteString getKeyBytes(); // optional string url = 4; /** * optional string url = 4; */ boolean hasUrl(); /** * optional string url = 4; */ java.lang.String getUrl(); /** * optional string url = 4; */ com.google.protobuf.ByteString getUrlBytes(); // optional string media_id = 5; /** * optional string media_id = 5; */ boolean hasMediaId(); /** * optional string media_id = 5; */ java.lang.String getMediaId(); /** * optional string media_id = 5; */ com.google.protobuf.ByteString getMediaIdBytes(); // optional string article_id = 6; /** * optional string article_id = 6; */ boolean hasArticleId(); /** * optional string article_id = 6; */ java.lang.String getArticleId(); /** * optional string article_id = 6; */ com.google.protobuf.ByteString getArticleIdBytes(); // optional string app_id = 7; /** * optional string app_id = 7; */ boolean hasAppId(); /** * optional string app_id = 7; */ java.lang.String getAppId(); /** * optional string app_id = 7; */ com.google.protobuf.ByteString getAppIdBytes(); // optional string app_page = 8; /** * optional string app_page = 8; */ boolean hasAppPage(); /** * optional string app_page = 8; */ java.lang.String getAppPage(); /** * optional string app_page = 8; */ com.google.protobuf.ByteString getAppPageBytes(); // repeated .ChannelMenu sub_menu = 9; /** * repeated .ChannelMenu sub_menu = 9; */ java.util.List getSubMenuList(); /** * repeated .ChannelMenu sub_menu = 9; */ cn.wildfirechat.proto.WFCMessage.ChannelMenu getSubMenu(int index); /** * repeated .ChannelMenu sub_menu = 9; */ int getSubMenuCount(); /** * repeated .ChannelMenu sub_menu = 9; */ java.util.List getSubMenuOrBuilderList(); /** * repeated .ChannelMenu sub_menu = 9; */ cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder getSubMenuOrBuilder( int index); // optional string menu_id = 10; /** * optional string menu_id = 10; */ boolean hasMenuId(); /** * optional string menu_id = 10; */ java.lang.String getMenuId(); /** * optional string menu_id = 10; */ com.google.protobuf.ByteString getMenuIdBytes(); // optional string extra = 11; /** * optional string extra = 11; */ boolean hasExtra(); /** * optional string extra = 11; */ java.lang.String getExtra(); /** * optional string extra = 11; */ com.google.protobuf.ByteString getExtraBytes(); } /** * Protobuf type {@code ChannelMenu} */ public static final class ChannelMenu extends com.google.protobuf.GeneratedMessage implements ChannelMenuOrBuilder { // Use ChannelMenu.newBuilder() to construct. private ChannelMenu(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ChannelMenu(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ChannelMenu defaultInstance; public static ChannelMenu getDefaultInstance() { return defaultInstance; } public ChannelMenu getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ChannelMenu( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; type_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; name_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; key_ = input.readBytes(); break; } case 34: { bitField0_ |= 0x00000008; url_ = input.readBytes(); break; } case 42: { bitField0_ |= 0x00000010; mediaId_ = input.readBytes(); break; } case 50: { bitField0_ |= 0x00000020; articleId_ = input.readBytes(); break; } case 58: { bitField0_ |= 0x00000040; appId_ = input.readBytes(); break; } case 66: { bitField0_ |= 0x00000080; appPage_ = input.readBytes(); break; } case 74: { if (!((mutable_bitField0_ & 0x00000100) == 0x00000100)) { subMenu_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000100; } subMenu_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.ChannelMenu.PARSER, extensionRegistry)); break; } case 82: { bitField0_ |= 0x00000100; menuId_ = input.readBytes(); break; } case 90: { bitField0_ |= 0x00000200; extra_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000100) == 0x00000100)) { subMenu_ = java.util.Collections.unmodifiableList(subMenu_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelMenu_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelMenu_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ChannelMenu.class, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ChannelMenu parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ChannelMenu(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string type = 1; public static final int TYPE_FIELD_NUMBER = 1; private java.lang.Object type_; /** * required string type = 1; */ public boolean hasType() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string type = 1; */ public java.lang.String getType() { java.lang.Object ref = type_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { type_ = s; } return s; } } /** * required string type = 1; */ public com.google.protobuf.ByteString getTypeBytes() { java.lang.Object ref = type_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); type_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string name = 2; public static final int NAME_FIELD_NUMBER = 2; private java.lang.Object name_; /** * required string name = 2; */ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string name = 2; */ public java.lang.String getName() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } } /** * required string name = 2; */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string key = 3; public static final int KEY_FIELD_NUMBER = 3; private java.lang.Object key_; /** * optional string key = 3; */ public boolean hasKey() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string key = 3; */ public java.lang.String getKey() { java.lang.Object ref = key_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { key_ = s; } return s; } } /** * optional string key = 3; */ public com.google.protobuf.ByteString getKeyBytes() { java.lang.Object ref = key_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); key_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string url = 4; public static final int URL_FIELD_NUMBER = 4; private java.lang.Object url_; /** * optional string url = 4; */ public boolean hasUrl() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string url = 4; */ public java.lang.String getUrl() { java.lang.Object ref = url_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { url_ = s; } return s; } } /** * optional string url = 4; */ public com.google.protobuf.ByteString getUrlBytes() { java.lang.Object ref = url_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); url_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string media_id = 5; public static final int MEDIA_ID_FIELD_NUMBER = 5; private java.lang.Object mediaId_; /** * optional string media_id = 5; */ public boolean hasMediaId() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string media_id = 5; */ public java.lang.String getMediaId() { java.lang.Object ref = mediaId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { mediaId_ = s; } return s; } } /** * optional string media_id = 5; */ public com.google.protobuf.ByteString getMediaIdBytes() { java.lang.Object ref = mediaId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); mediaId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string article_id = 6; public static final int ARTICLE_ID_FIELD_NUMBER = 6; private java.lang.Object articleId_; /** * optional string article_id = 6; */ public boolean hasArticleId() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string article_id = 6; */ public java.lang.String getArticleId() { java.lang.Object ref = articleId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { articleId_ = s; } return s; } } /** * optional string article_id = 6; */ public com.google.protobuf.ByteString getArticleIdBytes() { java.lang.Object ref = articleId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); articleId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string app_id = 7; public static final int APP_ID_FIELD_NUMBER = 7; private java.lang.Object appId_; /** * optional string app_id = 7; */ public boolean hasAppId() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string app_id = 7; */ public java.lang.String getAppId() { java.lang.Object ref = appId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { appId_ = s; } return s; } } /** * optional string app_id = 7; */ public com.google.protobuf.ByteString getAppIdBytes() { java.lang.Object ref = appId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); appId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string app_page = 8; public static final int APP_PAGE_FIELD_NUMBER = 8; private java.lang.Object appPage_; /** * optional string app_page = 8; */ public boolean hasAppPage() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional string app_page = 8; */ public java.lang.String getAppPage() { java.lang.Object ref = appPage_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { appPage_ = s; } return s; } } /** * optional string app_page = 8; */ public com.google.protobuf.ByteString getAppPageBytes() { java.lang.Object ref = appPage_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); appPage_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // repeated .ChannelMenu sub_menu = 9; public static final int SUB_MENU_FIELD_NUMBER = 9; private java.util.List subMenu_; /** * repeated .ChannelMenu sub_menu = 9; */ public java.util.List getSubMenuList() { return subMenu_; } /** * repeated .ChannelMenu sub_menu = 9; */ public java.util.List getSubMenuOrBuilderList() { return subMenu_; } /** * repeated .ChannelMenu sub_menu = 9; */ public int getSubMenuCount() { return subMenu_.size(); } /** * repeated .ChannelMenu sub_menu = 9; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu getSubMenu(int index) { return subMenu_.get(index); } /** * repeated .ChannelMenu sub_menu = 9; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder getSubMenuOrBuilder( int index) { return subMenu_.get(index); } // optional string menu_id = 10; public static final int MENU_ID_FIELD_NUMBER = 10; private java.lang.Object menuId_; /** * optional string menu_id = 10; */ public boolean hasMenuId() { return ((bitField0_ & 0x00000100) == 0x00000100); } /** * optional string menu_id = 10; */ public java.lang.String getMenuId() { java.lang.Object ref = menuId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { menuId_ = s; } return s; } } /** * optional string menu_id = 10; */ public com.google.protobuf.ByteString getMenuIdBytes() { java.lang.Object ref = menuId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); menuId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string extra = 11; public static final int EXTRA_FIELD_NUMBER = 11; private java.lang.Object extra_; /** * optional string extra = 11; */ public boolean hasExtra() { return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional string extra = 11; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 11; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { type_ = ""; name_ = ""; key_ = ""; url_ = ""; mediaId_ = ""; articleId_ = ""; appId_ = ""; appPage_ = ""; subMenu_ = java.util.Collections.emptyList(); menuId_ = ""; extra_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasType()) { memoizedIsInitialized = 0; return false; } if (!hasName()) { memoizedIsInitialized = 0; return false; } for (int i = 0; i < getSubMenuCount(); i++) { if (!getSubMenu(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTypeBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getKeyBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getUrlBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBytes(5, getMediaIdBytes()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, getArticleIdBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, getAppIdBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeBytes(8, getAppPageBytes()); } for (int i = 0; i < subMenu_.size(); i++) { output.writeMessage(9, subMenu_.get(i)); } if (((bitField0_ & 0x00000100) == 0x00000100)) { output.writeBytes(10, getMenuIdBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { output.writeBytes(11, getExtraBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTypeBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getKeyBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getUrlBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(5, getMediaIdBytes()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(6, getArticleIdBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(7, getAppIdBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(8, getAppPageBytes()); } for (int i = 0; i < subMenu_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(9, subMenu_.get(i)); } if (((bitField0_ & 0x00000100) == 0x00000100)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(10, getMenuIdBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(11, getExtraBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenu parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenu parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenu parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenu parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenu parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenu parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenu parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenu parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenu parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenu parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ChannelMenu prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ChannelMenu} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelMenu_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelMenu_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ChannelMenu.class, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ChannelMenu.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getSubMenuFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); type_ = ""; bitField0_ = (bitField0_ & ~0x00000001); name_ = ""; bitField0_ = (bitField0_ & ~0x00000002); key_ = ""; bitField0_ = (bitField0_ & ~0x00000004); url_ = ""; bitField0_ = (bitField0_ & ~0x00000008); mediaId_ = ""; bitField0_ = (bitField0_ & ~0x00000010); articleId_ = ""; bitField0_ = (bitField0_ & ~0x00000020); appId_ = ""; bitField0_ = (bitField0_ & ~0x00000040); appPage_ = ""; bitField0_ = (bitField0_ & ~0x00000080); if (subMenuBuilder_ == null) { subMenu_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000100); } else { subMenuBuilder_.clear(); } menuId_ = ""; bitField0_ = (bitField0_ & ~0x00000200); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000400); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelMenu_descriptor; } public cn.wildfirechat.proto.WFCMessage.ChannelMenu getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ChannelMenu.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ChannelMenu build() { cn.wildfirechat.proto.WFCMessage.ChannelMenu result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ChannelMenu buildPartial() { cn.wildfirechat.proto.WFCMessage.ChannelMenu result = new cn.wildfirechat.proto.WFCMessage.ChannelMenu(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.type_ = type_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.name_ = name_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.key_ = key_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.url_ = url_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.mediaId_ = mediaId_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.articleId_ = articleId_; if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000040; } result.appId_ = appId_; if (((from_bitField0_ & 0x00000080) == 0x00000080)) { to_bitField0_ |= 0x00000080; } result.appPage_ = appPage_; if (subMenuBuilder_ == null) { if (((bitField0_ & 0x00000100) == 0x00000100)) { subMenu_ = java.util.Collections.unmodifiableList(subMenu_); bitField0_ = (bitField0_ & ~0x00000100); } result.subMenu_ = subMenu_; } else { result.subMenu_ = subMenuBuilder_.build(); } if (((from_bitField0_ & 0x00000200) == 0x00000200)) { to_bitField0_ |= 0x00000100; } result.menuId_ = menuId_; if (((from_bitField0_ & 0x00000400) == 0x00000400)) { to_bitField0_ |= 0x00000200; } result.extra_ = extra_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ChannelMenu) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ChannelMenu)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ChannelMenu other) { if (other == cn.wildfirechat.proto.WFCMessage.ChannelMenu.getDefaultInstance()) return this; if (other.hasType()) { bitField0_ |= 0x00000001; type_ = other.type_; onChanged(); } if (other.hasName()) { bitField0_ |= 0x00000002; name_ = other.name_; onChanged(); } if (other.hasKey()) { bitField0_ |= 0x00000004; key_ = other.key_; onChanged(); } if (other.hasUrl()) { bitField0_ |= 0x00000008; url_ = other.url_; onChanged(); } if (other.hasMediaId()) { bitField0_ |= 0x00000010; mediaId_ = other.mediaId_; onChanged(); } if (other.hasArticleId()) { bitField0_ |= 0x00000020; articleId_ = other.articleId_; onChanged(); } if (other.hasAppId()) { bitField0_ |= 0x00000040; appId_ = other.appId_; onChanged(); } if (other.hasAppPage()) { bitField0_ |= 0x00000080; appPage_ = other.appPage_; onChanged(); } if (subMenuBuilder_ == null) { if (!other.subMenu_.isEmpty()) { if (subMenu_.isEmpty()) { subMenu_ = other.subMenu_; bitField0_ = (bitField0_ & ~0x00000100); } else { ensureSubMenuIsMutable(); subMenu_.addAll(other.subMenu_); } onChanged(); } } else { if (!other.subMenu_.isEmpty()) { if (subMenuBuilder_.isEmpty()) { subMenuBuilder_.dispose(); subMenuBuilder_ = null; subMenu_ = other.subMenu_; bitField0_ = (bitField0_ & ~0x00000100); subMenuBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getSubMenuFieldBuilder() : null; } else { subMenuBuilder_.addAllMessages(other.subMenu_); } } } if (other.hasMenuId()) { bitField0_ |= 0x00000200; menuId_ = other.menuId_; onChanged(); } if (other.hasExtra()) { bitField0_ |= 0x00000400; extra_ = other.extra_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasType()) { return false; } if (!hasName()) { return false; } for (int i = 0; i < getSubMenuCount(); i++) { if (!getSubMenu(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ChannelMenu parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ChannelMenu) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string type = 1; private java.lang.Object type_ = ""; /** * required string type = 1; */ public boolean hasType() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string type = 1; */ public java.lang.String getType() { java.lang.Object ref = type_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); type_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string type = 1; */ public com.google.protobuf.ByteString getTypeBytes() { java.lang.Object ref = type_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); type_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string type = 1; */ public Builder setType( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; type_ = value; onChanged(); return this; } /** * required string type = 1; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000001); type_ = getDefaultInstance().getType(); onChanged(); return this; } /** * required string type = 1; */ public Builder setTypeBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; type_ = value; onChanged(); return this; } // required string name = 2; private java.lang.Object name_ = ""; /** * required string name = 2; */ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string name = 2; */ public java.lang.String getName() { java.lang.Object ref = name_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); name_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string name = 2; */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string name = 2; */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; name_ = value; onChanged(); return this; } /** * required string name = 2; */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000002); name_ = getDefaultInstance().getName(); onChanged(); return this; } /** * required string name = 2; */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; name_ = value; onChanged(); return this; } // optional string key = 3; private java.lang.Object key_ = ""; /** * optional string key = 3; */ public boolean hasKey() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string key = 3; */ public java.lang.String getKey() { java.lang.Object ref = key_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); key_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string key = 3; */ public com.google.protobuf.ByteString getKeyBytes() { java.lang.Object ref = key_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); key_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string key = 3; */ public Builder setKey( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; key_ = value; onChanged(); return this; } /** * optional string key = 3; */ public Builder clearKey() { bitField0_ = (bitField0_ & ~0x00000004); key_ = getDefaultInstance().getKey(); onChanged(); return this; } /** * optional string key = 3; */ public Builder setKeyBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; key_ = value; onChanged(); return this; } // optional string url = 4; private java.lang.Object url_ = ""; /** * optional string url = 4; */ public boolean hasUrl() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string url = 4; */ public java.lang.String getUrl() { java.lang.Object ref = url_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); url_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string url = 4; */ public com.google.protobuf.ByteString getUrlBytes() { java.lang.Object ref = url_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); url_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string url = 4; */ public Builder setUrl( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; url_ = value; onChanged(); return this; } /** * optional string url = 4; */ public Builder clearUrl() { bitField0_ = (bitField0_ & ~0x00000008); url_ = getDefaultInstance().getUrl(); onChanged(); return this; } /** * optional string url = 4; */ public Builder setUrlBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; url_ = value; onChanged(); return this; } // optional string media_id = 5; private java.lang.Object mediaId_ = ""; /** * optional string media_id = 5; */ public boolean hasMediaId() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string media_id = 5; */ public java.lang.String getMediaId() { java.lang.Object ref = mediaId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); mediaId_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string media_id = 5; */ public com.google.protobuf.ByteString getMediaIdBytes() { java.lang.Object ref = mediaId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); mediaId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string media_id = 5; */ public Builder setMediaId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; mediaId_ = value; onChanged(); return this; } /** * optional string media_id = 5; */ public Builder clearMediaId() { bitField0_ = (bitField0_ & ~0x00000010); mediaId_ = getDefaultInstance().getMediaId(); onChanged(); return this; } /** * optional string media_id = 5; */ public Builder setMediaIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; mediaId_ = value; onChanged(); return this; } // optional string article_id = 6; private java.lang.Object articleId_ = ""; /** * optional string article_id = 6; */ public boolean hasArticleId() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string article_id = 6; */ public java.lang.String getArticleId() { java.lang.Object ref = articleId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); articleId_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string article_id = 6; */ public com.google.protobuf.ByteString getArticleIdBytes() { java.lang.Object ref = articleId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); articleId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string article_id = 6; */ public Builder setArticleId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; articleId_ = value; onChanged(); return this; } /** * optional string article_id = 6; */ public Builder clearArticleId() { bitField0_ = (bitField0_ & ~0x00000020); articleId_ = getDefaultInstance().getArticleId(); onChanged(); return this; } /** * optional string article_id = 6; */ public Builder setArticleIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; articleId_ = value; onChanged(); return this; } // optional string app_id = 7; private java.lang.Object appId_ = ""; /** * optional string app_id = 7; */ public boolean hasAppId() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string app_id = 7; */ public java.lang.String getAppId() { java.lang.Object ref = appId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); appId_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string app_id = 7; */ public com.google.protobuf.ByteString getAppIdBytes() { java.lang.Object ref = appId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); appId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string app_id = 7; */ public Builder setAppId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; appId_ = value; onChanged(); return this; } /** * optional string app_id = 7; */ public Builder clearAppId() { bitField0_ = (bitField0_ & ~0x00000040); appId_ = getDefaultInstance().getAppId(); onChanged(); return this; } /** * optional string app_id = 7; */ public Builder setAppIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; appId_ = value; onChanged(); return this; } // optional string app_page = 8; private java.lang.Object appPage_ = ""; /** * optional string app_page = 8; */ public boolean hasAppPage() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional string app_page = 8; */ public java.lang.String getAppPage() { java.lang.Object ref = appPage_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); appPage_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string app_page = 8; */ public com.google.protobuf.ByteString getAppPageBytes() { java.lang.Object ref = appPage_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); appPage_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string app_page = 8; */ public Builder setAppPage( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000080; appPage_ = value; onChanged(); return this; } /** * optional string app_page = 8; */ public Builder clearAppPage() { bitField0_ = (bitField0_ & ~0x00000080); appPage_ = getDefaultInstance().getAppPage(); onChanged(); return this; } /** * optional string app_page = 8; */ public Builder setAppPageBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000080; appPage_ = value; onChanged(); return this; } // repeated .ChannelMenu sub_menu = 9; private java.util.List subMenu_ = java.util.Collections.emptyList(); private void ensureSubMenuIsMutable() { if (!((bitField0_ & 0x00000100) == 0x00000100)) { subMenu_ = new java.util.ArrayList(subMenu_); bitField0_ |= 0x00000100; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.ChannelMenu, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder, cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder> subMenuBuilder_; /** * repeated .ChannelMenu sub_menu = 9; */ public java.util.List getSubMenuList() { if (subMenuBuilder_ == null) { return java.util.Collections.unmodifiableList(subMenu_); } else { return subMenuBuilder_.getMessageList(); } } /** * repeated .ChannelMenu sub_menu = 9; */ public int getSubMenuCount() { if (subMenuBuilder_ == null) { return subMenu_.size(); } else { return subMenuBuilder_.getCount(); } } /** * repeated .ChannelMenu sub_menu = 9; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu getSubMenu(int index) { if (subMenuBuilder_ == null) { return subMenu_.get(index); } else { return subMenuBuilder_.getMessage(index); } } /** * repeated .ChannelMenu sub_menu = 9; */ public Builder setSubMenu( int index, cn.wildfirechat.proto.WFCMessage.ChannelMenu value) { if (subMenuBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureSubMenuIsMutable(); subMenu_.set(index, value); onChanged(); } else { subMenuBuilder_.setMessage(index, value); } return this; } /** * repeated .ChannelMenu sub_menu = 9; */ public Builder setSubMenu( int index, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder builderForValue) { if (subMenuBuilder_ == null) { ensureSubMenuIsMutable(); subMenu_.set(index, builderForValue.build()); onChanged(); } else { subMenuBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .ChannelMenu sub_menu = 9; */ public Builder addSubMenu(cn.wildfirechat.proto.WFCMessage.ChannelMenu value) { if (subMenuBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureSubMenuIsMutable(); subMenu_.add(value); onChanged(); } else { subMenuBuilder_.addMessage(value); } return this; } /** * repeated .ChannelMenu sub_menu = 9; */ public Builder addSubMenu( int index, cn.wildfirechat.proto.WFCMessage.ChannelMenu value) { if (subMenuBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureSubMenuIsMutable(); subMenu_.add(index, value); onChanged(); } else { subMenuBuilder_.addMessage(index, value); } return this; } /** * repeated .ChannelMenu sub_menu = 9; */ public Builder addSubMenu( cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder builderForValue) { if (subMenuBuilder_ == null) { ensureSubMenuIsMutable(); subMenu_.add(builderForValue.build()); onChanged(); } else { subMenuBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .ChannelMenu sub_menu = 9; */ public Builder addSubMenu( int index, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder builderForValue) { if (subMenuBuilder_ == null) { ensureSubMenuIsMutable(); subMenu_.add(index, builderForValue.build()); onChanged(); } else { subMenuBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .ChannelMenu sub_menu = 9; */ public Builder addAllSubMenu( java.lang.Iterable values) { if (subMenuBuilder_ == null) { ensureSubMenuIsMutable(); super.addAll(values, subMenu_); onChanged(); } else { subMenuBuilder_.addAllMessages(values); } return this; } /** * repeated .ChannelMenu sub_menu = 9; */ public Builder clearSubMenu() { if (subMenuBuilder_ == null) { subMenu_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000100); onChanged(); } else { subMenuBuilder_.clear(); } return this; } /** * repeated .ChannelMenu sub_menu = 9; */ public Builder removeSubMenu(int index) { if (subMenuBuilder_ == null) { ensureSubMenuIsMutable(); subMenu_.remove(index); onChanged(); } else { subMenuBuilder_.remove(index); } return this; } /** * repeated .ChannelMenu sub_menu = 9; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder getSubMenuBuilder( int index) { return getSubMenuFieldBuilder().getBuilder(index); } /** * repeated .ChannelMenu sub_menu = 9; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder getSubMenuOrBuilder( int index) { if (subMenuBuilder_ == null) { return subMenu_.get(index); } else { return subMenuBuilder_.getMessageOrBuilder(index); } } /** * repeated .ChannelMenu sub_menu = 9; */ public java.util.List getSubMenuOrBuilderList() { if (subMenuBuilder_ != null) { return subMenuBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(subMenu_); } } /** * repeated .ChannelMenu sub_menu = 9; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder addSubMenuBuilder() { return getSubMenuFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.ChannelMenu.getDefaultInstance()); } /** * repeated .ChannelMenu sub_menu = 9; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder addSubMenuBuilder( int index) { return getSubMenuFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.ChannelMenu.getDefaultInstance()); } /** * repeated .ChannelMenu sub_menu = 9; */ public java.util.List getSubMenuBuilderList() { return getSubMenuFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.ChannelMenu, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder, cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder> getSubMenuFieldBuilder() { if (subMenuBuilder_ == null) { subMenuBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.ChannelMenu, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder, cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder>( subMenu_, ((bitField0_ & 0x00000100) == 0x00000100), getParentForChildren(), isClean()); subMenu_ = null; } return subMenuBuilder_; } // optional string menu_id = 10; private java.lang.Object menuId_ = ""; /** * optional string menu_id = 10; */ public boolean hasMenuId() { return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional string menu_id = 10; */ public java.lang.String getMenuId() { java.lang.Object ref = menuId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); menuId_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string menu_id = 10; */ public com.google.protobuf.ByteString getMenuIdBytes() { java.lang.Object ref = menuId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); menuId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string menu_id = 10; */ public Builder setMenuId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000200; menuId_ = value; onChanged(); return this; } /** * optional string menu_id = 10; */ public Builder clearMenuId() { bitField0_ = (bitField0_ & ~0x00000200); menuId_ = getDefaultInstance().getMenuId(); onChanged(); return this; } /** * optional string menu_id = 10; */ public Builder setMenuIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000200; menuId_ = value; onChanged(); return this; } // optional string extra = 11; private java.lang.Object extra_ = ""; /** * optional string extra = 11; */ public boolean hasExtra() { return ((bitField0_ & 0x00000400) == 0x00000400); } /** * optional string extra = 11; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 11; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 11; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000400; extra_ = value; onChanged(); return this; } /** * optional string extra = 11; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000400); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 11; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000400; extra_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:ChannelMenu) } static { defaultInstance = new ChannelMenu(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ChannelMenu) } public interface ChannelMenuListOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .ChannelMenu menu = 1; /** * repeated .ChannelMenu menu = 1; */ java.util.List getMenuList(); /** * repeated .ChannelMenu menu = 1; */ cn.wildfirechat.proto.WFCMessage.ChannelMenu getMenu(int index); /** * repeated .ChannelMenu menu = 1; */ int getMenuCount(); /** * repeated .ChannelMenu menu = 1; */ java.util.List getMenuOrBuilderList(); /** * repeated .ChannelMenu menu = 1; */ cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder getMenuOrBuilder( int index); } /** * Protobuf type {@code ChannelMenuList} */ public static final class ChannelMenuList extends com.google.protobuf.GeneratedMessage implements ChannelMenuListOrBuilder { // Use ChannelMenuList.newBuilder() to construct. private ChannelMenuList(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ChannelMenuList(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ChannelMenuList defaultInstance; public static ChannelMenuList getDefaultInstance() { return defaultInstance; } public ChannelMenuList getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ChannelMenuList( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { menu_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } menu_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.ChannelMenu.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { menu_ = java.util.Collections.unmodifiableList(menu_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelMenuList_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelMenuList_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ChannelMenuList.class, cn.wildfirechat.proto.WFCMessage.ChannelMenuList.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ChannelMenuList parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ChannelMenuList(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } // repeated .ChannelMenu menu = 1; public static final int MENU_FIELD_NUMBER = 1; private java.util.List menu_; /** * repeated .ChannelMenu menu = 1; */ public java.util.List getMenuList() { return menu_; } /** * repeated .ChannelMenu menu = 1; */ public java.util.List getMenuOrBuilderList() { return menu_; } /** * repeated .ChannelMenu menu = 1; */ public int getMenuCount() { return menu_.size(); } /** * repeated .ChannelMenu menu = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu getMenu(int index) { return menu_.get(index); } /** * repeated .ChannelMenu menu = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder getMenuOrBuilder( int index) { return menu_.get(index); } private void initFields() { menu_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getMenuCount(); i++) { if (!getMenu(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < menu_.size(); i++) { output.writeMessage(1, menu_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < menu_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, menu_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenuList parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenuList parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenuList parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenuList parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenuList parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenuList parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenuList parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenuList parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenuList parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChannelMenuList parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ChannelMenuList prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ChannelMenuList} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ChannelMenuListOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelMenuList_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelMenuList_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ChannelMenuList.class, cn.wildfirechat.proto.WFCMessage.ChannelMenuList.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ChannelMenuList.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getMenuFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (menuBuilder_ == null) { menu_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { menuBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelMenuList_descriptor; } public cn.wildfirechat.proto.WFCMessage.ChannelMenuList getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ChannelMenuList.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ChannelMenuList build() { cn.wildfirechat.proto.WFCMessage.ChannelMenuList result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ChannelMenuList buildPartial() { cn.wildfirechat.proto.WFCMessage.ChannelMenuList result = new cn.wildfirechat.proto.WFCMessage.ChannelMenuList(this); int from_bitField0_ = bitField0_; if (menuBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { menu_ = java.util.Collections.unmodifiableList(menu_); bitField0_ = (bitField0_ & ~0x00000001); } result.menu_ = menu_; } else { result.menu_ = menuBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ChannelMenuList) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ChannelMenuList)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ChannelMenuList other) { if (other == cn.wildfirechat.proto.WFCMessage.ChannelMenuList.getDefaultInstance()) return this; if (menuBuilder_ == null) { if (!other.menu_.isEmpty()) { if (menu_.isEmpty()) { menu_ = other.menu_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureMenuIsMutable(); menu_.addAll(other.menu_); } onChanged(); } } else { if (!other.menu_.isEmpty()) { if (menuBuilder_.isEmpty()) { menuBuilder_.dispose(); menuBuilder_ = null; menu_ = other.menu_; bitField0_ = (bitField0_ & ~0x00000001); menuBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getMenuFieldBuilder() : null; } else { menuBuilder_.addAllMessages(other.menu_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { for (int i = 0; i < getMenuCount(); i++) { if (!getMenu(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ChannelMenuList parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ChannelMenuList) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .ChannelMenu menu = 1; private java.util.List menu_ = java.util.Collections.emptyList(); private void ensureMenuIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { menu_ = new java.util.ArrayList(menu_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.ChannelMenu, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder, cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder> menuBuilder_; /** * repeated .ChannelMenu menu = 1; */ public java.util.List getMenuList() { if (menuBuilder_ == null) { return java.util.Collections.unmodifiableList(menu_); } else { return menuBuilder_.getMessageList(); } } /** * repeated .ChannelMenu menu = 1; */ public int getMenuCount() { if (menuBuilder_ == null) { return menu_.size(); } else { return menuBuilder_.getCount(); } } /** * repeated .ChannelMenu menu = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu getMenu(int index) { if (menuBuilder_ == null) { return menu_.get(index); } else { return menuBuilder_.getMessage(index); } } /** * repeated .ChannelMenu menu = 1; */ public Builder setMenu( int index, cn.wildfirechat.proto.WFCMessage.ChannelMenu value) { if (menuBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMenuIsMutable(); menu_.set(index, value); onChanged(); } else { menuBuilder_.setMessage(index, value); } return this; } /** * repeated .ChannelMenu menu = 1; */ public Builder setMenu( int index, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder builderForValue) { if (menuBuilder_ == null) { ensureMenuIsMutable(); menu_.set(index, builderForValue.build()); onChanged(); } else { menuBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .ChannelMenu menu = 1; */ public Builder addMenu(cn.wildfirechat.proto.WFCMessage.ChannelMenu value) { if (menuBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMenuIsMutable(); menu_.add(value); onChanged(); } else { menuBuilder_.addMessage(value); } return this; } /** * repeated .ChannelMenu menu = 1; */ public Builder addMenu( int index, cn.wildfirechat.proto.WFCMessage.ChannelMenu value) { if (menuBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMenuIsMutable(); menu_.add(index, value); onChanged(); } else { menuBuilder_.addMessage(index, value); } return this; } /** * repeated .ChannelMenu menu = 1; */ public Builder addMenu( cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder builderForValue) { if (menuBuilder_ == null) { ensureMenuIsMutable(); menu_.add(builderForValue.build()); onChanged(); } else { menuBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .ChannelMenu menu = 1; */ public Builder addMenu( int index, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder builderForValue) { if (menuBuilder_ == null) { ensureMenuIsMutable(); menu_.add(index, builderForValue.build()); onChanged(); } else { menuBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .ChannelMenu menu = 1; */ public Builder addAllMenu( java.lang.Iterable values) { if (menuBuilder_ == null) { ensureMenuIsMutable(); super.addAll(values, menu_); onChanged(); } else { menuBuilder_.addAllMessages(values); } return this; } /** * repeated .ChannelMenu menu = 1; */ public Builder clearMenu() { if (menuBuilder_ == null) { menu_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { menuBuilder_.clear(); } return this; } /** * repeated .ChannelMenu menu = 1; */ public Builder removeMenu(int index) { if (menuBuilder_ == null) { ensureMenuIsMutable(); menu_.remove(index); onChanged(); } else { menuBuilder_.remove(index); } return this; } /** * repeated .ChannelMenu menu = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder getMenuBuilder( int index) { return getMenuFieldBuilder().getBuilder(index); } /** * repeated .ChannelMenu menu = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder getMenuOrBuilder( int index) { if (menuBuilder_ == null) { return menu_.get(index); } else { return menuBuilder_.getMessageOrBuilder(index); } } /** * repeated .ChannelMenu menu = 1; */ public java.util.List getMenuOrBuilderList() { if (menuBuilder_ != null) { return menuBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(menu_); } } /** * repeated .ChannelMenu menu = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder addMenuBuilder() { return getMenuFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.ChannelMenu.getDefaultInstance()); } /** * repeated .ChannelMenu menu = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder addMenuBuilder( int index) { return getMenuFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.ChannelMenu.getDefaultInstance()); } /** * repeated .ChannelMenu menu = 1; */ public java.util.List getMenuBuilderList() { return getMenuFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.ChannelMenu, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder, cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder> getMenuFieldBuilder() { if (menuBuilder_ == null) { menuBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.ChannelMenu, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder, cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder>( menu_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); menu_ = null; } return menuBuilder_; } // @@protoc_insertion_point(builder_scope:ChannelMenuList) } static { defaultInstance = new ChannelMenuList(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ChannelMenuList) } public interface ChannelInfoOrBuilder extends com.google.protobuf.MessageOrBuilder { // optional string target_id = 1; /** * optional string target_id = 1; */ boolean hasTargetId(); /** * optional string target_id = 1; */ java.lang.String getTargetId(); /** * optional string target_id = 1; */ com.google.protobuf.ByteString getTargetIdBytes(); // required string name = 2; /** * required string name = 2; */ boolean hasName(); /** * required string name = 2; */ java.lang.String getName(); /** * required string name = 2; */ com.google.protobuf.ByteString getNameBytes(); // optional string portrait = 3; /** * optional string portrait = 3; */ boolean hasPortrait(); /** * optional string portrait = 3; */ java.lang.String getPortrait(); /** * optional string portrait = 3; */ com.google.protobuf.ByteString getPortraitBytes(); // optional string owner = 4; /** * optional string owner = 4; */ boolean hasOwner(); /** * optional string owner = 4; */ java.lang.String getOwner(); /** * optional string owner = 4; */ com.google.protobuf.ByteString getOwnerBytes(); // optional int32 status = 5; /** * optional int32 status = 5; * *
     *0, public; 1, private; 2 closed;
     * 
*/ boolean hasStatus(); /** * optional int32 status = 5; * *
     *0, public; 1, private; 2 closed;
     * 
*/ int getStatus(); // optional string desc = 6; /** * optional string desc = 6; */ boolean hasDesc(); /** * optional string desc = 6; */ java.lang.String getDesc(); /** * optional string desc = 6; */ com.google.protobuf.ByteString getDescBytes(); // optional string extra = 7; /** * optional string extra = 7; */ boolean hasExtra(); /** * optional string extra = 7; */ java.lang.String getExtra(); /** * optional string extra = 7; */ com.google.protobuf.ByteString getExtraBytes(); // optional int64 update_dt = 8; /** * optional int64 update_dt = 8; */ boolean hasUpdateDt(); /** * optional int64 update_dt = 8; */ long getUpdateDt(); // optional string secret = 9; /** * optional string secret = 9; */ boolean hasSecret(); /** * optional string secret = 9; */ java.lang.String getSecret(); /** * optional string secret = 9; */ com.google.protobuf.ByteString getSecretBytes(); // optional string callback = 10; /** * optional string callback = 10; */ boolean hasCallback(); /** * optional string callback = 10; */ java.lang.String getCallback(); /** * optional string callback = 10; */ com.google.protobuf.ByteString getCallbackBytes(); // optional int32 automatic = 11; /** * optional int32 automatic = 11; */ boolean hasAutomatic(); /** * optional int32 automatic = 11; */ int getAutomatic(); // repeated .ChannelMenu menu = 12; /** * repeated .ChannelMenu menu = 12; */ java.util.List getMenuList(); /** * repeated .ChannelMenu menu = 12; */ cn.wildfirechat.proto.WFCMessage.ChannelMenu getMenu(int index); /** * repeated .ChannelMenu menu = 12; */ int getMenuCount(); /** * repeated .ChannelMenu menu = 12; */ java.util.List getMenuOrBuilderList(); /** * repeated .ChannelMenu menu = 12; */ cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder getMenuOrBuilder( int index); } /** * Protobuf type {@code ChannelInfo} */ public static final class ChannelInfo extends com.google.protobuf.GeneratedMessage implements ChannelInfoOrBuilder { // Use ChannelInfo.newBuilder() to construct. private ChannelInfo(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ChannelInfo(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ChannelInfo defaultInstance; public static ChannelInfo getDefaultInstance() { return defaultInstance; } public ChannelInfo getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ChannelInfo( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; targetId_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; name_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; portrait_ = input.readBytes(); break; } case 34: { bitField0_ |= 0x00000008; owner_ = input.readBytes(); break; } case 40: { bitField0_ |= 0x00000010; status_ = input.readInt32(); break; } case 50: { bitField0_ |= 0x00000020; desc_ = input.readBytes(); break; } case 58: { bitField0_ |= 0x00000040; extra_ = input.readBytes(); break; } case 64: { bitField0_ |= 0x00000080; updateDt_ = input.readInt64(); break; } case 74: { bitField0_ |= 0x00000100; secret_ = input.readBytes(); break; } case 82: { bitField0_ |= 0x00000200; callback_ = input.readBytes(); break; } case 88: { bitField0_ |= 0x00000400; automatic_ = input.readInt32(); break; } case 98: { if (!((mutable_bitField0_ & 0x00000800) == 0x00000800)) { menu_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000800; } menu_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.ChannelMenu.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000800) == 0x00000800)) { menu_ = java.util.Collections.unmodifiableList(menu_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ChannelInfo.class, cn.wildfirechat.proto.WFCMessage.ChannelInfo.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ChannelInfo parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ChannelInfo(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // optional string target_id = 1; public static final int TARGET_ID_FIELD_NUMBER = 1; private java.lang.Object targetId_; /** * optional string target_id = 1; */ public boolean hasTargetId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * optional string target_id = 1; */ public java.lang.String getTargetId() { java.lang.Object ref = targetId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { targetId_ = s; } return s; } } /** * optional string target_id = 1; */ public com.google.protobuf.ByteString getTargetIdBytes() { java.lang.Object ref = targetId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); targetId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string name = 2; public static final int NAME_FIELD_NUMBER = 2; private java.lang.Object name_; /** * required string name = 2; */ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string name = 2; */ public java.lang.String getName() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } } /** * required string name = 2; */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string portrait = 3; public static final int PORTRAIT_FIELD_NUMBER = 3; private java.lang.Object portrait_; /** * optional string portrait = 3; */ public boolean hasPortrait() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string portrait = 3; */ public java.lang.String getPortrait() { java.lang.Object ref = portrait_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { portrait_ = s; } return s; } } /** * optional string portrait = 3; */ public com.google.protobuf.ByteString getPortraitBytes() { java.lang.Object ref = portrait_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); portrait_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string owner = 4; public static final int OWNER_FIELD_NUMBER = 4; private java.lang.Object owner_; /** * optional string owner = 4; */ public boolean hasOwner() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string owner = 4; */ public java.lang.String getOwner() { java.lang.Object ref = owner_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { owner_ = s; } return s; } } /** * optional string owner = 4; */ public com.google.protobuf.ByteString getOwnerBytes() { java.lang.Object ref = owner_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); owner_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 status = 5; public static final int STATUS_FIELD_NUMBER = 5; private int status_; /** * optional int32 status = 5; * *
     *0, public; 1, private; 2 closed;
     * 
*/ public boolean hasStatus() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int32 status = 5; * *
     *0, public; 1, private; 2 closed;
     * 
*/ public int getStatus() { return status_; } // optional string desc = 6; public static final int DESC_FIELD_NUMBER = 6; private java.lang.Object desc_; /** * optional string desc = 6; */ public boolean hasDesc() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string desc = 6; */ public java.lang.String getDesc() { java.lang.Object ref = desc_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { desc_ = s; } return s; } } /** * optional string desc = 6; */ public com.google.protobuf.ByteString getDescBytes() { java.lang.Object ref = desc_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); desc_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string extra = 7; public static final int EXTRA_FIELD_NUMBER = 7; private java.lang.Object extra_; /** * optional string extra = 7; */ public boolean hasExtra() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string extra = 7; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 7; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int64 update_dt = 8; public static final int UPDATE_DT_FIELD_NUMBER = 8; private long updateDt_; /** * optional int64 update_dt = 8; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional int64 update_dt = 8; */ public long getUpdateDt() { return updateDt_; } // optional string secret = 9; public static final int SECRET_FIELD_NUMBER = 9; private java.lang.Object secret_; /** * optional string secret = 9; */ public boolean hasSecret() { return ((bitField0_ & 0x00000100) == 0x00000100); } /** * optional string secret = 9; */ public java.lang.String getSecret() { java.lang.Object ref = secret_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { secret_ = s; } return s; } } /** * optional string secret = 9; */ public com.google.protobuf.ByteString getSecretBytes() { java.lang.Object ref = secret_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); secret_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string callback = 10; public static final int CALLBACK_FIELD_NUMBER = 10; private java.lang.Object callback_; /** * optional string callback = 10; */ public boolean hasCallback() { return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional string callback = 10; */ public java.lang.String getCallback() { java.lang.Object ref = callback_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { callback_ = s; } return s; } } /** * optional string callback = 10; */ public com.google.protobuf.ByteString getCallbackBytes() { java.lang.Object ref = callback_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); callback_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 automatic = 11; public static final int AUTOMATIC_FIELD_NUMBER = 11; private int automatic_; /** * optional int32 automatic = 11; */ public boolean hasAutomatic() { return ((bitField0_ & 0x00000400) == 0x00000400); } /** * optional int32 automatic = 11; */ public int getAutomatic() { return automatic_; } // repeated .ChannelMenu menu = 12; public static final int MENU_FIELD_NUMBER = 12; private java.util.List menu_; /** * repeated .ChannelMenu menu = 12; */ public java.util.List getMenuList() { return menu_; } /** * repeated .ChannelMenu menu = 12; */ public java.util.List getMenuOrBuilderList() { return menu_; } /** * repeated .ChannelMenu menu = 12; */ public int getMenuCount() { return menu_.size(); } /** * repeated .ChannelMenu menu = 12; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu getMenu(int index) { return menu_.get(index); } /** * repeated .ChannelMenu menu = 12; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder getMenuOrBuilder( int index) { return menu_.get(index); } private void initFields() { targetId_ = ""; name_ = ""; portrait_ = ""; owner_ = ""; status_ = 0; desc_ = ""; extra_ = ""; updateDt_ = 0L; secret_ = ""; callback_ = ""; automatic_ = 0; menu_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasName()) { memoizedIsInitialized = 0; return false; } for (int i = 0; i < getMenuCount(); i++) { if (!getMenu(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTargetIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getPortraitBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getOwnerBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeInt32(5, status_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, getDescBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, getExtraBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeInt64(8, updateDt_); } if (((bitField0_ & 0x00000100) == 0x00000100)) { output.writeBytes(9, getSecretBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { output.writeBytes(10, getCallbackBytes()); } if (((bitField0_ & 0x00000400) == 0x00000400)) { output.writeInt32(11, automatic_); } for (int i = 0; i < menu_.size(); i++) { output.writeMessage(12, menu_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTargetIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getPortraitBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getOwnerBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(5, status_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(6, getDescBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(7, getExtraBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(8, updateDt_); } if (((bitField0_ & 0x00000100) == 0x00000100)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(9, getSecretBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(10, getCallbackBytes()); } if (((bitField0_ & 0x00000400) == 0x00000400)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(11, automatic_); } for (int i = 0; i < menu_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(12, menu_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ChannelInfo parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ChannelInfo parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChannelInfo parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ChannelInfo parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChannelInfo parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChannelInfo parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChannelInfo parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChannelInfo parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChannelInfo parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChannelInfo parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ChannelInfo prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ChannelInfo} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ChannelInfoOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ChannelInfo.class, cn.wildfirechat.proto.WFCMessage.ChannelInfo.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ChannelInfo.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getMenuFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); targetId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); name_ = ""; bitField0_ = (bitField0_ & ~0x00000002); portrait_ = ""; bitField0_ = (bitField0_ & ~0x00000004); owner_ = ""; bitField0_ = (bitField0_ & ~0x00000008); status_ = 0; bitField0_ = (bitField0_ & ~0x00000010); desc_ = ""; bitField0_ = (bitField0_ & ~0x00000020); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000040); updateDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000080); secret_ = ""; bitField0_ = (bitField0_ & ~0x00000100); callback_ = ""; bitField0_ = (bitField0_ & ~0x00000200); automatic_ = 0; bitField0_ = (bitField0_ & ~0x00000400); if (menuBuilder_ == null) { menu_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000800); } else { menuBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChannelInfo_descriptor; } public cn.wildfirechat.proto.WFCMessage.ChannelInfo getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ChannelInfo.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ChannelInfo build() { cn.wildfirechat.proto.WFCMessage.ChannelInfo result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ChannelInfo buildPartial() { cn.wildfirechat.proto.WFCMessage.ChannelInfo result = new cn.wildfirechat.proto.WFCMessage.ChannelInfo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.targetId_ = targetId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.name_ = name_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.portrait_ = portrait_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.owner_ = owner_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.status_ = status_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.desc_ = desc_; if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000040; } result.extra_ = extra_; if (((from_bitField0_ & 0x00000080) == 0x00000080)) { to_bitField0_ |= 0x00000080; } result.updateDt_ = updateDt_; if (((from_bitField0_ & 0x00000100) == 0x00000100)) { to_bitField0_ |= 0x00000100; } result.secret_ = secret_; if (((from_bitField0_ & 0x00000200) == 0x00000200)) { to_bitField0_ |= 0x00000200; } result.callback_ = callback_; if (((from_bitField0_ & 0x00000400) == 0x00000400)) { to_bitField0_ |= 0x00000400; } result.automatic_ = automatic_; if (menuBuilder_ == null) { if (((bitField0_ & 0x00000800) == 0x00000800)) { menu_ = java.util.Collections.unmodifiableList(menu_); bitField0_ = (bitField0_ & ~0x00000800); } result.menu_ = menu_; } else { result.menu_ = menuBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ChannelInfo) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ChannelInfo)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ChannelInfo other) { if (other == cn.wildfirechat.proto.WFCMessage.ChannelInfo.getDefaultInstance()) return this; if (other.hasTargetId()) { bitField0_ |= 0x00000001; targetId_ = other.targetId_; onChanged(); } if (other.hasName()) { bitField0_ |= 0x00000002; name_ = other.name_; onChanged(); } if (other.hasPortrait()) { bitField0_ |= 0x00000004; portrait_ = other.portrait_; onChanged(); } if (other.hasOwner()) { bitField0_ |= 0x00000008; owner_ = other.owner_; onChanged(); } if (other.hasStatus()) { setStatus(other.getStatus()); } if (other.hasDesc()) { bitField0_ |= 0x00000020; desc_ = other.desc_; onChanged(); } if (other.hasExtra()) { bitField0_ |= 0x00000040; extra_ = other.extra_; onChanged(); } if (other.hasUpdateDt()) { setUpdateDt(other.getUpdateDt()); } if (other.hasSecret()) { bitField0_ |= 0x00000100; secret_ = other.secret_; onChanged(); } if (other.hasCallback()) { bitField0_ |= 0x00000200; callback_ = other.callback_; onChanged(); } if (other.hasAutomatic()) { setAutomatic(other.getAutomatic()); } if (menuBuilder_ == null) { if (!other.menu_.isEmpty()) { if (menu_.isEmpty()) { menu_ = other.menu_; bitField0_ = (bitField0_ & ~0x00000800); } else { ensureMenuIsMutable(); menu_.addAll(other.menu_); } onChanged(); } } else { if (!other.menu_.isEmpty()) { if (menuBuilder_.isEmpty()) { menuBuilder_.dispose(); menuBuilder_ = null; menu_ = other.menu_; bitField0_ = (bitField0_ & ~0x00000800); menuBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getMenuFieldBuilder() : null; } else { menuBuilder_.addAllMessages(other.menu_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasName()) { return false; } for (int i = 0; i < getMenuCount(); i++) { if (!getMenu(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ChannelInfo parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ChannelInfo) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // optional string target_id = 1; private java.lang.Object targetId_ = ""; /** * optional string target_id = 1; */ public boolean hasTargetId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * optional string target_id = 1; */ public java.lang.String getTargetId() { java.lang.Object ref = targetId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); targetId_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string target_id = 1; */ public com.google.protobuf.ByteString getTargetIdBytes() { java.lang.Object ref = targetId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); targetId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string target_id = 1; */ public Builder setTargetId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; targetId_ = value; onChanged(); return this; } /** * optional string target_id = 1; */ public Builder clearTargetId() { bitField0_ = (bitField0_ & ~0x00000001); targetId_ = getDefaultInstance().getTargetId(); onChanged(); return this; } /** * optional string target_id = 1; */ public Builder setTargetIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; targetId_ = value; onChanged(); return this; } // required string name = 2; private java.lang.Object name_ = ""; /** * required string name = 2; */ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string name = 2; */ public java.lang.String getName() { java.lang.Object ref = name_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); name_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string name = 2; */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string name = 2; */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; name_ = value; onChanged(); return this; } /** * required string name = 2; */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000002); name_ = getDefaultInstance().getName(); onChanged(); return this; } /** * required string name = 2; */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; name_ = value; onChanged(); return this; } // optional string portrait = 3; private java.lang.Object portrait_ = ""; /** * optional string portrait = 3; */ public boolean hasPortrait() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string portrait = 3; */ public java.lang.String getPortrait() { java.lang.Object ref = portrait_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); portrait_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string portrait = 3; */ public com.google.protobuf.ByteString getPortraitBytes() { java.lang.Object ref = portrait_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); portrait_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string portrait = 3; */ public Builder setPortrait( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; portrait_ = value; onChanged(); return this; } /** * optional string portrait = 3; */ public Builder clearPortrait() { bitField0_ = (bitField0_ & ~0x00000004); portrait_ = getDefaultInstance().getPortrait(); onChanged(); return this; } /** * optional string portrait = 3; */ public Builder setPortraitBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; portrait_ = value; onChanged(); return this; } // optional string owner = 4; private java.lang.Object owner_ = ""; /** * optional string owner = 4; */ public boolean hasOwner() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string owner = 4; */ public java.lang.String getOwner() { java.lang.Object ref = owner_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); owner_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string owner = 4; */ public com.google.protobuf.ByteString getOwnerBytes() { java.lang.Object ref = owner_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); owner_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string owner = 4; */ public Builder setOwner( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; owner_ = value; onChanged(); return this; } /** * optional string owner = 4; */ public Builder clearOwner() { bitField0_ = (bitField0_ & ~0x00000008); owner_ = getDefaultInstance().getOwner(); onChanged(); return this; } /** * optional string owner = 4; */ public Builder setOwnerBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; owner_ = value; onChanged(); return this; } // optional int32 status = 5; private int status_ ; /** * optional int32 status = 5; * *
       *0, public; 1, private; 2 closed;
       * 
*/ public boolean hasStatus() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int32 status = 5; * *
       *0, public; 1, private; 2 closed;
       * 
*/ public int getStatus() { return status_; } /** * optional int32 status = 5; * *
       *0, public; 1, private; 2 closed;
       * 
*/ public Builder setStatus(int value) { bitField0_ |= 0x00000010; status_ = value; onChanged(); return this; } /** * optional int32 status = 5; * *
       *0, public; 1, private; 2 closed;
       * 
*/ public Builder clearStatus() { bitField0_ = (bitField0_ & ~0x00000010); status_ = 0; onChanged(); return this; } // optional string desc = 6; private java.lang.Object desc_ = ""; /** * optional string desc = 6; */ public boolean hasDesc() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string desc = 6; */ public java.lang.String getDesc() { java.lang.Object ref = desc_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); desc_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string desc = 6; */ public com.google.protobuf.ByteString getDescBytes() { java.lang.Object ref = desc_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); desc_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string desc = 6; */ public Builder setDesc( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; desc_ = value; onChanged(); return this; } /** * optional string desc = 6; */ public Builder clearDesc() { bitField0_ = (bitField0_ & ~0x00000020); desc_ = getDefaultInstance().getDesc(); onChanged(); return this; } /** * optional string desc = 6; */ public Builder setDescBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; desc_ = value; onChanged(); return this; } // optional string extra = 7; private java.lang.Object extra_ = ""; /** * optional string extra = 7; */ public boolean hasExtra() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string extra = 7; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 7; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 7; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; extra_ = value; onChanged(); return this; } /** * optional string extra = 7; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000040); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 7; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; extra_ = value; onChanged(); return this; } // optional int64 update_dt = 8; private long updateDt_ ; /** * optional int64 update_dt = 8; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional int64 update_dt = 8; */ public long getUpdateDt() { return updateDt_; } /** * optional int64 update_dt = 8; */ public Builder setUpdateDt(long value) { bitField0_ |= 0x00000080; updateDt_ = value; onChanged(); return this; } /** * optional int64 update_dt = 8; */ public Builder clearUpdateDt() { bitField0_ = (bitField0_ & ~0x00000080); updateDt_ = 0L; onChanged(); return this; } // optional string secret = 9; private java.lang.Object secret_ = ""; /** * optional string secret = 9; */ public boolean hasSecret() { return ((bitField0_ & 0x00000100) == 0x00000100); } /** * optional string secret = 9; */ public java.lang.String getSecret() { java.lang.Object ref = secret_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); secret_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string secret = 9; */ public com.google.protobuf.ByteString getSecretBytes() { java.lang.Object ref = secret_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); secret_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string secret = 9; */ public Builder setSecret( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000100; secret_ = value; onChanged(); return this; } /** * optional string secret = 9; */ public Builder clearSecret() { bitField0_ = (bitField0_ & ~0x00000100); secret_ = getDefaultInstance().getSecret(); onChanged(); return this; } /** * optional string secret = 9; */ public Builder setSecretBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000100; secret_ = value; onChanged(); return this; } // optional string callback = 10; private java.lang.Object callback_ = ""; /** * optional string callback = 10; */ public boolean hasCallback() { return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional string callback = 10; */ public java.lang.String getCallback() { java.lang.Object ref = callback_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); callback_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string callback = 10; */ public com.google.protobuf.ByteString getCallbackBytes() { java.lang.Object ref = callback_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); callback_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string callback = 10; */ public Builder setCallback( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000200; callback_ = value; onChanged(); return this; } /** * optional string callback = 10; */ public Builder clearCallback() { bitField0_ = (bitField0_ & ~0x00000200); callback_ = getDefaultInstance().getCallback(); onChanged(); return this; } /** * optional string callback = 10; */ public Builder setCallbackBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000200; callback_ = value; onChanged(); return this; } // optional int32 automatic = 11; private int automatic_ ; /** * optional int32 automatic = 11; */ public boolean hasAutomatic() { return ((bitField0_ & 0x00000400) == 0x00000400); } /** * optional int32 automatic = 11; */ public int getAutomatic() { return automatic_; } /** * optional int32 automatic = 11; */ public Builder setAutomatic(int value) { bitField0_ |= 0x00000400; automatic_ = value; onChanged(); return this; } /** * optional int32 automatic = 11; */ public Builder clearAutomatic() { bitField0_ = (bitField0_ & ~0x00000400); automatic_ = 0; onChanged(); return this; } // repeated .ChannelMenu menu = 12; private java.util.List menu_ = java.util.Collections.emptyList(); private void ensureMenuIsMutable() { if (!((bitField0_ & 0x00000800) == 0x00000800)) { menu_ = new java.util.ArrayList(menu_); bitField0_ |= 0x00000800; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.ChannelMenu, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder, cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder> menuBuilder_; /** * repeated .ChannelMenu menu = 12; */ public java.util.List getMenuList() { if (menuBuilder_ == null) { return java.util.Collections.unmodifiableList(menu_); } else { return menuBuilder_.getMessageList(); } } /** * repeated .ChannelMenu menu = 12; */ public int getMenuCount() { if (menuBuilder_ == null) { return menu_.size(); } else { return menuBuilder_.getCount(); } } /** * repeated .ChannelMenu menu = 12; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu getMenu(int index) { if (menuBuilder_ == null) { return menu_.get(index); } else { return menuBuilder_.getMessage(index); } } /** * repeated .ChannelMenu menu = 12; */ public Builder setMenu( int index, cn.wildfirechat.proto.WFCMessage.ChannelMenu value) { if (menuBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMenuIsMutable(); menu_.set(index, value); onChanged(); } else { menuBuilder_.setMessage(index, value); } return this; } /** * repeated .ChannelMenu menu = 12; */ public Builder setMenu( int index, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder builderForValue) { if (menuBuilder_ == null) { ensureMenuIsMutable(); menu_.set(index, builderForValue.build()); onChanged(); } else { menuBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .ChannelMenu menu = 12; */ public Builder addMenu(cn.wildfirechat.proto.WFCMessage.ChannelMenu value) { if (menuBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMenuIsMutable(); menu_.add(value); onChanged(); } else { menuBuilder_.addMessage(value); } return this; } /** * repeated .ChannelMenu menu = 12; */ public Builder addMenu( int index, cn.wildfirechat.proto.WFCMessage.ChannelMenu value) { if (menuBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMenuIsMutable(); menu_.add(index, value); onChanged(); } else { menuBuilder_.addMessage(index, value); } return this; } /** * repeated .ChannelMenu menu = 12; */ public Builder addMenu( cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder builderForValue) { if (menuBuilder_ == null) { ensureMenuIsMutable(); menu_.add(builderForValue.build()); onChanged(); } else { menuBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .ChannelMenu menu = 12; */ public Builder addMenu( int index, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder builderForValue) { if (menuBuilder_ == null) { ensureMenuIsMutable(); menu_.add(index, builderForValue.build()); onChanged(); } else { menuBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .ChannelMenu menu = 12; */ public Builder addAllMenu( java.lang.Iterable values) { if (menuBuilder_ == null) { ensureMenuIsMutable(); super.addAll(values, menu_); onChanged(); } else { menuBuilder_.addAllMessages(values); } return this; } /** * repeated .ChannelMenu menu = 12; */ public Builder clearMenu() { if (menuBuilder_ == null) { menu_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000800); onChanged(); } else { menuBuilder_.clear(); } return this; } /** * repeated .ChannelMenu menu = 12; */ public Builder removeMenu(int index) { if (menuBuilder_ == null) { ensureMenuIsMutable(); menu_.remove(index); onChanged(); } else { menuBuilder_.remove(index); } return this; } /** * repeated .ChannelMenu menu = 12; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder getMenuBuilder( int index) { return getMenuFieldBuilder().getBuilder(index); } /** * repeated .ChannelMenu menu = 12; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder getMenuOrBuilder( int index) { if (menuBuilder_ == null) { return menu_.get(index); } else { return menuBuilder_.getMessageOrBuilder(index); } } /** * repeated .ChannelMenu menu = 12; */ public java.util.List getMenuOrBuilderList() { if (menuBuilder_ != null) { return menuBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(menu_); } } /** * repeated .ChannelMenu menu = 12; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder addMenuBuilder() { return getMenuFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.ChannelMenu.getDefaultInstance()); } /** * repeated .ChannelMenu menu = 12; */ public cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder addMenuBuilder( int index) { return getMenuFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.ChannelMenu.getDefaultInstance()); } /** * repeated .ChannelMenu menu = 12; */ public java.util.List getMenuBuilderList() { return getMenuFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.ChannelMenu, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder, cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder> getMenuFieldBuilder() { if (menuBuilder_ == null) { menuBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.ChannelMenu, cn.wildfirechat.proto.WFCMessage.ChannelMenu.Builder, cn.wildfirechat.proto.WFCMessage.ChannelMenuOrBuilder>( menu_, ((bitField0_ & 0x00000800) == 0x00000800), getParentForChildren(), isClean()); menu_ = null; } return menuBuilder_; } // @@protoc_insertion_point(builder_scope:ChannelInfo) } static { defaultInstance = new ChannelInfo(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ChannelInfo) } public interface ModifyChannelInfoOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string channel_id = 1; /** * required string channel_id = 1; */ boolean hasChannelId(); /** * required string channel_id = 1; */ java.lang.String getChannelId(); /** * required string channel_id = 1; */ com.google.protobuf.ByteString getChannelIdBytes(); // required int32 type = 2; /** * required int32 type = 2; */ boolean hasType(); /** * required int32 type = 2; */ int getType(); // required string value = 3; /** * required string value = 3; */ boolean hasValue(); /** * required string value = 3; */ java.lang.String getValue(); /** * required string value = 3; */ com.google.protobuf.ByteString getValueBytes(); } /** * Protobuf type {@code ModifyChannelInfo} */ public static final class ModifyChannelInfo extends com.google.protobuf.GeneratedMessage implements ModifyChannelInfoOrBuilder { // Use ModifyChannelInfo.newBuilder() to construct. private ModifyChannelInfo(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ModifyChannelInfo(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ModifyChannelInfo defaultInstance; public static ModifyChannelInfo getDefaultInstance() { return defaultInstance; } public ModifyChannelInfo getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ModifyChannelInfo( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; channelId_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; type_ = input.readInt32(); break; } case 26: { bitField0_ |= 0x00000004; value_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyChannelInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyChannelInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo.class, cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ModifyChannelInfo parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ModifyChannelInfo(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string channel_id = 1; public static final int CHANNEL_ID_FIELD_NUMBER = 1; private java.lang.Object channelId_; /** * required string channel_id = 1; */ public boolean hasChannelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string channel_id = 1; */ public java.lang.String getChannelId() { java.lang.Object ref = channelId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { channelId_ = s; } return s; } } /** * required string channel_id = 1; */ public com.google.protobuf.ByteString getChannelIdBytes() { java.lang.Object ref = channelId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); channelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 type = 2; public static final int TYPE_FIELD_NUMBER = 2; private int type_; /** * required int32 type = 2; */ public boolean hasType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 type = 2; */ public int getType() { return type_; } // required string value = 3; public static final int VALUE_FIELD_NUMBER = 3; private java.lang.Object value_; /** * required string value = 3; */ public boolean hasValue() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string value = 3; */ public java.lang.String getValue() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { value_ = s; } return s; } } /** * required string value = 3; */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { channelId_ = ""; type_ = 0; value_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasChannelId()) { memoizedIsInitialized = 0; return false; } if (!hasType()) { memoizedIsInitialized = 0; return false; } if (!hasValue()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getChannelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, type_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getValueBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getChannelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, type_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getValueBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ModifyChannelInfo} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ModifyChannelInfoOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyChannelInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyChannelInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo.class, cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); channelId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); type_ = 0; bitField0_ = (bitField0_ & ~0x00000002); value_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyChannelInfo_descriptor; } public cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo build() { cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo buildPartial() { cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo result = new cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.channelId_ = channelId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.type_ = type_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.value_ = value_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo other) { if (other == cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo.getDefaultInstance()) return this; if (other.hasChannelId()) { bitField0_ |= 0x00000001; channelId_ = other.channelId_; onChanged(); } if (other.hasType()) { setType(other.getType()); } if (other.hasValue()) { bitField0_ |= 0x00000004; value_ = other.value_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasChannelId()) { return false; } if (!hasType()) { return false; } if (!hasValue()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ModifyChannelInfo) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string channel_id = 1; private java.lang.Object channelId_ = ""; /** * required string channel_id = 1; */ public boolean hasChannelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string channel_id = 1; */ public java.lang.String getChannelId() { java.lang.Object ref = channelId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); channelId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string channel_id = 1; */ public com.google.protobuf.ByteString getChannelIdBytes() { java.lang.Object ref = channelId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); channelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string channel_id = 1; */ public Builder setChannelId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; channelId_ = value; onChanged(); return this; } /** * required string channel_id = 1; */ public Builder clearChannelId() { bitField0_ = (bitField0_ & ~0x00000001); channelId_ = getDefaultInstance().getChannelId(); onChanged(); return this; } /** * required string channel_id = 1; */ public Builder setChannelIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; channelId_ = value; onChanged(); return this; } // required int32 type = 2; private int type_ ; /** * required int32 type = 2; */ public boolean hasType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 type = 2; */ public int getType() { return type_; } /** * required int32 type = 2; */ public Builder setType(int value) { bitField0_ |= 0x00000002; type_ = value; onChanged(); return this; } /** * required int32 type = 2; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000002); type_ = 0; onChanged(); return this; } // required string value = 3; private java.lang.Object value_ = ""; /** * required string value = 3; */ public boolean hasValue() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string value = 3; */ public java.lang.String getValue() { java.lang.Object ref = value_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); value_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string value = 3; */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string value = 3; */ public Builder setValue( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; value_ = value; onChanged(); return this; } /** * required string value = 3; */ public Builder clearValue() { bitField0_ = (bitField0_ & ~0x00000004); value_ = getDefaultInstance().getValue(); onChanged(); return this; } /** * required string value = 3; */ public Builder setValueBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; value_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:ModifyChannelInfo) } static { defaultInstance = new ModifyChannelInfo(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ModifyChannelInfo) } public interface TransferChannelOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string channel_id = 1; /** * required string channel_id = 1; */ boolean hasChannelId(); /** * required string channel_id = 1; */ java.lang.String getChannelId(); /** * required string channel_id = 1; */ com.google.protobuf.ByteString getChannelIdBytes(); // required string new_owner = 2; /** * required string new_owner = 2; */ boolean hasNewOwner(); /** * required string new_owner = 2; */ java.lang.String getNewOwner(); /** * required string new_owner = 2; */ com.google.protobuf.ByteString getNewOwnerBytes(); } /** * Protobuf type {@code TransferChannel} */ public static final class TransferChannel extends com.google.protobuf.GeneratedMessage implements TransferChannelOrBuilder { // Use TransferChannel.newBuilder() to construct. private TransferChannel(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private TransferChannel(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final TransferChannel defaultInstance; public static TransferChannel getDefaultInstance() { return defaultInstance; } public TransferChannel getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private TransferChannel( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; channelId_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; newOwner_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_TransferChannel_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_TransferChannel_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.TransferChannel.class, cn.wildfirechat.proto.WFCMessage.TransferChannel.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public TransferChannel parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new TransferChannel(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string channel_id = 1; public static final int CHANNEL_ID_FIELD_NUMBER = 1; private java.lang.Object channelId_; /** * required string channel_id = 1; */ public boolean hasChannelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string channel_id = 1; */ public java.lang.String getChannelId() { java.lang.Object ref = channelId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { channelId_ = s; } return s; } } /** * required string channel_id = 1; */ public com.google.protobuf.ByteString getChannelIdBytes() { java.lang.Object ref = channelId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); channelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string new_owner = 2; public static final int NEW_OWNER_FIELD_NUMBER = 2; private java.lang.Object newOwner_; /** * required string new_owner = 2; */ public boolean hasNewOwner() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string new_owner = 2; */ public java.lang.String getNewOwner() { java.lang.Object ref = newOwner_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { newOwner_ = s; } return s; } } /** * required string new_owner = 2; */ public com.google.protobuf.ByteString getNewOwnerBytes() { java.lang.Object ref = newOwner_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); newOwner_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { channelId_ = ""; newOwner_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasChannelId()) { memoizedIsInitialized = 0; return false; } if (!hasNewOwner()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getChannelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getNewOwnerBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getChannelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getNewOwnerBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.TransferChannel parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.TransferChannel parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.TransferChannel parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.TransferChannel parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.TransferChannel parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.TransferChannel parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.TransferChannel parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.TransferChannel parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.TransferChannel parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.TransferChannel parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.TransferChannel prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code TransferChannel} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.TransferChannelOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_TransferChannel_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_TransferChannel_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.TransferChannel.class, cn.wildfirechat.proto.WFCMessage.TransferChannel.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.TransferChannel.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); channelId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); newOwner_ = ""; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_TransferChannel_descriptor; } public cn.wildfirechat.proto.WFCMessage.TransferChannel getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.TransferChannel.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.TransferChannel build() { cn.wildfirechat.proto.WFCMessage.TransferChannel result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.TransferChannel buildPartial() { cn.wildfirechat.proto.WFCMessage.TransferChannel result = new cn.wildfirechat.proto.WFCMessage.TransferChannel(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.channelId_ = channelId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.newOwner_ = newOwner_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.TransferChannel) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.TransferChannel)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.TransferChannel other) { if (other == cn.wildfirechat.proto.WFCMessage.TransferChannel.getDefaultInstance()) return this; if (other.hasChannelId()) { bitField0_ |= 0x00000001; channelId_ = other.channelId_; onChanged(); } if (other.hasNewOwner()) { bitField0_ |= 0x00000002; newOwner_ = other.newOwner_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasChannelId()) { return false; } if (!hasNewOwner()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.TransferChannel parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.TransferChannel) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string channel_id = 1; private java.lang.Object channelId_ = ""; /** * required string channel_id = 1; */ public boolean hasChannelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string channel_id = 1; */ public java.lang.String getChannelId() { java.lang.Object ref = channelId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); channelId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string channel_id = 1; */ public com.google.protobuf.ByteString getChannelIdBytes() { java.lang.Object ref = channelId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); channelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string channel_id = 1; */ public Builder setChannelId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; channelId_ = value; onChanged(); return this; } /** * required string channel_id = 1; */ public Builder clearChannelId() { bitField0_ = (bitField0_ & ~0x00000001); channelId_ = getDefaultInstance().getChannelId(); onChanged(); return this; } /** * required string channel_id = 1; */ public Builder setChannelIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; channelId_ = value; onChanged(); return this; } // required string new_owner = 2; private java.lang.Object newOwner_ = ""; /** * required string new_owner = 2; */ public boolean hasNewOwner() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string new_owner = 2; */ public java.lang.String getNewOwner() { java.lang.Object ref = newOwner_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); newOwner_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string new_owner = 2; */ public com.google.protobuf.ByteString getNewOwnerBytes() { java.lang.Object ref = newOwner_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); newOwner_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string new_owner = 2; */ public Builder setNewOwner( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; newOwner_ = value; onChanged(); return this; } /** * required string new_owner = 2; */ public Builder clearNewOwner() { bitField0_ = (bitField0_ & ~0x00000002); newOwner_ = getDefaultInstance().getNewOwner(); onChanged(); return this; } /** * required string new_owner = 2; */ public Builder setNewOwnerBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; newOwner_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:TransferChannel) } static { defaultInstance = new TransferChannel(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:TransferChannel) } public interface PullChannelInfoOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string channel_id = 1; /** * required string channel_id = 1; */ boolean hasChannelId(); /** * required string channel_id = 1; */ java.lang.String getChannelId(); /** * required string channel_id = 1; */ com.google.protobuf.ByteString getChannelIdBytes(); // required int64 head = 2; /** * required int64 head = 2; */ boolean hasHead(); /** * required int64 head = 2; */ long getHead(); } /** * Protobuf type {@code PullChannelInfo} */ public static final class PullChannelInfo extends com.google.protobuf.GeneratedMessage implements PullChannelInfoOrBuilder { // Use PullChannelInfo.newBuilder() to construct. private PullChannelInfo(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private PullChannelInfo(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final PullChannelInfo defaultInstance; public static PullChannelInfo getDefaultInstance() { return defaultInstance; } public PullChannelInfo getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private PullChannelInfo( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; channelId_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; head_ = input.readInt64(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullChannelInfo.class, cn.wildfirechat.proto.WFCMessage.PullChannelInfo.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public PullChannelInfo parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new PullChannelInfo(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string channel_id = 1; public static final int CHANNEL_ID_FIELD_NUMBER = 1; private java.lang.Object channelId_; /** * required string channel_id = 1; */ public boolean hasChannelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string channel_id = 1; */ public java.lang.String getChannelId() { java.lang.Object ref = channelId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { channelId_ = s; } return s; } } /** * required string channel_id = 1; */ public com.google.protobuf.ByteString getChannelIdBytes() { java.lang.Object ref = channelId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); channelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int64 head = 2; public static final int HEAD_FIELD_NUMBER = 2; private long head_; /** * required int64 head = 2; */ public boolean hasHead() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int64 head = 2; */ public long getHead() { return head_; } private void initFields() { channelId_ = ""; head_ = 0L; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasChannelId()) { memoizedIsInitialized = 0; return false; } if (!hasHead()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getChannelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt64(2, head_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getChannelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(2, head_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.PullChannelInfo parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullChannelInfo parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullChannelInfo parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullChannelInfo parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullChannelInfo parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullChannelInfo parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullChannelInfo parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullChannelInfo parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullChannelInfo parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullChannelInfo parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.PullChannelInfo prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code PullChannelInfo} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.PullChannelInfoOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullChannelInfo.class, cn.wildfirechat.proto.WFCMessage.PullChannelInfo.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.PullChannelInfo.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); channelId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); head_ = 0L; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelInfo_descriptor; } public cn.wildfirechat.proto.WFCMessage.PullChannelInfo getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.PullChannelInfo.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.PullChannelInfo build() { cn.wildfirechat.proto.WFCMessage.PullChannelInfo result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.PullChannelInfo buildPartial() { cn.wildfirechat.proto.WFCMessage.PullChannelInfo result = new cn.wildfirechat.proto.WFCMessage.PullChannelInfo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.channelId_ = channelId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.head_ = head_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.PullChannelInfo) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.PullChannelInfo)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.PullChannelInfo other) { if (other == cn.wildfirechat.proto.WFCMessage.PullChannelInfo.getDefaultInstance()) return this; if (other.hasChannelId()) { bitField0_ |= 0x00000001; channelId_ = other.channelId_; onChanged(); } if (other.hasHead()) { setHead(other.getHead()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasChannelId()) { return false; } if (!hasHead()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.PullChannelInfo parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.PullChannelInfo) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string channel_id = 1; private java.lang.Object channelId_ = ""; /** * required string channel_id = 1; */ public boolean hasChannelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string channel_id = 1; */ public java.lang.String getChannelId() { java.lang.Object ref = channelId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); channelId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string channel_id = 1; */ public com.google.protobuf.ByteString getChannelIdBytes() { java.lang.Object ref = channelId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); channelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string channel_id = 1; */ public Builder setChannelId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; channelId_ = value; onChanged(); return this; } /** * required string channel_id = 1; */ public Builder clearChannelId() { bitField0_ = (bitField0_ & ~0x00000001); channelId_ = getDefaultInstance().getChannelId(); onChanged(); return this; } /** * required string channel_id = 1; */ public Builder setChannelIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; channelId_ = value; onChanged(); return this; } // required int64 head = 2; private long head_ ; /** * required int64 head = 2; */ public boolean hasHead() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int64 head = 2; */ public long getHead() { return head_; } /** * required int64 head = 2; */ public Builder setHead(long value) { bitField0_ |= 0x00000002; head_ = value; onChanged(); return this; } /** * required int64 head = 2; */ public Builder clearHead() { bitField0_ = (bitField0_ & ~0x00000002); head_ = 0L; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:PullChannelInfo) } static { defaultInstance = new PullChannelInfo(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:PullChannelInfo) } public interface PullChannelListenerOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string channel_id = 1; /** * required string channel_id = 1; */ boolean hasChannelId(); /** * required string channel_id = 1; */ java.lang.String getChannelId(); /** * required string channel_id = 1; */ com.google.protobuf.ByteString getChannelIdBytes(); // required int32 offset = 2; /** * required int32 offset = 2; */ boolean hasOffset(); /** * required int32 offset = 2; */ int getOffset(); // required int32 count = 3; /** * required int32 count = 3; */ boolean hasCount(); /** * required int32 count = 3; */ int getCount(); } /** * Protobuf type {@code PullChannelListener} */ public static final class PullChannelListener extends com.google.protobuf.GeneratedMessage implements PullChannelListenerOrBuilder { // Use PullChannelListener.newBuilder() to construct. private PullChannelListener(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private PullChannelListener(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final PullChannelListener defaultInstance; public static PullChannelListener getDefaultInstance() { return defaultInstance; } public PullChannelListener getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private PullChannelListener( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; channelId_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; offset_ = input.readInt32(); break; } case 24: { bitField0_ |= 0x00000004; count_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelListener_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelListener_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullChannelListener.class, cn.wildfirechat.proto.WFCMessage.PullChannelListener.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public PullChannelListener parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new PullChannelListener(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string channel_id = 1; public static final int CHANNEL_ID_FIELD_NUMBER = 1; private java.lang.Object channelId_; /** * required string channel_id = 1; */ public boolean hasChannelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string channel_id = 1; */ public java.lang.String getChannelId() { java.lang.Object ref = channelId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { channelId_ = s; } return s; } } /** * required string channel_id = 1; */ public com.google.protobuf.ByteString getChannelIdBytes() { java.lang.Object ref = channelId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); channelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 offset = 2; public static final int OFFSET_FIELD_NUMBER = 2; private int offset_; /** * required int32 offset = 2; */ public boolean hasOffset() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 offset = 2; */ public int getOffset() { return offset_; } // required int32 count = 3; public static final int COUNT_FIELD_NUMBER = 3; private int count_; /** * required int32 count = 3; */ public boolean hasCount() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int32 count = 3; */ public int getCount() { return count_; } private void initFields() { channelId_ = ""; offset_ = 0; count_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasChannelId()) { memoizedIsInitialized = 0; return false; } if (!hasOffset()) { memoizedIsInitialized = 0; return false; } if (!hasCount()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getChannelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, offset_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(3, count_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getChannelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, offset_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(3, count_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListener parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListener parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListener parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListener parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListener parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListener parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListener parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListener parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListener parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListener parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.PullChannelListener prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code PullChannelListener} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.PullChannelListenerOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelListener_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelListener_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullChannelListener.class, cn.wildfirechat.proto.WFCMessage.PullChannelListener.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.PullChannelListener.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); channelId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); offset_ = 0; bitField0_ = (bitField0_ & ~0x00000002); count_ = 0; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelListener_descriptor; } public cn.wildfirechat.proto.WFCMessage.PullChannelListener getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.PullChannelListener.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.PullChannelListener build() { cn.wildfirechat.proto.WFCMessage.PullChannelListener result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.PullChannelListener buildPartial() { cn.wildfirechat.proto.WFCMessage.PullChannelListener result = new cn.wildfirechat.proto.WFCMessage.PullChannelListener(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.channelId_ = channelId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.offset_ = offset_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.count_ = count_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.PullChannelListener) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.PullChannelListener)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.PullChannelListener other) { if (other == cn.wildfirechat.proto.WFCMessage.PullChannelListener.getDefaultInstance()) return this; if (other.hasChannelId()) { bitField0_ |= 0x00000001; channelId_ = other.channelId_; onChanged(); } if (other.hasOffset()) { setOffset(other.getOffset()); } if (other.hasCount()) { setCount(other.getCount()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasChannelId()) { return false; } if (!hasOffset()) { return false; } if (!hasCount()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.PullChannelListener parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.PullChannelListener) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string channel_id = 1; private java.lang.Object channelId_ = ""; /** * required string channel_id = 1; */ public boolean hasChannelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string channel_id = 1; */ public java.lang.String getChannelId() { java.lang.Object ref = channelId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); channelId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string channel_id = 1; */ public com.google.protobuf.ByteString getChannelIdBytes() { java.lang.Object ref = channelId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); channelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string channel_id = 1; */ public Builder setChannelId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; channelId_ = value; onChanged(); return this; } /** * required string channel_id = 1; */ public Builder clearChannelId() { bitField0_ = (bitField0_ & ~0x00000001); channelId_ = getDefaultInstance().getChannelId(); onChanged(); return this; } /** * required string channel_id = 1; */ public Builder setChannelIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; channelId_ = value; onChanged(); return this; } // required int32 offset = 2; private int offset_ ; /** * required int32 offset = 2; */ public boolean hasOffset() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 offset = 2; */ public int getOffset() { return offset_; } /** * required int32 offset = 2; */ public Builder setOffset(int value) { bitField0_ |= 0x00000002; offset_ = value; onChanged(); return this; } /** * required int32 offset = 2; */ public Builder clearOffset() { bitField0_ = (bitField0_ & ~0x00000002); offset_ = 0; onChanged(); return this; } // required int32 count = 3; private int count_ ; /** * required int32 count = 3; */ public boolean hasCount() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int32 count = 3; */ public int getCount() { return count_; } /** * required int32 count = 3; */ public Builder setCount(int value) { bitField0_ |= 0x00000004; count_ = value; onChanged(); return this; } /** * required int32 count = 3; */ public Builder clearCount() { bitField0_ = (bitField0_ & ~0x00000004); count_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:PullChannelListener) } static { defaultInstance = new PullChannelListener(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:PullChannelListener) } public interface PullChannelListenerResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int32 total_count = 1; /** * required int32 total_count = 1; */ boolean hasTotalCount(); /** * required int32 total_count = 1; */ int getTotalCount(); // required int32 offset = 2; /** * required int32 offset = 2; */ boolean hasOffset(); /** * required int32 offset = 2; */ int getOffset(); // repeated string listener = 3; /** * repeated string listener = 3; */ java.util.List getListenerList(); /** * repeated string listener = 3; */ int getListenerCount(); /** * repeated string listener = 3; */ java.lang.String getListener(int index); /** * repeated string listener = 3; */ com.google.protobuf.ByteString getListenerBytes(int index); } /** * Protobuf type {@code PullChannelListenerResult} */ public static final class PullChannelListenerResult extends com.google.protobuf.GeneratedMessage implements PullChannelListenerResultOrBuilder { // Use PullChannelListenerResult.newBuilder() to construct. private PullChannelListenerResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private PullChannelListenerResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final PullChannelListenerResult defaultInstance; public static PullChannelListenerResult getDefaultInstance() { return defaultInstance; } public PullChannelListenerResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private PullChannelListenerResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; totalCount_ = input.readInt32(); break; } case 16: { bitField0_ |= 0x00000002; offset_ = input.readInt32(); break; } case 26: { if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { listener_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000004; } listener_.add(input.readBytes()); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { listener_ = new com.google.protobuf.UnmodifiableLazyStringList(listener_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelListenerResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelListenerResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult.class, cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public PullChannelListenerResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new PullChannelListenerResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int32 total_count = 1; public static final int TOTAL_COUNT_FIELD_NUMBER = 1; private int totalCount_; /** * required int32 total_count = 1; */ public boolean hasTotalCount() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 total_count = 1; */ public int getTotalCount() { return totalCount_; } // required int32 offset = 2; public static final int OFFSET_FIELD_NUMBER = 2; private int offset_; /** * required int32 offset = 2; */ public boolean hasOffset() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 offset = 2; */ public int getOffset() { return offset_; } // repeated string listener = 3; public static final int LISTENER_FIELD_NUMBER = 3; private com.google.protobuf.LazyStringList listener_; /** * repeated string listener = 3; */ public java.util.List getListenerList() { return listener_; } /** * repeated string listener = 3; */ public int getListenerCount() { return listener_.size(); } /** * repeated string listener = 3; */ public java.lang.String getListener(int index) { return listener_.get(index); } /** * repeated string listener = 3; */ public com.google.protobuf.ByteString getListenerBytes(int index) { return listener_.getByteString(index); } private void initFields() { totalCount_ = 0; offset_ = 0; listener_ = com.google.protobuf.LazyStringArrayList.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTotalCount()) { memoizedIsInitialized = 0; return false; } if (!hasOffset()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, totalCount_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, offset_); } for (int i = 0; i < listener_.size(); i++) { output.writeBytes(3, listener_.getByteString(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, totalCount_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, offset_); } { int dataSize = 0; for (int i = 0; i < listener_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeBytesSizeNoTag(listener_.getByteString(i)); } size += dataSize; size += 1 * getListenerList().size(); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code PullChannelListenerResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.PullChannelListenerResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelListenerResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelListenerResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult.class, cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); totalCount_ = 0; bitField0_ = (bitField0_ & ~0x00000001); offset_ = 0; bitField0_ = (bitField0_ & ~0x00000002); listener_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullChannelListenerResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult build() { cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult buildPartial() { cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult result = new cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.totalCount_ = totalCount_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.offset_ = offset_; if (((bitField0_ & 0x00000004) == 0x00000004)) { listener_ = new com.google.protobuf.UnmodifiableLazyStringList( listener_); bitField0_ = (bitField0_ & ~0x00000004); } result.listener_ = listener_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult other) { if (other == cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult.getDefaultInstance()) return this; if (other.hasTotalCount()) { setTotalCount(other.getTotalCount()); } if (other.hasOffset()) { setOffset(other.getOffset()); } if (!other.listener_.isEmpty()) { if (listener_.isEmpty()) { listener_ = other.listener_; bitField0_ = (bitField0_ & ~0x00000004); } else { ensureListenerIsMutable(); listener_.addAll(other.listener_); } onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTotalCount()) { return false; } if (!hasOffset()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.PullChannelListenerResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int32 total_count = 1; private int totalCount_ ; /** * required int32 total_count = 1; */ public boolean hasTotalCount() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 total_count = 1; */ public int getTotalCount() { return totalCount_; } /** * required int32 total_count = 1; */ public Builder setTotalCount(int value) { bitField0_ |= 0x00000001; totalCount_ = value; onChanged(); return this; } /** * required int32 total_count = 1; */ public Builder clearTotalCount() { bitField0_ = (bitField0_ & ~0x00000001); totalCount_ = 0; onChanged(); return this; } // required int32 offset = 2; private int offset_ ; /** * required int32 offset = 2; */ public boolean hasOffset() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 offset = 2; */ public int getOffset() { return offset_; } /** * required int32 offset = 2; */ public Builder setOffset(int value) { bitField0_ |= 0x00000002; offset_ = value; onChanged(); return this; } /** * required int32 offset = 2; */ public Builder clearOffset() { bitField0_ = (bitField0_ & ~0x00000002); offset_ = 0; onChanged(); return this; } // repeated string listener = 3; private com.google.protobuf.LazyStringList listener_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureListenerIsMutable() { if (!((bitField0_ & 0x00000004) == 0x00000004)) { listener_ = new com.google.protobuf.LazyStringArrayList(listener_); bitField0_ |= 0x00000004; } } /** * repeated string listener = 3; */ public java.util.List getListenerList() { return java.util.Collections.unmodifiableList(listener_); } /** * repeated string listener = 3; */ public int getListenerCount() { return listener_.size(); } /** * repeated string listener = 3; */ public java.lang.String getListener(int index) { return listener_.get(index); } /** * repeated string listener = 3; */ public com.google.protobuf.ByteString getListenerBytes(int index) { return listener_.getByteString(index); } /** * repeated string listener = 3; */ public Builder setListener( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureListenerIsMutable(); listener_.set(index, value); onChanged(); return this; } /** * repeated string listener = 3; */ public Builder addListener( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureListenerIsMutable(); listener_.add(value); onChanged(); return this; } /** * repeated string listener = 3; */ public Builder addAllListener( java.lang.Iterable values) { ensureListenerIsMutable(); super.addAll(values, listener_); onChanged(); return this; } /** * repeated string listener = 3; */ public Builder clearListener() { listener_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } /** * repeated string listener = 3; */ public Builder addListenerBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } ensureListenerIsMutable(); listener_.add(value); onChanged(); return this; } // @@protoc_insertion_point(builder_scope:PullChannelListenerResult) } static { defaultInstance = new PullChannelListenerResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:PullChannelListenerResult) } public interface ListenChannelOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string channel_id = 1; /** * required string channel_id = 1; */ boolean hasChannelId(); /** * required string channel_id = 1; */ java.lang.String getChannelId(); /** * required string channel_id = 1; */ com.google.protobuf.ByteString getChannelIdBytes(); // required int32 listen = 2; /** * required int32 listen = 2; */ boolean hasListen(); /** * required int32 listen = 2; */ int getListen(); } /** * Protobuf type {@code ListenChannel} */ public static final class ListenChannel extends com.google.protobuf.GeneratedMessage implements ListenChannelOrBuilder { // Use ListenChannel.newBuilder() to construct. private ListenChannel(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ListenChannel(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ListenChannel defaultInstance; public static ListenChannel getDefaultInstance() { return defaultInstance; } public ListenChannel getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ListenChannel( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; channelId_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; listen_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ListenChannel_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ListenChannel_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ListenChannel.class, cn.wildfirechat.proto.WFCMessage.ListenChannel.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ListenChannel parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ListenChannel(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string channel_id = 1; public static final int CHANNEL_ID_FIELD_NUMBER = 1; private java.lang.Object channelId_; /** * required string channel_id = 1; */ public boolean hasChannelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string channel_id = 1; */ public java.lang.String getChannelId() { java.lang.Object ref = channelId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { channelId_ = s; } return s; } } /** * required string channel_id = 1; */ public com.google.protobuf.ByteString getChannelIdBytes() { java.lang.Object ref = channelId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); channelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 listen = 2; public static final int LISTEN_FIELD_NUMBER = 2; private int listen_; /** * required int32 listen = 2; */ public boolean hasListen() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 listen = 2; */ public int getListen() { return listen_; } private void initFields() { channelId_ = ""; listen_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasChannelId()) { memoizedIsInitialized = 0; return false; } if (!hasListen()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getChannelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, listen_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getChannelIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, listen_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ListenChannel parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ListenChannel parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ListenChannel parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ListenChannel parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ListenChannel parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ListenChannel parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ListenChannel parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ListenChannel parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ListenChannel parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ListenChannel parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ListenChannel prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ListenChannel} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ListenChannelOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ListenChannel_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ListenChannel_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ListenChannel.class, cn.wildfirechat.proto.WFCMessage.ListenChannel.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ListenChannel.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); channelId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); listen_ = 0; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ListenChannel_descriptor; } public cn.wildfirechat.proto.WFCMessage.ListenChannel getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ListenChannel.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ListenChannel build() { cn.wildfirechat.proto.WFCMessage.ListenChannel result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ListenChannel buildPartial() { cn.wildfirechat.proto.WFCMessage.ListenChannel result = new cn.wildfirechat.proto.WFCMessage.ListenChannel(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.channelId_ = channelId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.listen_ = listen_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ListenChannel) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ListenChannel)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ListenChannel other) { if (other == cn.wildfirechat.proto.WFCMessage.ListenChannel.getDefaultInstance()) return this; if (other.hasChannelId()) { bitField0_ |= 0x00000001; channelId_ = other.channelId_; onChanged(); } if (other.hasListen()) { setListen(other.getListen()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasChannelId()) { return false; } if (!hasListen()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ListenChannel parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ListenChannel) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string channel_id = 1; private java.lang.Object channelId_ = ""; /** * required string channel_id = 1; */ public boolean hasChannelId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string channel_id = 1; */ public java.lang.String getChannelId() { java.lang.Object ref = channelId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); channelId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string channel_id = 1; */ public com.google.protobuf.ByteString getChannelIdBytes() { java.lang.Object ref = channelId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); channelId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string channel_id = 1; */ public Builder setChannelId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; channelId_ = value; onChanged(); return this; } /** * required string channel_id = 1; */ public Builder clearChannelId() { bitField0_ = (bitField0_ & ~0x00000001); channelId_ = getDefaultInstance().getChannelId(); onChanged(); return this; } /** * required string channel_id = 1; */ public Builder setChannelIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; channelId_ = value; onChanged(); return this; } // required int32 listen = 2; private int listen_ ; /** * required int32 listen = 2; */ public boolean hasListen() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 listen = 2; */ public int getListen() { return listen_; } /** * required int32 listen = 2; */ public Builder setListen(int value) { bitField0_ |= 0x00000002; listen_ = value; onChanged(); return this; } /** * required int32 listen = 2; */ public Builder clearListen() { bitField0_ = (bitField0_ & ~0x00000002); listen_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:ListenChannel) } static { defaultInstance = new ListenChannel(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ListenChannel) } public interface SearchChannelResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .ChannelInfo channel = 1; /** * repeated .ChannelInfo channel = 1; */ java.util.List getChannelList(); /** * repeated .ChannelInfo channel = 1; */ cn.wildfirechat.proto.WFCMessage.ChannelInfo getChannel(int index); /** * repeated .ChannelInfo channel = 1; */ int getChannelCount(); /** * repeated .ChannelInfo channel = 1; */ java.util.List getChannelOrBuilderList(); /** * repeated .ChannelInfo channel = 1; */ cn.wildfirechat.proto.WFCMessage.ChannelInfoOrBuilder getChannelOrBuilder( int index); // required string keyword = 2; /** * required string keyword = 2; */ boolean hasKeyword(); /** * required string keyword = 2; */ java.lang.String getKeyword(); /** * required string keyword = 2; */ com.google.protobuf.ByteString getKeywordBytes(); } /** * Protobuf type {@code SearchChannelResult} */ public static final class SearchChannelResult extends com.google.protobuf.GeneratedMessage implements SearchChannelResultOrBuilder { // Use SearchChannelResult.newBuilder() to construct. private SearchChannelResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private SearchChannelResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final SearchChannelResult defaultInstance; public static SearchChannelResult getDefaultInstance() { return defaultInstance; } public SearchChannelResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private SearchChannelResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { channel_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } channel_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.ChannelInfo.PARSER, extensionRegistry)); break; } case 18: { bitField0_ |= 0x00000001; keyword_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { channel_ = java.util.Collections.unmodifiableList(channel_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchChannelResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchChannelResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.SearchChannelResult.class, cn.wildfirechat.proto.WFCMessage.SearchChannelResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public SearchChannelResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new SearchChannelResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // repeated .ChannelInfo channel = 1; public static final int CHANNEL_FIELD_NUMBER = 1; private java.util.List channel_; /** * repeated .ChannelInfo channel = 1; */ public java.util.List getChannelList() { return channel_; } /** * repeated .ChannelInfo channel = 1; */ public java.util.List getChannelOrBuilderList() { return channel_; } /** * repeated .ChannelInfo channel = 1; */ public int getChannelCount() { return channel_.size(); } /** * repeated .ChannelInfo channel = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelInfo getChannel(int index) { return channel_.get(index); } /** * repeated .ChannelInfo channel = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelInfoOrBuilder getChannelOrBuilder( int index) { return channel_.get(index); } // required string keyword = 2; public static final int KEYWORD_FIELD_NUMBER = 2; private java.lang.Object keyword_; /** * required string keyword = 2; */ public boolean hasKeyword() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string keyword = 2; */ public java.lang.String getKeyword() { java.lang.Object ref = keyword_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { keyword_ = s; } return s; } } /** * required string keyword = 2; */ public com.google.protobuf.ByteString getKeywordBytes() { java.lang.Object ref = keyword_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); keyword_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { channel_ = java.util.Collections.emptyList(); keyword_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasKeyword()) { memoizedIsInitialized = 0; return false; } for (int i = 0; i < getChannelCount(); i++) { if (!getChannel(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < channel_.size(); i++) { output.writeMessage(1, channel_.get(i)); } if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(2, getKeywordBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < channel_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, channel_.get(i)); } if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getKeywordBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.SearchChannelResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.SearchChannelResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SearchChannelResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.SearchChannelResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SearchChannelResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.SearchChannelResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SearchChannelResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.SearchChannelResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SearchChannelResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.SearchChannelResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.SearchChannelResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code SearchChannelResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.SearchChannelResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchChannelResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchChannelResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.SearchChannelResult.class, cn.wildfirechat.proto.WFCMessage.SearchChannelResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.SearchChannelResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getChannelFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (channelBuilder_ == null) { channel_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { channelBuilder_.clear(); } keyword_ = ""; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchChannelResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.SearchChannelResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.SearchChannelResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.SearchChannelResult build() { cn.wildfirechat.proto.WFCMessage.SearchChannelResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.SearchChannelResult buildPartial() { cn.wildfirechat.proto.WFCMessage.SearchChannelResult result = new cn.wildfirechat.proto.WFCMessage.SearchChannelResult(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (channelBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { channel_ = java.util.Collections.unmodifiableList(channel_); bitField0_ = (bitField0_ & ~0x00000001); } result.channel_ = channel_; } else { result.channel_ = channelBuilder_.build(); } if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000001; } result.keyword_ = keyword_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.SearchChannelResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.SearchChannelResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.SearchChannelResult other) { if (other == cn.wildfirechat.proto.WFCMessage.SearchChannelResult.getDefaultInstance()) return this; if (channelBuilder_ == null) { if (!other.channel_.isEmpty()) { if (channel_.isEmpty()) { channel_ = other.channel_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureChannelIsMutable(); channel_.addAll(other.channel_); } onChanged(); } } else { if (!other.channel_.isEmpty()) { if (channelBuilder_.isEmpty()) { channelBuilder_.dispose(); channelBuilder_ = null; channel_ = other.channel_; bitField0_ = (bitField0_ & ~0x00000001); channelBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getChannelFieldBuilder() : null; } else { channelBuilder_.addAllMessages(other.channel_); } } } if (other.hasKeyword()) { bitField0_ |= 0x00000002; keyword_ = other.keyword_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasKeyword()) { return false; } for (int i = 0; i < getChannelCount(); i++) { if (!getChannel(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.SearchChannelResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.SearchChannelResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .ChannelInfo channel = 1; private java.util.List channel_ = java.util.Collections.emptyList(); private void ensureChannelIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { channel_ = new java.util.ArrayList(channel_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.ChannelInfo, cn.wildfirechat.proto.WFCMessage.ChannelInfo.Builder, cn.wildfirechat.proto.WFCMessage.ChannelInfoOrBuilder> channelBuilder_; /** * repeated .ChannelInfo channel = 1; */ public java.util.List getChannelList() { if (channelBuilder_ == null) { return java.util.Collections.unmodifiableList(channel_); } else { return channelBuilder_.getMessageList(); } } /** * repeated .ChannelInfo channel = 1; */ public int getChannelCount() { if (channelBuilder_ == null) { return channel_.size(); } else { return channelBuilder_.getCount(); } } /** * repeated .ChannelInfo channel = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelInfo getChannel(int index) { if (channelBuilder_ == null) { return channel_.get(index); } else { return channelBuilder_.getMessage(index); } } /** * repeated .ChannelInfo channel = 1; */ public Builder setChannel( int index, cn.wildfirechat.proto.WFCMessage.ChannelInfo value) { if (channelBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureChannelIsMutable(); channel_.set(index, value); onChanged(); } else { channelBuilder_.setMessage(index, value); } return this; } /** * repeated .ChannelInfo channel = 1; */ public Builder setChannel( int index, cn.wildfirechat.proto.WFCMessage.ChannelInfo.Builder builderForValue) { if (channelBuilder_ == null) { ensureChannelIsMutable(); channel_.set(index, builderForValue.build()); onChanged(); } else { channelBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .ChannelInfo channel = 1; */ public Builder addChannel(cn.wildfirechat.proto.WFCMessage.ChannelInfo value) { if (channelBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureChannelIsMutable(); channel_.add(value); onChanged(); } else { channelBuilder_.addMessage(value); } return this; } /** * repeated .ChannelInfo channel = 1; */ public Builder addChannel( int index, cn.wildfirechat.proto.WFCMessage.ChannelInfo value) { if (channelBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureChannelIsMutable(); channel_.add(index, value); onChanged(); } else { channelBuilder_.addMessage(index, value); } return this; } /** * repeated .ChannelInfo channel = 1; */ public Builder addChannel( cn.wildfirechat.proto.WFCMessage.ChannelInfo.Builder builderForValue) { if (channelBuilder_ == null) { ensureChannelIsMutable(); channel_.add(builderForValue.build()); onChanged(); } else { channelBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .ChannelInfo channel = 1; */ public Builder addChannel( int index, cn.wildfirechat.proto.WFCMessage.ChannelInfo.Builder builderForValue) { if (channelBuilder_ == null) { ensureChannelIsMutable(); channel_.add(index, builderForValue.build()); onChanged(); } else { channelBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .ChannelInfo channel = 1; */ public Builder addAllChannel( java.lang.Iterable values) { if (channelBuilder_ == null) { ensureChannelIsMutable(); super.addAll(values, channel_); onChanged(); } else { channelBuilder_.addAllMessages(values); } return this; } /** * repeated .ChannelInfo channel = 1; */ public Builder clearChannel() { if (channelBuilder_ == null) { channel_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { channelBuilder_.clear(); } return this; } /** * repeated .ChannelInfo channel = 1; */ public Builder removeChannel(int index) { if (channelBuilder_ == null) { ensureChannelIsMutable(); channel_.remove(index); onChanged(); } else { channelBuilder_.remove(index); } return this; } /** * repeated .ChannelInfo channel = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelInfo.Builder getChannelBuilder( int index) { return getChannelFieldBuilder().getBuilder(index); } /** * repeated .ChannelInfo channel = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelInfoOrBuilder getChannelOrBuilder( int index) { if (channelBuilder_ == null) { return channel_.get(index); } else { return channelBuilder_.getMessageOrBuilder(index); } } /** * repeated .ChannelInfo channel = 1; */ public java.util.List getChannelOrBuilderList() { if (channelBuilder_ != null) { return channelBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(channel_); } } /** * repeated .ChannelInfo channel = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelInfo.Builder addChannelBuilder() { return getChannelFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.ChannelInfo.getDefaultInstance()); } /** * repeated .ChannelInfo channel = 1; */ public cn.wildfirechat.proto.WFCMessage.ChannelInfo.Builder addChannelBuilder( int index) { return getChannelFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.ChannelInfo.getDefaultInstance()); } /** * repeated .ChannelInfo channel = 1; */ public java.util.List getChannelBuilderList() { return getChannelFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.ChannelInfo, cn.wildfirechat.proto.WFCMessage.ChannelInfo.Builder, cn.wildfirechat.proto.WFCMessage.ChannelInfoOrBuilder> getChannelFieldBuilder() { if (channelBuilder_ == null) { channelBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.ChannelInfo, cn.wildfirechat.proto.WFCMessage.ChannelInfo.Builder, cn.wildfirechat.proto.WFCMessage.ChannelInfoOrBuilder>( channel_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); channel_ = null; } return channelBuilder_; } // required string keyword = 2; private java.lang.Object keyword_ = ""; /** * required string keyword = 2; */ public boolean hasKeyword() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string keyword = 2; */ public java.lang.String getKeyword() { java.lang.Object ref = keyword_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); keyword_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string keyword = 2; */ public com.google.protobuf.ByteString getKeywordBytes() { java.lang.Object ref = keyword_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); keyword_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string keyword = 2; */ public Builder setKeyword( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; keyword_ = value; onChanged(); return this; } /** * required string keyword = 2; */ public Builder clearKeyword() { bitField0_ = (bitField0_ & ~0x00000002); keyword_ = getDefaultInstance().getKeyword(); onChanged(); return this; } /** * required string keyword = 2; */ public Builder setKeywordBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; keyword_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:SearchChannelResult) } static { defaultInstance = new SearchChannelResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:SearchChannelResult) } public interface MessageContentOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int32 type = 1; /** * required int32 type = 1; */ boolean hasType(); /** * required int32 type = 1; */ int getType(); // optional string searchable_content = 2; /** * optional string searchable_content = 2; */ boolean hasSearchableContent(); /** * optional string searchable_content = 2; */ java.lang.String getSearchableContent(); /** * optional string searchable_content = 2; */ com.google.protobuf.ByteString getSearchableContentBytes(); // optional string push_content = 3; /** * optional string push_content = 3; */ boolean hasPushContent(); /** * optional string push_content = 3; */ java.lang.String getPushContent(); /** * optional string push_content = 3; */ com.google.protobuf.ByteString getPushContentBytes(); // optional string content = 4; /** * optional string content = 4; */ boolean hasContent(); /** * optional string content = 4; */ java.lang.String getContent(); /** * optional string content = 4; */ com.google.protobuf.ByteString getContentBytes(); // optional bytes data = 5; /** * optional bytes data = 5; */ boolean hasData(); /** * optional bytes data = 5; */ com.google.protobuf.ByteString getData(); // optional int32 mediaType = 6; /** * optional int32 mediaType = 6; */ boolean hasMediaType(); /** * optional int32 mediaType = 6; */ int getMediaType(); // optional string remoteMediaUrl = 7; /** * optional string remoteMediaUrl = 7; */ boolean hasRemoteMediaUrl(); /** * optional string remoteMediaUrl = 7; */ java.lang.String getRemoteMediaUrl(); /** * optional string remoteMediaUrl = 7; */ com.google.protobuf.ByteString getRemoteMediaUrlBytes(); // optional int32 persist_flag = 8; /** * optional int32 persist_flag = 8; */ boolean hasPersistFlag(); /** * optional int32 persist_flag = 8; */ int getPersistFlag(); // optional int32 expire_duration = 9; /** * optional int32 expire_duration = 9; */ boolean hasExpireDuration(); /** * optional int32 expire_duration = 9; */ int getExpireDuration(); // optional int32 mentioned_type = 10; /** * optional int32 mentioned_type = 10; */ boolean hasMentionedType(); /** * optional int32 mentioned_type = 10; */ int getMentionedType(); // repeated string mentioned_target = 11; /** * repeated string mentioned_target = 11; */ java.util.List getMentionedTargetList(); /** * repeated string mentioned_target = 11; */ int getMentionedTargetCount(); /** * repeated string mentioned_target = 11; */ java.lang.String getMentionedTarget(int index); /** * repeated string mentioned_target = 11; */ com.google.protobuf.ByteString getMentionedTargetBytes(int index); // optional string extra = 12; /** * optional string extra = 12; */ boolean hasExtra(); /** * optional string extra = 12; */ java.lang.String getExtra(); /** * optional string extra = 12; */ com.google.protobuf.ByteString getExtraBytes(); // optional string push_data = 13; /** * optional string push_data = 13; */ boolean hasPushData(); /** * optional string push_data = 13; */ java.lang.String getPushData(); /** * optional string push_data = 13; */ com.google.protobuf.ByteString getPushDataBytes(); } /** * Protobuf type {@code MessageContent} */ public static final class MessageContent extends com.google.protobuf.GeneratedMessage implements MessageContentOrBuilder { // Use MessageContent.newBuilder() to construct. private MessageContent(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private MessageContent(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final MessageContent defaultInstance; public static MessageContent getDefaultInstance() { return defaultInstance; } public MessageContent getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private MessageContent( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; type_ = input.readInt32(); break; } case 18: { bitField0_ |= 0x00000002; searchableContent_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; pushContent_ = input.readBytes(); break; } case 34: { bitField0_ |= 0x00000008; content_ = input.readBytes(); break; } case 42: { bitField0_ |= 0x00000010; data_ = input.readBytes(); break; } case 48: { bitField0_ |= 0x00000020; mediaType_ = input.readInt32(); break; } case 58: { bitField0_ |= 0x00000040; remoteMediaUrl_ = input.readBytes(); break; } case 64: { bitField0_ |= 0x00000080; persistFlag_ = input.readInt32(); break; } case 72: { bitField0_ |= 0x00000100; expireDuration_ = input.readInt32(); break; } case 80: { bitField0_ |= 0x00000200; mentionedType_ = input.readInt32(); break; } case 90: { if (!((mutable_bitField0_ & 0x00000400) == 0x00000400)) { mentionedTarget_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000400; } mentionedTarget_.add(input.readBytes()); break; } case 98: { bitField0_ |= 0x00000400; extra_ = input.readBytes(); break; } case 106: { bitField0_ |= 0x00000800; pushData_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000400) == 0x00000400)) { mentionedTarget_ = new com.google.protobuf.UnmodifiableLazyStringList(mentionedTarget_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_MessageContent_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_MessageContent_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.MessageContent.class, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public MessageContent parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new MessageContent(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int32 type = 1; public static final int TYPE_FIELD_NUMBER = 1; private int type_; /** * required int32 type = 1; */ public boolean hasType() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 type = 1; */ public int getType() { return type_; } // optional string searchable_content = 2; public static final int SEARCHABLE_CONTENT_FIELD_NUMBER = 2; private java.lang.Object searchableContent_; /** * optional string searchable_content = 2; */ public boolean hasSearchableContent() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional string searchable_content = 2; */ public java.lang.String getSearchableContent() { java.lang.Object ref = searchableContent_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { searchableContent_ = s; } return s; } } /** * optional string searchable_content = 2; */ public com.google.protobuf.ByteString getSearchableContentBytes() { java.lang.Object ref = searchableContent_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); searchableContent_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string push_content = 3; public static final int PUSH_CONTENT_FIELD_NUMBER = 3; private java.lang.Object pushContent_; /** * optional string push_content = 3; */ public boolean hasPushContent() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string push_content = 3; */ public java.lang.String getPushContent() { java.lang.Object ref = pushContent_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { pushContent_ = s; } return s; } } /** * optional string push_content = 3; */ public com.google.protobuf.ByteString getPushContentBytes() { java.lang.Object ref = pushContent_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); pushContent_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string content = 4; public static final int CONTENT_FIELD_NUMBER = 4; private java.lang.Object content_; /** * optional string content = 4; */ public boolean hasContent() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string content = 4; */ public java.lang.String getContent() { java.lang.Object ref = content_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { content_ = s; } return s; } } /** * optional string content = 4; */ public com.google.protobuf.ByteString getContentBytes() { java.lang.Object ref = content_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); content_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional bytes data = 5; public static final int DATA_FIELD_NUMBER = 5; private com.google.protobuf.ByteString data_; /** * optional bytes data = 5; */ public boolean hasData() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional bytes data = 5; */ public com.google.protobuf.ByteString getData() { return data_; } // optional int32 mediaType = 6; public static final int MEDIATYPE_FIELD_NUMBER = 6; private int mediaType_; /** * optional int32 mediaType = 6; */ public boolean hasMediaType() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional int32 mediaType = 6; */ public int getMediaType() { return mediaType_; } // optional string remoteMediaUrl = 7; public static final int REMOTEMEDIAURL_FIELD_NUMBER = 7; private java.lang.Object remoteMediaUrl_; /** * optional string remoteMediaUrl = 7; */ public boolean hasRemoteMediaUrl() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string remoteMediaUrl = 7; */ public java.lang.String getRemoteMediaUrl() { java.lang.Object ref = remoteMediaUrl_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { remoteMediaUrl_ = s; } return s; } } /** * optional string remoteMediaUrl = 7; */ public com.google.protobuf.ByteString getRemoteMediaUrlBytes() { java.lang.Object ref = remoteMediaUrl_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); remoteMediaUrl_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 persist_flag = 8; public static final int PERSIST_FLAG_FIELD_NUMBER = 8; private int persistFlag_; /** * optional int32 persist_flag = 8; */ public boolean hasPersistFlag() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional int32 persist_flag = 8; */ public int getPersistFlag() { return persistFlag_; } // optional int32 expire_duration = 9; public static final int EXPIRE_DURATION_FIELD_NUMBER = 9; private int expireDuration_; /** * optional int32 expire_duration = 9; */ public boolean hasExpireDuration() { return ((bitField0_ & 0x00000100) == 0x00000100); } /** * optional int32 expire_duration = 9; */ public int getExpireDuration() { return expireDuration_; } // optional int32 mentioned_type = 10; public static final int MENTIONED_TYPE_FIELD_NUMBER = 10; private int mentionedType_; /** * optional int32 mentioned_type = 10; */ public boolean hasMentionedType() { return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional int32 mentioned_type = 10; */ public int getMentionedType() { return mentionedType_; } // repeated string mentioned_target = 11; public static final int MENTIONED_TARGET_FIELD_NUMBER = 11; private com.google.protobuf.LazyStringList mentionedTarget_; /** * repeated string mentioned_target = 11; */ public java.util.List getMentionedTargetList() { return mentionedTarget_; } /** * repeated string mentioned_target = 11; */ public int getMentionedTargetCount() { return mentionedTarget_.size(); } /** * repeated string mentioned_target = 11; */ public java.lang.String getMentionedTarget(int index) { return mentionedTarget_.get(index); } /** * repeated string mentioned_target = 11; */ public com.google.protobuf.ByteString getMentionedTargetBytes(int index) { return mentionedTarget_.getByteString(index); } // optional string extra = 12; public static final int EXTRA_FIELD_NUMBER = 12; private java.lang.Object extra_; /** * optional string extra = 12; */ public boolean hasExtra() { return ((bitField0_ & 0x00000400) == 0x00000400); } /** * optional string extra = 12; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 12; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string push_data = 13; public static final int PUSH_DATA_FIELD_NUMBER = 13; private java.lang.Object pushData_; /** * optional string push_data = 13; */ public boolean hasPushData() { return ((bitField0_ & 0x00000800) == 0x00000800); } /** * optional string push_data = 13; */ public java.lang.String getPushData() { java.lang.Object ref = pushData_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { pushData_ = s; } return s; } } /** * optional string push_data = 13; */ public com.google.protobuf.ByteString getPushDataBytes() { java.lang.Object ref = pushData_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); pushData_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { type_ = 0; searchableContent_ = ""; pushContent_ = ""; content_ = ""; data_ = com.google.protobuf.ByteString.EMPTY; mediaType_ = 0; remoteMediaUrl_ = ""; persistFlag_ = 0; expireDuration_ = 0; mentionedType_ = 0; mentionedTarget_ = com.google.protobuf.LazyStringArrayList.EMPTY; extra_ = ""; pushData_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasType()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, type_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getSearchableContentBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getPushContentBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getContentBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBytes(5, data_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeInt32(6, mediaType_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, getRemoteMediaUrlBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeInt32(8, persistFlag_); } if (((bitField0_ & 0x00000100) == 0x00000100)) { output.writeInt32(9, expireDuration_); } if (((bitField0_ & 0x00000200) == 0x00000200)) { output.writeInt32(10, mentionedType_); } for (int i = 0; i < mentionedTarget_.size(); i++) { output.writeBytes(11, mentionedTarget_.getByteString(i)); } if (((bitField0_ & 0x00000400) == 0x00000400)) { output.writeBytes(12, getExtraBytes()); } if (((bitField0_ & 0x00000800) == 0x00000800)) { output.writeBytes(13, getPushDataBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, type_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getSearchableContentBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getPushContentBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getContentBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(5, data_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(6, mediaType_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(7, getRemoteMediaUrlBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(8, persistFlag_); } if (((bitField0_ & 0x00000100) == 0x00000100)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(9, expireDuration_); } if (((bitField0_ & 0x00000200) == 0x00000200)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(10, mentionedType_); } { int dataSize = 0; for (int i = 0; i < mentionedTarget_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeBytesSizeNoTag(mentionedTarget_.getByteString(i)); } size += dataSize; size += 1 * getMentionedTargetList().size(); } if (((bitField0_ & 0x00000400) == 0x00000400)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(12, getExtraBytes()); } if (((bitField0_ & 0x00000800) == 0x00000800)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(13, getPushDataBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.MessageContent parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.MessageContent parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.MessageContent parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.MessageContent parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.MessageContent parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.MessageContent parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.MessageContent parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.MessageContent parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.MessageContent parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.MessageContent parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.MessageContent prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code MessageContent} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_MessageContent_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_MessageContent_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.MessageContent.class, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); type_ = 0; bitField0_ = (bitField0_ & ~0x00000001); searchableContent_ = ""; bitField0_ = (bitField0_ & ~0x00000002); pushContent_ = ""; bitField0_ = (bitField0_ & ~0x00000004); content_ = ""; bitField0_ = (bitField0_ & ~0x00000008); data_ = com.google.protobuf.ByteString.EMPTY; bitField0_ = (bitField0_ & ~0x00000010); mediaType_ = 0; bitField0_ = (bitField0_ & ~0x00000020); remoteMediaUrl_ = ""; bitField0_ = (bitField0_ & ~0x00000040); persistFlag_ = 0; bitField0_ = (bitField0_ & ~0x00000080); expireDuration_ = 0; bitField0_ = (bitField0_ & ~0x00000100); mentionedType_ = 0; bitField0_ = (bitField0_ & ~0x00000200); mentionedTarget_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000400); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000800); pushData_ = ""; bitField0_ = (bitField0_ & ~0x00001000); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_MessageContent_descriptor; } public cn.wildfirechat.proto.WFCMessage.MessageContent getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.MessageContent build() { cn.wildfirechat.proto.WFCMessage.MessageContent result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.MessageContent buildPartial() { cn.wildfirechat.proto.WFCMessage.MessageContent result = new cn.wildfirechat.proto.WFCMessage.MessageContent(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.type_ = type_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.searchableContent_ = searchableContent_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.pushContent_ = pushContent_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.content_ = content_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.data_ = data_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.mediaType_ = mediaType_; if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000040; } result.remoteMediaUrl_ = remoteMediaUrl_; if (((from_bitField0_ & 0x00000080) == 0x00000080)) { to_bitField0_ |= 0x00000080; } result.persistFlag_ = persistFlag_; if (((from_bitField0_ & 0x00000100) == 0x00000100)) { to_bitField0_ |= 0x00000100; } result.expireDuration_ = expireDuration_; if (((from_bitField0_ & 0x00000200) == 0x00000200)) { to_bitField0_ |= 0x00000200; } result.mentionedType_ = mentionedType_; if (((bitField0_ & 0x00000400) == 0x00000400)) { mentionedTarget_ = new com.google.protobuf.UnmodifiableLazyStringList( mentionedTarget_); bitField0_ = (bitField0_ & ~0x00000400); } result.mentionedTarget_ = mentionedTarget_; if (((from_bitField0_ & 0x00000800) == 0x00000800)) { to_bitField0_ |= 0x00000400; } result.extra_ = extra_; if (((from_bitField0_ & 0x00001000) == 0x00001000)) { to_bitField0_ |= 0x00000800; } result.pushData_ = pushData_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.MessageContent) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.MessageContent)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.MessageContent other) { if (other == cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) return this; if (other.hasType()) { setType(other.getType()); } if (other.hasSearchableContent()) { bitField0_ |= 0x00000002; searchableContent_ = other.searchableContent_; onChanged(); } if (other.hasPushContent()) { bitField0_ |= 0x00000004; pushContent_ = other.pushContent_; onChanged(); } if (other.hasContent()) { bitField0_ |= 0x00000008; content_ = other.content_; onChanged(); } if (other.hasData()) { setData(other.getData()); } if (other.hasMediaType()) { setMediaType(other.getMediaType()); } if (other.hasRemoteMediaUrl()) { bitField0_ |= 0x00000040; remoteMediaUrl_ = other.remoteMediaUrl_; onChanged(); } if (other.hasPersistFlag()) { setPersistFlag(other.getPersistFlag()); } if (other.hasExpireDuration()) { setExpireDuration(other.getExpireDuration()); } if (other.hasMentionedType()) { setMentionedType(other.getMentionedType()); } if (!other.mentionedTarget_.isEmpty()) { if (mentionedTarget_.isEmpty()) { mentionedTarget_ = other.mentionedTarget_; bitField0_ = (bitField0_ & ~0x00000400); } else { ensureMentionedTargetIsMutable(); mentionedTarget_.addAll(other.mentionedTarget_); } onChanged(); } if (other.hasExtra()) { bitField0_ |= 0x00000800; extra_ = other.extra_; onChanged(); } if (other.hasPushData()) { bitField0_ |= 0x00001000; pushData_ = other.pushData_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasType()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.MessageContent parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.MessageContent) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int32 type = 1; private int type_ ; /** * required int32 type = 1; */ public boolean hasType() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 type = 1; */ public int getType() { return type_; } /** * required int32 type = 1; */ public Builder setType(int value) { bitField0_ |= 0x00000001; type_ = value; onChanged(); return this; } /** * required int32 type = 1; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000001); type_ = 0; onChanged(); return this; } // optional string searchable_content = 2; private java.lang.Object searchableContent_ = ""; /** * optional string searchable_content = 2; */ public boolean hasSearchableContent() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional string searchable_content = 2; */ public java.lang.String getSearchableContent() { java.lang.Object ref = searchableContent_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); searchableContent_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string searchable_content = 2; */ public com.google.protobuf.ByteString getSearchableContentBytes() { java.lang.Object ref = searchableContent_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); searchableContent_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string searchable_content = 2; */ public Builder setSearchableContent( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; searchableContent_ = value; onChanged(); return this; } /** * optional string searchable_content = 2; */ public Builder clearSearchableContent() { bitField0_ = (bitField0_ & ~0x00000002); searchableContent_ = getDefaultInstance().getSearchableContent(); onChanged(); return this; } /** * optional string searchable_content = 2; */ public Builder setSearchableContentBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; searchableContent_ = value; onChanged(); return this; } // optional string push_content = 3; private java.lang.Object pushContent_ = ""; /** * optional string push_content = 3; */ public boolean hasPushContent() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string push_content = 3; */ public java.lang.String getPushContent() { java.lang.Object ref = pushContent_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); pushContent_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string push_content = 3; */ public com.google.protobuf.ByteString getPushContentBytes() { java.lang.Object ref = pushContent_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); pushContent_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string push_content = 3; */ public Builder setPushContent( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; pushContent_ = value; onChanged(); return this; } /** * optional string push_content = 3; */ public Builder clearPushContent() { bitField0_ = (bitField0_ & ~0x00000004); pushContent_ = getDefaultInstance().getPushContent(); onChanged(); return this; } /** * optional string push_content = 3; */ public Builder setPushContentBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; pushContent_ = value; onChanged(); return this; } // optional string content = 4; private java.lang.Object content_ = ""; /** * optional string content = 4; */ public boolean hasContent() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string content = 4; */ public java.lang.String getContent() { java.lang.Object ref = content_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); content_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string content = 4; */ public com.google.protobuf.ByteString getContentBytes() { java.lang.Object ref = content_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); content_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string content = 4; */ public Builder setContent( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; content_ = value; onChanged(); return this; } /** * optional string content = 4; */ public Builder clearContent() { bitField0_ = (bitField0_ & ~0x00000008); content_ = getDefaultInstance().getContent(); onChanged(); return this; } /** * optional string content = 4; */ public Builder setContentBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; content_ = value; onChanged(); return this; } // optional bytes data = 5; private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY; /** * optional bytes data = 5; */ public boolean hasData() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional bytes data = 5; */ public com.google.protobuf.ByteString getData() { return data_; } /** * optional bytes data = 5; */ public Builder setData(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; data_ = value; onChanged(); return this; } /** * optional bytes data = 5; */ public Builder clearData() { bitField0_ = (bitField0_ & ~0x00000010); data_ = getDefaultInstance().getData(); onChanged(); return this; } // optional int32 mediaType = 6; private int mediaType_ ; /** * optional int32 mediaType = 6; */ public boolean hasMediaType() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional int32 mediaType = 6; */ public int getMediaType() { return mediaType_; } /** * optional int32 mediaType = 6; */ public Builder setMediaType(int value) { bitField0_ |= 0x00000020; mediaType_ = value; onChanged(); return this; } /** * optional int32 mediaType = 6; */ public Builder clearMediaType() { bitField0_ = (bitField0_ & ~0x00000020); mediaType_ = 0; onChanged(); return this; } // optional string remoteMediaUrl = 7; private java.lang.Object remoteMediaUrl_ = ""; /** * optional string remoteMediaUrl = 7; */ public boolean hasRemoteMediaUrl() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string remoteMediaUrl = 7; */ public java.lang.String getRemoteMediaUrl() { java.lang.Object ref = remoteMediaUrl_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); remoteMediaUrl_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string remoteMediaUrl = 7; */ public com.google.protobuf.ByteString getRemoteMediaUrlBytes() { java.lang.Object ref = remoteMediaUrl_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); remoteMediaUrl_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string remoteMediaUrl = 7; */ public Builder setRemoteMediaUrl( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; remoteMediaUrl_ = value; onChanged(); return this; } /** * optional string remoteMediaUrl = 7; */ public Builder clearRemoteMediaUrl() { bitField0_ = (bitField0_ & ~0x00000040); remoteMediaUrl_ = getDefaultInstance().getRemoteMediaUrl(); onChanged(); return this; } /** * optional string remoteMediaUrl = 7; */ public Builder setRemoteMediaUrlBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; remoteMediaUrl_ = value; onChanged(); return this; } // optional int32 persist_flag = 8; private int persistFlag_ ; /** * optional int32 persist_flag = 8; */ public boolean hasPersistFlag() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional int32 persist_flag = 8; */ public int getPersistFlag() { return persistFlag_; } /** * optional int32 persist_flag = 8; */ public Builder setPersistFlag(int value) { bitField0_ |= 0x00000080; persistFlag_ = value; onChanged(); return this; } /** * optional int32 persist_flag = 8; */ public Builder clearPersistFlag() { bitField0_ = (bitField0_ & ~0x00000080); persistFlag_ = 0; onChanged(); return this; } // optional int32 expire_duration = 9; private int expireDuration_ ; /** * optional int32 expire_duration = 9; */ public boolean hasExpireDuration() { return ((bitField0_ & 0x00000100) == 0x00000100); } /** * optional int32 expire_duration = 9; */ public int getExpireDuration() { return expireDuration_; } /** * optional int32 expire_duration = 9; */ public Builder setExpireDuration(int value) { bitField0_ |= 0x00000100; expireDuration_ = value; onChanged(); return this; } /** * optional int32 expire_duration = 9; */ public Builder clearExpireDuration() { bitField0_ = (bitField0_ & ~0x00000100); expireDuration_ = 0; onChanged(); return this; } // optional int32 mentioned_type = 10; private int mentionedType_ ; /** * optional int32 mentioned_type = 10; */ public boolean hasMentionedType() { return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional int32 mentioned_type = 10; */ public int getMentionedType() { return mentionedType_; } /** * optional int32 mentioned_type = 10; */ public Builder setMentionedType(int value) { bitField0_ |= 0x00000200; mentionedType_ = value; onChanged(); return this; } /** * optional int32 mentioned_type = 10; */ public Builder clearMentionedType() { bitField0_ = (bitField0_ & ~0x00000200); mentionedType_ = 0; onChanged(); return this; } // repeated string mentioned_target = 11; private com.google.protobuf.LazyStringList mentionedTarget_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureMentionedTargetIsMutable() { if (!((bitField0_ & 0x00000400) == 0x00000400)) { mentionedTarget_ = new com.google.protobuf.LazyStringArrayList(mentionedTarget_); bitField0_ |= 0x00000400; } } /** * repeated string mentioned_target = 11; */ public java.util.List getMentionedTargetList() { return java.util.Collections.unmodifiableList(mentionedTarget_); } /** * repeated string mentioned_target = 11; */ public int getMentionedTargetCount() { return mentionedTarget_.size(); } /** * repeated string mentioned_target = 11; */ public java.lang.String getMentionedTarget(int index) { return mentionedTarget_.get(index); } /** * repeated string mentioned_target = 11; */ public com.google.protobuf.ByteString getMentionedTargetBytes(int index) { return mentionedTarget_.getByteString(index); } /** * repeated string mentioned_target = 11; */ public Builder setMentionedTarget( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureMentionedTargetIsMutable(); mentionedTarget_.set(index, value); onChanged(); return this; } /** * repeated string mentioned_target = 11; */ public Builder addMentionedTarget( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureMentionedTargetIsMutable(); mentionedTarget_.add(value); onChanged(); return this; } /** * repeated string mentioned_target = 11; */ public Builder addAllMentionedTarget( java.lang.Iterable values) { ensureMentionedTargetIsMutable(); super.addAll(values, mentionedTarget_); onChanged(); return this; } /** * repeated string mentioned_target = 11; */ public Builder clearMentionedTarget() { mentionedTarget_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000400); onChanged(); return this; } /** * repeated string mentioned_target = 11; */ public Builder addMentionedTargetBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } ensureMentionedTargetIsMutable(); mentionedTarget_.add(value); onChanged(); return this; } // optional string extra = 12; private java.lang.Object extra_ = ""; /** * optional string extra = 12; */ public boolean hasExtra() { return ((bitField0_ & 0x00000800) == 0x00000800); } /** * optional string extra = 12; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 12; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 12; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000800; extra_ = value; onChanged(); return this; } /** * optional string extra = 12; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000800); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 12; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000800; extra_ = value; onChanged(); return this; } // optional string push_data = 13; private java.lang.Object pushData_ = ""; /** * optional string push_data = 13; */ public boolean hasPushData() { return ((bitField0_ & 0x00001000) == 0x00001000); } /** * optional string push_data = 13; */ public java.lang.String getPushData() { java.lang.Object ref = pushData_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); pushData_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string push_data = 13; */ public com.google.protobuf.ByteString getPushDataBytes() { java.lang.Object ref = pushData_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); pushData_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string push_data = 13; */ public Builder setPushData( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00001000; pushData_ = value; onChanged(); return this; } /** * optional string push_data = 13; */ public Builder clearPushData() { bitField0_ = (bitField0_ & ~0x00001000); pushData_ = getDefaultInstance().getPushData(); onChanged(); return this; } /** * optional string push_data = 13; */ public Builder setPushDataBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00001000; pushData_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:MessageContent) } static { defaultInstance = new MessageContent(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:MessageContent) } public interface AddGroupMemberRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string group_id = 1; /** * required string group_id = 1; */ boolean hasGroupId(); /** * required string group_id = 1; */ java.lang.String getGroupId(); /** * required string group_id = 1; */ com.google.protobuf.ByteString getGroupIdBytes(); // repeated .GroupMember added_member = 2; /** * repeated .GroupMember added_member = 2; */ java.util.List getAddedMemberList(); /** * repeated .GroupMember added_member = 2; */ cn.wildfirechat.proto.WFCMessage.GroupMember getAddedMember(int index); /** * repeated .GroupMember added_member = 2; */ int getAddedMemberCount(); /** * repeated .GroupMember added_member = 2; */ java.util.List getAddedMemberOrBuilderList(); /** * repeated .GroupMember added_member = 2; */ cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder getAddedMemberOrBuilder( int index); // repeated int32 to_line = 3; /** * repeated int32 to_line = 3; */ java.util.List getToLineList(); /** * repeated int32 to_line = 3; */ int getToLineCount(); /** * repeated int32 to_line = 3; */ int getToLine(int index); // optional .MessageContent notify_content = 4; /** * optional .MessageContent notify_content = 4; */ boolean hasNotifyContent(); /** * optional .MessageContent notify_content = 4; */ cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent(); /** * optional .MessageContent notify_content = 4; */ cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder(); // optional string extra = 5; /** * optional string extra = 5; */ boolean hasExtra(); /** * optional string extra = 5; */ java.lang.String getExtra(); /** * optional string extra = 5; */ com.google.protobuf.ByteString getExtraBytes(); } /** * Protobuf type {@code AddGroupMemberRequest} */ public static final class AddGroupMemberRequest extends com.google.protobuf.GeneratedMessage implements AddGroupMemberRequestOrBuilder { // Use AddGroupMemberRequest.newBuilder() to construct. private AddGroupMemberRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private AddGroupMemberRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final AddGroupMemberRequest defaultInstance; public static AddGroupMemberRequest getDefaultInstance() { return defaultInstance; } public AddGroupMemberRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private AddGroupMemberRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; groupId_ = input.readBytes(); break; } case 18: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { addedMember_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; } addedMember_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.GroupMember.PARSER, extensionRegistry)); break; } case 24: { if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } toLine_.add(input.readInt32()); break; } case 26: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000004) == 0x00000004) && input.getBytesUntilLimit() > 0) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } while (input.getBytesUntilLimit() > 0) { toLine_.add(input.readInt32()); } input.popLimit(limit); break; } case 34: { cn.wildfirechat.proto.WFCMessage.MessageContent.Builder subBuilder = null; if (((bitField0_ & 0x00000002) == 0x00000002)) { subBuilder = notifyContent_.toBuilder(); } notifyContent_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.MessageContent.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(notifyContent_); notifyContent_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000002; break; } case 42: { bitField0_ |= 0x00000004; extra_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { addedMember_ = java.util.Collections.unmodifiableList(addedMember_); } if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_AddGroupMemberRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_AddGroupMemberRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest.class, cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public AddGroupMemberRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new AddGroupMemberRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string group_id = 1; public static final int GROUP_ID_FIELD_NUMBER = 1; private java.lang.Object groupId_; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { groupId_ = s; } return s; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // repeated .GroupMember added_member = 2; public static final int ADDED_MEMBER_FIELD_NUMBER = 2; private java.util.List addedMember_; /** * repeated .GroupMember added_member = 2; */ public java.util.List getAddedMemberList() { return addedMember_; } /** * repeated .GroupMember added_member = 2; */ public java.util.List getAddedMemberOrBuilderList() { return addedMember_; } /** * repeated .GroupMember added_member = 2; */ public int getAddedMemberCount() { return addedMember_.size(); } /** * repeated .GroupMember added_member = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMember getAddedMember(int index) { return addedMember_.get(index); } /** * repeated .GroupMember added_member = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder getAddedMemberOrBuilder( int index) { return addedMember_.get(index); } // repeated int32 to_line = 3; public static final int TO_LINE_FIELD_NUMBER = 3; private java.util.List toLine_; /** * repeated int32 to_line = 3; */ public java.util.List getToLineList() { return toLine_; } /** * repeated int32 to_line = 3; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 3; */ public int getToLine(int index) { return toLine_.get(index); } // optional .MessageContent notify_content = 4; public static final int NOTIFY_CONTENT_FIELD_NUMBER = 4; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_; /** * optional .MessageContent notify_content = 4; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { return notifyContent_; } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { return notifyContent_; } // optional string extra = 5; public static final int EXTRA_FIELD_NUMBER = 5; private java.lang.Object extra_; /** * optional string extra = 5; */ public boolean hasExtra() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string extra = 5; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 5; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { groupId_ = ""; addedMember_ = java.util.Collections.emptyList(); toLine_ = java.util.Collections.emptyList(); notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); extra_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasGroupId()) { memoizedIsInitialized = 0; return false; } for (int i = 0; i < getAddedMemberCount(); i++) { if (!getAddedMember(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getGroupIdBytes()); } for (int i = 0; i < addedMember_.size(); i++) { output.writeMessage(2, addedMember_.get(i)); } for (int i = 0; i < toLine_.size(); i++) { output.writeInt32(3, toLine_.get(i)); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(4, notifyContent_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(5, getExtraBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getGroupIdBytes()); } for (int i = 0; i < addedMember_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, addedMember_.get(i)); } { int dataSize = 0; for (int i = 0; i < toLine_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(toLine_.get(i)); } size += dataSize; size += 1 * getToLineList().size(); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, notifyContent_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(5, getExtraBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code AddGroupMemberRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_AddGroupMemberRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_AddGroupMemberRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest.class, cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getAddedMemberFieldBuilder(); getNotifyContentFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); groupId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); if (addedMemberBuilder_ == null) { addedMember_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); } else { addedMemberBuilder_.clear(); } toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000008); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000010); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_AddGroupMemberRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest build() { cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest result = new cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.groupId_ = groupId_; if (addedMemberBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002)) { addedMember_ = java.util.Collections.unmodifiableList(addedMember_); bitField0_ = (bitField0_ & ~0x00000002); } result.addedMember_ = addedMember_; } else { result.addedMember_ = addedMemberBuilder_.build(); } if (((bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); bitField0_ = (bitField0_ & ~0x00000004); } result.toLine_ = toLine_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000002; } if (notifyContentBuilder_ == null) { result.notifyContent_ = notifyContent_; } else { result.notifyContent_ = notifyContentBuilder_.build(); } if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000004; } result.extra_ = extra_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest.getDefaultInstance()) return this; if (other.hasGroupId()) { bitField0_ |= 0x00000001; groupId_ = other.groupId_; onChanged(); } if (addedMemberBuilder_ == null) { if (!other.addedMember_.isEmpty()) { if (addedMember_.isEmpty()) { addedMember_ = other.addedMember_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureAddedMemberIsMutable(); addedMember_.addAll(other.addedMember_); } onChanged(); } } else { if (!other.addedMember_.isEmpty()) { if (addedMemberBuilder_.isEmpty()) { addedMemberBuilder_.dispose(); addedMemberBuilder_ = null; addedMember_ = other.addedMember_; bitField0_ = (bitField0_ & ~0x00000002); addedMemberBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getAddedMemberFieldBuilder() : null; } else { addedMemberBuilder_.addAllMessages(other.addedMember_); } } } if (!other.toLine_.isEmpty()) { if (toLine_.isEmpty()) { toLine_ = other.toLine_; bitField0_ = (bitField0_ & ~0x00000004); } else { ensureToLineIsMutable(); toLine_.addAll(other.toLine_); } onChanged(); } if (other.hasNotifyContent()) { mergeNotifyContent(other.getNotifyContent()); } if (other.hasExtra()) { bitField0_ |= 0x00000010; extra_ = other.extra_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasGroupId()) { return false; } for (int i = 0; i < getAddedMemberCount(); i++) { if (!getAddedMember(i).isInitialized()) { return false; } } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.AddGroupMemberRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string group_id = 1; private java.lang.Object groupId_ = ""; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); groupId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string group_id = 1; */ public Builder setGroupId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } /** * required string group_id = 1; */ public Builder clearGroupId() { bitField0_ = (bitField0_ & ~0x00000001); groupId_ = getDefaultInstance().getGroupId(); onChanged(); return this; } /** * required string group_id = 1; */ public Builder setGroupIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } // repeated .GroupMember added_member = 2; private java.util.List addedMember_ = java.util.Collections.emptyList(); private void ensureAddedMemberIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { addedMember_ = new java.util.ArrayList(addedMember_); bitField0_ |= 0x00000002; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupMember, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder, cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder> addedMemberBuilder_; /** * repeated .GroupMember added_member = 2; */ public java.util.List getAddedMemberList() { if (addedMemberBuilder_ == null) { return java.util.Collections.unmodifiableList(addedMember_); } else { return addedMemberBuilder_.getMessageList(); } } /** * repeated .GroupMember added_member = 2; */ public int getAddedMemberCount() { if (addedMemberBuilder_ == null) { return addedMember_.size(); } else { return addedMemberBuilder_.getCount(); } } /** * repeated .GroupMember added_member = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMember getAddedMember(int index) { if (addedMemberBuilder_ == null) { return addedMember_.get(index); } else { return addedMemberBuilder_.getMessage(index); } } /** * repeated .GroupMember added_member = 2; */ public Builder setAddedMember( int index, cn.wildfirechat.proto.WFCMessage.GroupMember value) { if (addedMemberBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureAddedMemberIsMutable(); addedMember_.set(index, value); onChanged(); } else { addedMemberBuilder_.setMessage(index, value); } return this; } /** * repeated .GroupMember added_member = 2; */ public Builder setAddedMember( int index, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder builderForValue) { if (addedMemberBuilder_ == null) { ensureAddedMemberIsMutable(); addedMember_.set(index, builderForValue.build()); onChanged(); } else { addedMemberBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .GroupMember added_member = 2; */ public Builder addAddedMember(cn.wildfirechat.proto.WFCMessage.GroupMember value) { if (addedMemberBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureAddedMemberIsMutable(); addedMember_.add(value); onChanged(); } else { addedMemberBuilder_.addMessage(value); } return this; } /** * repeated .GroupMember added_member = 2; */ public Builder addAddedMember( int index, cn.wildfirechat.proto.WFCMessage.GroupMember value) { if (addedMemberBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureAddedMemberIsMutable(); addedMember_.add(index, value); onChanged(); } else { addedMemberBuilder_.addMessage(index, value); } return this; } /** * repeated .GroupMember added_member = 2; */ public Builder addAddedMember( cn.wildfirechat.proto.WFCMessage.GroupMember.Builder builderForValue) { if (addedMemberBuilder_ == null) { ensureAddedMemberIsMutable(); addedMember_.add(builderForValue.build()); onChanged(); } else { addedMemberBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .GroupMember added_member = 2; */ public Builder addAddedMember( int index, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder builderForValue) { if (addedMemberBuilder_ == null) { ensureAddedMemberIsMutable(); addedMember_.add(index, builderForValue.build()); onChanged(); } else { addedMemberBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .GroupMember added_member = 2; */ public Builder addAllAddedMember( java.lang.Iterable values) { if (addedMemberBuilder_ == null) { ensureAddedMemberIsMutable(); super.addAll(values, addedMember_); onChanged(); } else { addedMemberBuilder_.addAllMessages(values); } return this; } /** * repeated .GroupMember added_member = 2; */ public Builder clearAddedMember() { if (addedMemberBuilder_ == null) { addedMember_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); } else { addedMemberBuilder_.clear(); } return this; } /** * repeated .GroupMember added_member = 2; */ public Builder removeAddedMember(int index) { if (addedMemberBuilder_ == null) { ensureAddedMemberIsMutable(); addedMember_.remove(index); onChanged(); } else { addedMemberBuilder_.remove(index); } return this; } /** * repeated .GroupMember added_member = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMember.Builder getAddedMemberBuilder( int index) { return getAddedMemberFieldBuilder().getBuilder(index); } /** * repeated .GroupMember added_member = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder getAddedMemberOrBuilder( int index) { if (addedMemberBuilder_ == null) { return addedMember_.get(index); } else { return addedMemberBuilder_.getMessageOrBuilder(index); } } /** * repeated .GroupMember added_member = 2; */ public java.util.List getAddedMemberOrBuilderList() { if (addedMemberBuilder_ != null) { return addedMemberBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(addedMember_); } } /** * repeated .GroupMember added_member = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMember.Builder addAddedMemberBuilder() { return getAddedMemberFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.GroupMember.getDefaultInstance()); } /** * repeated .GroupMember added_member = 2; */ public cn.wildfirechat.proto.WFCMessage.GroupMember.Builder addAddedMemberBuilder( int index) { return getAddedMemberFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.GroupMember.getDefaultInstance()); } /** * repeated .GroupMember added_member = 2; */ public java.util.List getAddedMemberBuilderList() { return getAddedMemberFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupMember, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder, cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder> getAddedMemberFieldBuilder() { if (addedMemberBuilder_ == null) { addedMemberBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupMember, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder, cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder>( addedMember_, ((bitField0_ & 0x00000002) == 0x00000002), getParentForChildren(), isClean()); addedMember_ = null; } return addedMemberBuilder_; } // repeated int32 to_line = 3; private java.util.List toLine_ = java.util.Collections.emptyList(); private void ensureToLineIsMutable() { if (!((bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = new java.util.ArrayList(toLine_); bitField0_ |= 0x00000004; } } /** * repeated int32 to_line = 3; */ public java.util.List getToLineList() { return java.util.Collections.unmodifiableList(toLine_); } /** * repeated int32 to_line = 3; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 3; */ public int getToLine(int index) { return toLine_.get(index); } /** * repeated int32 to_line = 3; */ public Builder setToLine( int index, int value) { ensureToLineIsMutable(); toLine_.set(index, value); onChanged(); return this; } /** * repeated int32 to_line = 3; */ public Builder addToLine(int value) { ensureToLineIsMutable(); toLine_.add(value); onChanged(); return this; } /** * repeated int32 to_line = 3; */ public Builder addAllToLine( java.lang.Iterable values) { ensureToLineIsMutable(); super.addAll(values, toLine_); onChanged(); return this; } /** * repeated int32 to_line = 3; */ public Builder clearToLine() { toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } // optional .MessageContent notify_content = 4; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> notifyContentBuilder_; /** * optional .MessageContent notify_content = 4; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { if (notifyContentBuilder_ == null) { return notifyContent_; } else { return notifyContentBuilder_.getMessage(); } } /** * optional .MessageContent notify_content = 4; */ public Builder setNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } notifyContent_ = value; onChanged(); } else { notifyContentBuilder_.setMessage(value); } bitField0_ |= 0x00000008; return this; } /** * optional .MessageContent notify_content = 4; */ public Builder setNotifyContent( cn.wildfirechat.proto.WFCMessage.MessageContent.Builder builderForValue) { if (notifyContentBuilder_ == null) { notifyContent_ = builderForValue.build(); onChanged(); } else { notifyContentBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000008; return this; } /** * optional .MessageContent notify_content = 4; */ public Builder mergeNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (((bitField0_ & 0x00000008) == 0x00000008) && notifyContent_ != cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder(notifyContent_).mergeFrom(value).buildPartial(); } else { notifyContent_ = value; } onChanged(); } else { notifyContentBuilder_.mergeFrom(value); } bitField0_ |= 0x00000008; return this; } /** * optional .MessageContent notify_content = 4; */ public Builder clearNotifyContent() { if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); onChanged(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000008); return this; } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContent.Builder getNotifyContentBuilder() { bitField0_ |= 0x00000008; onChanged(); return getNotifyContentFieldBuilder().getBuilder(); } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { if (notifyContentBuilder_ != null) { return notifyContentBuilder_.getMessageOrBuilder(); } else { return notifyContent_; } } /** * optional .MessageContent notify_content = 4; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> getNotifyContentFieldBuilder() { if (notifyContentBuilder_ == null) { notifyContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder>( notifyContent_, getParentForChildren(), isClean()); notifyContent_ = null; } return notifyContentBuilder_; } // optional string extra = 5; private java.lang.Object extra_ = ""; /** * optional string extra = 5; */ public boolean hasExtra() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string extra = 5; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 5; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 5; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; extra_ = value; onChanged(); return this; } /** * optional string extra = 5; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000010); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 5; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; extra_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:AddGroupMemberRequest) } static { defaultInstance = new AddGroupMemberRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:AddGroupMemberRequest) } public interface CreateGroupRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required .Group group = 1; /** * required .Group group = 1; */ boolean hasGroup(); /** * required .Group group = 1; */ cn.wildfirechat.proto.WFCMessage.Group getGroup(); /** * required .Group group = 1; */ cn.wildfirechat.proto.WFCMessage.GroupOrBuilder getGroupOrBuilder(); // repeated int32 to_line = 2; /** * repeated int32 to_line = 2; */ java.util.List getToLineList(); /** * repeated int32 to_line = 2; */ int getToLineCount(); /** * repeated int32 to_line = 2; */ int getToLine(int index); // optional .MessageContent notify_content = 3; /** * optional .MessageContent notify_content = 3; */ boolean hasNotifyContent(); /** * optional .MessageContent notify_content = 3; */ cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent(); /** * optional .MessageContent notify_content = 3; */ cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder(); // optional string member_extra = 4; /** * optional string member_extra = 4; */ boolean hasMemberExtra(); /** * optional string member_extra = 4; */ java.lang.String getMemberExtra(); /** * optional string member_extra = 4; */ com.google.protobuf.ByteString getMemberExtraBytes(); } /** * Protobuf type {@code CreateGroupRequest} */ public static final class CreateGroupRequest extends com.google.protobuf.GeneratedMessage implements CreateGroupRequestOrBuilder { // Use CreateGroupRequest.newBuilder() to construct. private CreateGroupRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private CreateGroupRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final CreateGroupRequest defaultInstance; public static CreateGroupRequest getDefaultInstance() { return defaultInstance; } public CreateGroupRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private CreateGroupRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { cn.wildfirechat.proto.WFCMessage.Group.Builder subBuilder = null; if (((bitField0_ & 0x00000001) == 0x00000001)) { subBuilder = group_.toBuilder(); } group_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.Group.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(group_); group_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000001; break; } case 16: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; } toLine_.add(input.readInt32()); break; } case 18: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000002) == 0x00000002) && input.getBytesUntilLimit() > 0) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; } while (input.getBytesUntilLimit() > 0) { toLine_.add(input.readInt32()); } input.popLimit(limit); break; } case 26: { cn.wildfirechat.proto.WFCMessage.MessageContent.Builder subBuilder = null; if (((bitField0_ & 0x00000002) == 0x00000002)) { subBuilder = notifyContent_.toBuilder(); } notifyContent_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.MessageContent.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(notifyContent_); notifyContent_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000002; break; } case 34: { bitField0_ |= 0x00000004; memberExtra_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_CreateGroupRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_CreateGroupRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.CreateGroupRequest.class, cn.wildfirechat.proto.WFCMessage.CreateGroupRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public CreateGroupRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new CreateGroupRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required .Group group = 1; public static final int GROUP_FIELD_NUMBER = 1; private cn.wildfirechat.proto.WFCMessage.Group group_; /** * required .Group group = 1; */ public boolean hasGroup() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required .Group group = 1; */ public cn.wildfirechat.proto.WFCMessage.Group getGroup() { return group_; } /** * required .Group group = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupOrBuilder getGroupOrBuilder() { return group_; } // repeated int32 to_line = 2; public static final int TO_LINE_FIELD_NUMBER = 2; private java.util.List toLine_; /** * repeated int32 to_line = 2; */ public java.util.List getToLineList() { return toLine_; } /** * repeated int32 to_line = 2; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 2; */ public int getToLine(int index) { return toLine_.get(index); } // optional .MessageContent notify_content = 3; public static final int NOTIFY_CONTENT_FIELD_NUMBER = 3; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_; /** * optional .MessageContent notify_content = 3; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { return notifyContent_; } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { return notifyContent_; } // optional string member_extra = 4; public static final int MEMBER_EXTRA_FIELD_NUMBER = 4; private java.lang.Object memberExtra_; /** * optional string member_extra = 4; */ public boolean hasMemberExtra() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string member_extra = 4; */ public java.lang.String getMemberExtra() { java.lang.Object ref = memberExtra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { memberExtra_ = s; } return s; } } /** * optional string member_extra = 4; */ public com.google.protobuf.ByteString getMemberExtraBytes() { java.lang.Object ref = memberExtra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); memberExtra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { group_ = cn.wildfirechat.proto.WFCMessage.Group.getDefaultInstance(); toLine_ = java.util.Collections.emptyList(); notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); memberExtra_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasGroup()) { memoizedIsInitialized = 0; return false; } if (!getGroup().isInitialized()) { memoizedIsInitialized = 0; return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeMessage(1, group_); } for (int i = 0; i < toLine_.size(); i++) { output.writeInt32(2, toLine_.get(i)); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(3, notifyContent_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(4, getMemberExtraBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, group_); } { int dataSize = 0; for (int i = 0; i < toLine_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(toLine_.get(i)); } size += dataSize; size += 1 * getToLineList().size(); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(3, notifyContent_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getMemberExtraBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.CreateGroupRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.CreateGroupRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.CreateGroupRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.CreateGroupRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.CreateGroupRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.CreateGroupRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.CreateGroupRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.CreateGroupRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.CreateGroupRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.CreateGroupRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.CreateGroupRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code CreateGroupRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.CreateGroupRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_CreateGroupRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_CreateGroupRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.CreateGroupRequest.class, cn.wildfirechat.proto.WFCMessage.CreateGroupRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.CreateGroupRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getGroupFieldBuilder(); getNotifyContentFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (groupBuilder_ == null) { group_ = cn.wildfirechat.proto.WFCMessage.Group.getDefaultInstance(); } else { groupBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000004); memberExtra_ = ""; bitField0_ = (bitField0_ & ~0x00000008); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_CreateGroupRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.CreateGroupRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.CreateGroupRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.CreateGroupRequest build() { cn.wildfirechat.proto.WFCMessage.CreateGroupRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.CreateGroupRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.CreateGroupRequest result = new cn.wildfirechat.proto.WFCMessage.CreateGroupRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } if (groupBuilder_ == null) { result.group_ = group_; } else { result.group_ = groupBuilder_.build(); } if (((bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); bitField0_ = (bitField0_ & ~0x00000002); } result.toLine_ = toLine_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000002; } if (notifyContentBuilder_ == null) { result.notifyContent_ = notifyContent_; } else { result.notifyContent_ = notifyContentBuilder_.build(); } if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000004; } result.memberExtra_ = memberExtra_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.CreateGroupRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.CreateGroupRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.CreateGroupRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.CreateGroupRequest.getDefaultInstance()) return this; if (other.hasGroup()) { mergeGroup(other.getGroup()); } if (!other.toLine_.isEmpty()) { if (toLine_.isEmpty()) { toLine_ = other.toLine_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureToLineIsMutable(); toLine_.addAll(other.toLine_); } onChanged(); } if (other.hasNotifyContent()) { mergeNotifyContent(other.getNotifyContent()); } if (other.hasMemberExtra()) { bitField0_ |= 0x00000008; memberExtra_ = other.memberExtra_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasGroup()) { return false; } if (!getGroup().isInitialized()) { return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.CreateGroupRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.CreateGroupRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required .Group group = 1; private cn.wildfirechat.proto.WFCMessage.Group group_ = cn.wildfirechat.proto.WFCMessage.Group.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.Group, cn.wildfirechat.proto.WFCMessage.Group.Builder, cn.wildfirechat.proto.WFCMessage.GroupOrBuilder> groupBuilder_; /** * required .Group group = 1; */ public boolean hasGroup() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required .Group group = 1; */ public cn.wildfirechat.proto.WFCMessage.Group getGroup() { if (groupBuilder_ == null) { return group_; } else { return groupBuilder_.getMessage(); } } /** * required .Group group = 1; */ public Builder setGroup(cn.wildfirechat.proto.WFCMessage.Group value) { if (groupBuilder_ == null) { if (value == null) { throw new NullPointerException(); } group_ = value; onChanged(); } else { groupBuilder_.setMessage(value); } bitField0_ |= 0x00000001; return this; } /** * required .Group group = 1; */ public Builder setGroup( cn.wildfirechat.proto.WFCMessage.Group.Builder builderForValue) { if (groupBuilder_ == null) { group_ = builderForValue.build(); onChanged(); } else { groupBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000001; return this; } /** * required .Group group = 1; */ public Builder mergeGroup(cn.wildfirechat.proto.WFCMessage.Group value) { if (groupBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && group_ != cn.wildfirechat.proto.WFCMessage.Group.getDefaultInstance()) { group_ = cn.wildfirechat.proto.WFCMessage.Group.newBuilder(group_).mergeFrom(value).buildPartial(); } else { group_ = value; } onChanged(); } else { groupBuilder_.mergeFrom(value); } bitField0_ |= 0x00000001; return this; } /** * required .Group group = 1; */ public Builder clearGroup() { if (groupBuilder_ == null) { group_ = cn.wildfirechat.proto.WFCMessage.Group.getDefaultInstance(); onChanged(); } else { groupBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); return this; } /** * required .Group group = 1; */ public cn.wildfirechat.proto.WFCMessage.Group.Builder getGroupBuilder() { bitField0_ |= 0x00000001; onChanged(); return getGroupFieldBuilder().getBuilder(); } /** * required .Group group = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupOrBuilder getGroupOrBuilder() { if (groupBuilder_ != null) { return groupBuilder_.getMessageOrBuilder(); } else { return group_; } } /** * required .Group group = 1; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.Group, cn.wildfirechat.proto.WFCMessage.Group.Builder, cn.wildfirechat.proto.WFCMessage.GroupOrBuilder> getGroupFieldBuilder() { if (groupBuilder_ == null) { groupBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.Group, cn.wildfirechat.proto.WFCMessage.Group.Builder, cn.wildfirechat.proto.WFCMessage.GroupOrBuilder>( group_, getParentForChildren(), isClean()); group_ = null; } return groupBuilder_; } // repeated int32 to_line = 2; private java.util.List toLine_ = java.util.Collections.emptyList(); private void ensureToLineIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = new java.util.ArrayList(toLine_); bitField0_ |= 0x00000002; } } /** * repeated int32 to_line = 2; */ public java.util.List getToLineList() { return java.util.Collections.unmodifiableList(toLine_); } /** * repeated int32 to_line = 2; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 2; */ public int getToLine(int index) { return toLine_.get(index); } /** * repeated int32 to_line = 2; */ public Builder setToLine( int index, int value) { ensureToLineIsMutable(); toLine_.set(index, value); onChanged(); return this; } /** * repeated int32 to_line = 2; */ public Builder addToLine(int value) { ensureToLineIsMutable(); toLine_.add(value); onChanged(); return this; } /** * repeated int32 to_line = 2; */ public Builder addAllToLine( java.lang.Iterable values) { ensureToLineIsMutable(); super.addAll(values, toLine_); onChanged(); return this; } /** * repeated int32 to_line = 2; */ public Builder clearToLine() { toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } // optional .MessageContent notify_content = 3; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> notifyContentBuilder_; /** * optional .MessageContent notify_content = 3; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { if (notifyContentBuilder_ == null) { return notifyContent_; } else { return notifyContentBuilder_.getMessage(); } } /** * optional .MessageContent notify_content = 3; */ public Builder setNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } notifyContent_ = value; onChanged(); } else { notifyContentBuilder_.setMessage(value); } bitField0_ |= 0x00000004; return this; } /** * optional .MessageContent notify_content = 3; */ public Builder setNotifyContent( cn.wildfirechat.proto.WFCMessage.MessageContent.Builder builderForValue) { if (notifyContentBuilder_ == null) { notifyContent_ = builderForValue.build(); onChanged(); } else { notifyContentBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000004; return this; } /** * optional .MessageContent notify_content = 3; */ public Builder mergeNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004) && notifyContent_ != cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder(notifyContent_).mergeFrom(value).buildPartial(); } else { notifyContent_ = value; } onChanged(); } else { notifyContentBuilder_.mergeFrom(value); } bitField0_ |= 0x00000004; return this; } /** * optional .MessageContent notify_content = 3; */ public Builder clearNotifyContent() { if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); onChanged(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000004); return this; } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent.Builder getNotifyContentBuilder() { bitField0_ |= 0x00000004; onChanged(); return getNotifyContentFieldBuilder().getBuilder(); } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { if (notifyContentBuilder_ != null) { return notifyContentBuilder_.getMessageOrBuilder(); } else { return notifyContent_; } } /** * optional .MessageContent notify_content = 3; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> getNotifyContentFieldBuilder() { if (notifyContentBuilder_ == null) { notifyContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder>( notifyContent_, getParentForChildren(), isClean()); notifyContent_ = null; } return notifyContentBuilder_; } // optional string member_extra = 4; private java.lang.Object memberExtra_ = ""; /** * optional string member_extra = 4; */ public boolean hasMemberExtra() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string member_extra = 4; */ public java.lang.String getMemberExtra() { java.lang.Object ref = memberExtra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); memberExtra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string member_extra = 4; */ public com.google.protobuf.ByteString getMemberExtraBytes() { java.lang.Object ref = memberExtra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); memberExtra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string member_extra = 4; */ public Builder setMemberExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; memberExtra_ = value; onChanged(); return this; } /** * optional string member_extra = 4; */ public Builder clearMemberExtra() { bitField0_ = (bitField0_ & ~0x00000008); memberExtra_ = getDefaultInstance().getMemberExtra(); onChanged(); return this; } /** * optional string member_extra = 4; */ public Builder setMemberExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; memberExtra_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:CreateGroupRequest) } static { defaultInstance = new CreateGroupRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:CreateGroupRequest) } public interface DismissGroupRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string group_id = 1; /** * required string group_id = 1; */ boolean hasGroupId(); /** * required string group_id = 1; */ java.lang.String getGroupId(); /** * required string group_id = 1; */ com.google.protobuf.ByteString getGroupIdBytes(); // repeated int32 to_line = 2; /** * repeated int32 to_line = 2; */ java.util.List getToLineList(); /** * repeated int32 to_line = 2; */ int getToLineCount(); /** * repeated int32 to_line = 2; */ int getToLine(int index); // optional .MessageContent notify_content = 3; /** * optional .MessageContent notify_content = 3; */ boolean hasNotifyContent(); /** * optional .MessageContent notify_content = 3; */ cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent(); /** * optional .MessageContent notify_content = 3; */ cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder(); } /** * Protobuf type {@code DismissGroupRequest} */ public static final class DismissGroupRequest extends com.google.protobuf.GeneratedMessage implements DismissGroupRequestOrBuilder { // Use DismissGroupRequest.newBuilder() to construct. private DismissGroupRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private DismissGroupRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final DismissGroupRequest defaultInstance; public static DismissGroupRequest getDefaultInstance() { return defaultInstance; } public DismissGroupRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private DismissGroupRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; groupId_ = input.readBytes(); break; } case 16: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; } toLine_.add(input.readInt32()); break; } case 18: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000002) == 0x00000002) && input.getBytesUntilLimit() > 0) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; } while (input.getBytesUntilLimit() > 0) { toLine_.add(input.readInt32()); } input.popLimit(limit); break; } case 26: { cn.wildfirechat.proto.WFCMessage.MessageContent.Builder subBuilder = null; if (((bitField0_ & 0x00000002) == 0x00000002)) { subBuilder = notifyContent_.toBuilder(); } notifyContent_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.MessageContent.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(notifyContent_); notifyContent_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000002; break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_DismissGroupRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_DismissGroupRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.DismissGroupRequest.class, cn.wildfirechat.proto.WFCMessage.DismissGroupRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public DismissGroupRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new DismissGroupRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string group_id = 1; public static final int GROUP_ID_FIELD_NUMBER = 1; private java.lang.Object groupId_; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { groupId_ = s; } return s; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // repeated int32 to_line = 2; public static final int TO_LINE_FIELD_NUMBER = 2; private java.util.List toLine_; /** * repeated int32 to_line = 2; */ public java.util.List getToLineList() { return toLine_; } /** * repeated int32 to_line = 2; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 2; */ public int getToLine(int index) { return toLine_.get(index); } // optional .MessageContent notify_content = 3; public static final int NOTIFY_CONTENT_FIELD_NUMBER = 3; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_; /** * optional .MessageContent notify_content = 3; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { return notifyContent_; } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { return notifyContent_; } private void initFields() { groupId_ = ""; toLine_ = java.util.Collections.emptyList(); notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasGroupId()) { memoizedIsInitialized = 0; return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getGroupIdBytes()); } for (int i = 0; i < toLine_.size(); i++) { output.writeInt32(2, toLine_.get(i)); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(3, notifyContent_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getGroupIdBytes()); } { int dataSize = 0; for (int i = 0; i < toLine_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(toLine_.get(i)); } size += dataSize; size += 1 * getToLineList().size(); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(3, notifyContent_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.DismissGroupRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.DismissGroupRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.DismissGroupRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.DismissGroupRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.DismissGroupRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.DismissGroupRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.DismissGroupRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.DismissGroupRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.DismissGroupRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.DismissGroupRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.DismissGroupRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code DismissGroupRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.DismissGroupRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_DismissGroupRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_DismissGroupRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.DismissGroupRequest.class, cn.wildfirechat.proto.WFCMessage.DismissGroupRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.DismissGroupRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getNotifyContentFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); groupId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_DismissGroupRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.DismissGroupRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.DismissGroupRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.DismissGroupRequest build() { cn.wildfirechat.proto.WFCMessage.DismissGroupRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.DismissGroupRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.DismissGroupRequest result = new cn.wildfirechat.proto.WFCMessage.DismissGroupRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.groupId_ = groupId_; if (((bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); bitField0_ = (bitField0_ & ~0x00000002); } result.toLine_ = toLine_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000002; } if (notifyContentBuilder_ == null) { result.notifyContent_ = notifyContent_; } else { result.notifyContent_ = notifyContentBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.DismissGroupRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.DismissGroupRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.DismissGroupRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.DismissGroupRequest.getDefaultInstance()) return this; if (other.hasGroupId()) { bitField0_ |= 0x00000001; groupId_ = other.groupId_; onChanged(); } if (!other.toLine_.isEmpty()) { if (toLine_.isEmpty()) { toLine_ = other.toLine_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureToLineIsMutable(); toLine_.addAll(other.toLine_); } onChanged(); } if (other.hasNotifyContent()) { mergeNotifyContent(other.getNotifyContent()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasGroupId()) { return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.DismissGroupRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.DismissGroupRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string group_id = 1; private java.lang.Object groupId_ = ""; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); groupId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string group_id = 1; */ public Builder setGroupId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } /** * required string group_id = 1; */ public Builder clearGroupId() { bitField0_ = (bitField0_ & ~0x00000001); groupId_ = getDefaultInstance().getGroupId(); onChanged(); return this; } /** * required string group_id = 1; */ public Builder setGroupIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } // repeated int32 to_line = 2; private java.util.List toLine_ = java.util.Collections.emptyList(); private void ensureToLineIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = new java.util.ArrayList(toLine_); bitField0_ |= 0x00000002; } } /** * repeated int32 to_line = 2; */ public java.util.List getToLineList() { return java.util.Collections.unmodifiableList(toLine_); } /** * repeated int32 to_line = 2; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 2; */ public int getToLine(int index) { return toLine_.get(index); } /** * repeated int32 to_line = 2; */ public Builder setToLine( int index, int value) { ensureToLineIsMutable(); toLine_.set(index, value); onChanged(); return this; } /** * repeated int32 to_line = 2; */ public Builder addToLine(int value) { ensureToLineIsMutable(); toLine_.add(value); onChanged(); return this; } /** * repeated int32 to_line = 2; */ public Builder addAllToLine( java.lang.Iterable values) { ensureToLineIsMutable(); super.addAll(values, toLine_); onChanged(); return this; } /** * repeated int32 to_line = 2; */ public Builder clearToLine() { toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } // optional .MessageContent notify_content = 3; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> notifyContentBuilder_; /** * optional .MessageContent notify_content = 3; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { if (notifyContentBuilder_ == null) { return notifyContent_; } else { return notifyContentBuilder_.getMessage(); } } /** * optional .MessageContent notify_content = 3; */ public Builder setNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } notifyContent_ = value; onChanged(); } else { notifyContentBuilder_.setMessage(value); } bitField0_ |= 0x00000004; return this; } /** * optional .MessageContent notify_content = 3; */ public Builder setNotifyContent( cn.wildfirechat.proto.WFCMessage.MessageContent.Builder builderForValue) { if (notifyContentBuilder_ == null) { notifyContent_ = builderForValue.build(); onChanged(); } else { notifyContentBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000004; return this; } /** * optional .MessageContent notify_content = 3; */ public Builder mergeNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004) && notifyContent_ != cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder(notifyContent_).mergeFrom(value).buildPartial(); } else { notifyContent_ = value; } onChanged(); } else { notifyContentBuilder_.mergeFrom(value); } bitField0_ |= 0x00000004; return this; } /** * optional .MessageContent notify_content = 3; */ public Builder clearNotifyContent() { if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); onChanged(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000004); return this; } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent.Builder getNotifyContentBuilder() { bitField0_ |= 0x00000004; onChanged(); return getNotifyContentFieldBuilder().getBuilder(); } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { if (notifyContentBuilder_ != null) { return notifyContentBuilder_.getMessageOrBuilder(); } else { return notifyContent_; } } /** * optional .MessageContent notify_content = 3; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> getNotifyContentFieldBuilder() { if (notifyContentBuilder_ == null) { notifyContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder>( notifyContent_, getParentForChildren(), isClean()); notifyContent_ = null; } return notifyContentBuilder_; } // @@protoc_insertion_point(builder_scope:DismissGroupRequest) } static { defaultInstance = new DismissGroupRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:DismissGroupRequest) } public interface FriendRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // optional string from_uid = 1; /** * optional string from_uid = 1; */ boolean hasFromUid(); /** * optional string from_uid = 1; */ java.lang.String getFromUid(); /** * optional string from_uid = 1; */ com.google.protobuf.ByteString getFromUidBytes(); // required string to_uid = 2; /** * required string to_uid = 2; */ boolean hasToUid(); /** * required string to_uid = 2; */ java.lang.String getToUid(); /** * required string to_uid = 2; */ com.google.protobuf.ByteString getToUidBytes(); // required string reason = 3; /** * required string reason = 3; */ boolean hasReason(); /** * required string reason = 3; */ java.lang.String getReason(); /** * required string reason = 3; */ com.google.protobuf.ByteString getReasonBytes(); // optional int32 status = 4; /** * optional int32 status = 4; */ boolean hasStatus(); /** * optional int32 status = 4; */ int getStatus(); // optional int64 update_dt = 5; /** * optional int64 update_dt = 5; */ boolean hasUpdateDt(); /** * optional int64 update_dt = 5; */ long getUpdateDt(); // optional bool from_read_status = 6; /** * optional bool from_read_status = 6; */ boolean hasFromReadStatus(); /** * optional bool from_read_status = 6; */ boolean getFromReadStatus(); // optional bool to_read_status = 7; /** * optional bool to_read_status = 7; */ boolean hasToReadStatus(); /** * optional bool to_read_status = 7; */ boolean getToReadStatus(); // optional string extra = 8; /** * optional string extra = 8; */ boolean hasExtra(); /** * optional string extra = 8; */ java.lang.String getExtra(); /** * optional string extra = 8; */ com.google.protobuf.ByteString getExtraBytes(); } /** * Protobuf type {@code FriendRequest} */ public static final class FriendRequest extends com.google.protobuf.GeneratedMessage implements FriendRequestOrBuilder { // Use FriendRequest.newBuilder() to construct. private FriendRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private FriendRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final FriendRequest defaultInstance; public static FriendRequest getDefaultInstance() { return defaultInstance; } public FriendRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private FriendRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; fromUid_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; toUid_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; reason_ = input.readBytes(); break; } case 32: { bitField0_ |= 0x00000008; status_ = input.readInt32(); break; } case 40: { bitField0_ |= 0x00000010; updateDt_ = input.readInt64(); break; } case 48: { bitField0_ |= 0x00000020; fromReadStatus_ = input.readBool(); break; } case 56: { bitField0_ |= 0x00000040; toReadStatus_ = input.readBool(); break; } case 66: { bitField0_ |= 0x00000080; extra_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_FriendRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_FriendRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.FriendRequest.class, cn.wildfirechat.proto.WFCMessage.FriendRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public FriendRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new FriendRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // optional string from_uid = 1; public static final int FROM_UID_FIELD_NUMBER = 1; private java.lang.Object fromUid_; /** * optional string from_uid = 1; */ public boolean hasFromUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * optional string from_uid = 1; */ public java.lang.String getFromUid() { java.lang.Object ref = fromUid_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { fromUid_ = s; } return s; } } /** * optional string from_uid = 1; */ public com.google.protobuf.ByteString getFromUidBytes() { java.lang.Object ref = fromUid_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); fromUid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string to_uid = 2; public static final int TO_UID_FIELD_NUMBER = 2; private java.lang.Object toUid_; /** * required string to_uid = 2; */ public boolean hasToUid() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string to_uid = 2; */ public java.lang.String getToUid() { java.lang.Object ref = toUid_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { toUid_ = s; } return s; } } /** * required string to_uid = 2; */ public com.google.protobuf.ByteString getToUidBytes() { java.lang.Object ref = toUid_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); toUid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string reason = 3; public static final int REASON_FIELD_NUMBER = 3; private java.lang.Object reason_; /** * required string reason = 3; */ public boolean hasReason() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string reason = 3; */ public java.lang.String getReason() { java.lang.Object ref = reason_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { reason_ = s; } return s; } } /** * required string reason = 3; */ public com.google.protobuf.ByteString getReasonBytes() { java.lang.Object ref = reason_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); reason_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 status = 4; public static final int STATUS_FIELD_NUMBER = 4; private int status_; /** * optional int32 status = 4; */ public boolean hasStatus() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int32 status = 4; */ public int getStatus() { return status_; } // optional int64 update_dt = 5; public static final int UPDATE_DT_FIELD_NUMBER = 5; private long updateDt_; /** * optional int64 update_dt = 5; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int64 update_dt = 5; */ public long getUpdateDt() { return updateDt_; } // optional bool from_read_status = 6; public static final int FROM_READ_STATUS_FIELD_NUMBER = 6; private boolean fromReadStatus_; /** * optional bool from_read_status = 6; */ public boolean hasFromReadStatus() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional bool from_read_status = 6; */ public boolean getFromReadStatus() { return fromReadStatus_; } // optional bool to_read_status = 7; public static final int TO_READ_STATUS_FIELD_NUMBER = 7; private boolean toReadStatus_; /** * optional bool to_read_status = 7; */ public boolean hasToReadStatus() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional bool to_read_status = 7; */ public boolean getToReadStatus() { return toReadStatus_; } // optional string extra = 8; public static final int EXTRA_FIELD_NUMBER = 8; private java.lang.Object extra_; /** * optional string extra = 8; */ public boolean hasExtra() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional string extra = 8; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 8; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { fromUid_ = ""; toUid_ = ""; reason_ = ""; status_ = 0; updateDt_ = 0L; fromReadStatus_ = false; toReadStatus_ = false; extra_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasToUid()) { memoizedIsInitialized = 0; return false; } if (!hasReason()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getFromUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getToUidBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getReasonBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeInt32(4, status_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeInt64(5, updateDt_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBool(6, fromReadStatus_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBool(7, toReadStatus_); } if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeBytes(8, getExtraBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getFromUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getToUidBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getReasonBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(4, status_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(5, updateDt_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeBoolSize(6, fromReadStatus_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeBoolSize(7, toReadStatus_); } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(8, getExtraBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.FriendRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.FriendRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.FriendRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.FriendRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.FriendRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.FriendRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.FriendRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.FriendRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.FriendRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.FriendRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.FriendRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code FriendRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.FriendRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_FriendRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_FriendRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.FriendRequest.class, cn.wildfirechat.proto.WFCMessage.FriendRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.FriendRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); fromUid_ = ""; bitField0_ = (bitField0_ & ~0x00000001); toUid_ = ""; bitField0_ = (bitField0_ & ~0x00000002); reason_ = ""; bitField0_ = (bitField0_ & ~0x00000004); status_ = 0; bitField0_ = (bitField0_ & ~0x00000008); updateDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000010); fromReadStatus_ = false; bitField0_ = (bitField0_ & ~0x00000020); toReadStatus_ = false; bitField0_ = (bitField0_ & ~0x00000040); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000080); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_FriendRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.FriendRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.FriendRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.FriendRequest build() { cn.wildfirechat.proto.WFCMessage.FriendRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.FriendRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.FriendRequest result = new cn.wildfirechat.proto.WFCMessage.FriendRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.fromUid_ = fromUid_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.toUid_ = toUid_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.reason_ = reason_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.status_ = status_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.updateDt_ = updateDt_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.fromReadStatus_ = fromReadStatus_; if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000040; } result.toReadStatus_ = toReadStatus_; if (((from_bitField0_ & 0x00000080) == 0x00000080)) { to_bitField0_ |= 0x00000080; } result.extra_ = extra_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.FriendRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.FriendRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.FriendRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.FriendRequest.getDefaultInstance()) return this; if (other.hasFromUid()) { bitField0_ |= 0x00000001; fromUid_ = other.fromUid_; onChanged(); } if (other.hasToUid()) { bitField0_ |= 0x00000002; toUid_ = other.toUid_; onChanged(); } if (other.hasReason()) { bitField0_ |= 0x00000004; reason_ = other.reason_; onChanged(); } if (other.hasStatus()) { setStatus(other.getStatus()); } if (other.hasUpdateDt()) { setUpdateDt(other.getUpdateDt()); } if (other.hasFromReadStatus()) { setFromReadStatus(other.getFromReadStatus()); } if (other.hasToReadStatus()) { setToReadStatus(other.getToReadStatus()); } if (other.hasExtra()) { bitField0_ |= 0x00000080; extra_ = other.extra_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasToUid()) { return false; } if (!hasReason()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.FriendRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.FriendRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // optional string from_uid = 1; private java.lang.Object fromUid_ = ""; /** * optional string from_uid = 1; */ public boolean hasFromUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * optional string from_uid = 1; */ public java.lang.String getFromUid() { java.lang.Object ref = fromUid_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); fromUid_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string from_uid = 1; */ public com.google.protobuf.ByteString getFromUidBytes() { java.lang.Object ref = fromUid_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); fromUid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string from_uid = 1; */ public Builder setFromUid( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; fromUid_ = value; onChanged(); return this; } /** * optional string from_uid = 1; */ public Builder clearFromUid() { bitField0_ = (bitField0_ & ~0x00000001); fromUid_ = getDefaultInstance().getFromUid(); onChanged(); return this; } /** * optional string from_uid = 1; */ public Builder setFromUidBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; fromUid_ = value; onChanged(); return this; } // required string to_uid = 2; private java.lang.Object toUid_ = ""; /** * required string to_uid = 2; */ public boolean hasToUid() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string to_uid = 2; */ public java.lang.String getToUid() { java.lang.Object ref = toUid_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); toUid_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string to_uid = 2; */ public com.google.protobuf.ByteString getToUidBytes() { java.lang.Object ref = toUid_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); toUid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string to_uid = 2; */ public Builder setToUid( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; toUid_ = value; onChanged(); return this; } /** * required string to_uid = 2; */ public Builder clearToUid() { bitField0_ = (bitField0_ & ~0x00000002); toUid_ = getDefaultInstance().getToUid(); onChanged(); return this; } /** * required string to_uid = 2; */ public Builder setToUidBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; toUid_ = value; onChanged(); return this; } // required string reason = 3; private java.lang.Object reason_ = ""; /** * required string reason = 3; */ public boolean hasReason() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string reason = 3; */ public java.lang.String getReason() { java.lang.Object ref = reason_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); reason_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string reason = 3; */ public com.google.protobuf.ByteString getReasonBytes() { java.lang.Object ref = reason_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); reason_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string reason = 3; */ public Builder setReason( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; reason_ = value; onChanged(); return this; } /** * required string reason = 3; */ public Builder clearReason() { bitField0_ = (bitField0_ & ~0x00000004); reason_ = getDefaultInstance().getReason(); onChanged(); return this; } /** * required string reason = 3; */ public Builder setReasonBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; reason_ = value; onChanged(); return this; } // optional int32 status = 4; private int status_ ; /** * optional int32 status = 4; */ public boolean hasStatus() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int32 status = 4; */ public int getStatus() { return status_; } /** * optional int32 status = 4; */ public Builder setStatus(int value) { bitField0_ |= 0x00000008; status_ = value; onChanged(); return this; } /** * optional int32 status = 4; */ public Builder clearStatus() { bitField0_ = (bitField0_ & ~0x00000008); status_ = 0; onChanged(); return this; } // optional int64 update_dt = 5; private long updateDt_ ; /** * optional int64 update_dt = 5; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int64 update_dt = 5; */ public long getUpdateDt() { return updateDt_; } /** * optional int64 update_dt = 5; */ public Builder setUpdateDt(long value) { bitField0_ |= 0x00000010; updateDt_ = value; onChanged(); return this; } /** * optional int64 update_dt = 5; */ public Builder clearUpdateDt() { bitField0_ = (bitField0_ & ~0x00000010); updateDt_ = 0L; onChanged(); return this; } // optional bool from_read_status = 6; private boolean fromReadStatus_ ; /** * optional bool from_read_status = 6; */ public boolean hasFromReadStatus() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional bool from_read_status = 6; */ public boolean getFromReadStatus() { return fromReadStatus_; } /** * optional bool from_read_status = 6; */ public Builder setFromReadStatus(boolean value) { bitField0_ |= 0x00000020; fromReadStatus_ = value; onChanged(); return this; } /** * optional bool from_read_status = 6; */ public Builder clearFromReadStatus() { bitField0_ = (bitField0_ & ~0x00000020); fromReadStatus_ = false; onChanged(); return this; } // optional bool to_read_status = 7; private boolean toReadStatus_ ; /** * optional bool to_read_status = 7; */ public boolean hasToReadStatus() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional bool to_read_status = 7; */ public boolean getToReadStatus() { return toReadStatus_; } /** * optional bool to_read_status = 7; */ public Builder setToReadStatus(boolean value) { bitField0_ |= 0x00000040; toReadStatus_ = value; onChanged(); return this; } /** * optional bool to_read_status = 7; */ public Builder clearToReadStatus() { bitField0_ = (bitField0_ & ~0x00000040); toReadStatus_ = false; onChanged(); return this; } // optional string extra = 8; private java.lang.Object extra_ = ""; /** * optional string extra = 8; */ public boolean hasExtra() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional string extra = 8; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 8; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 8; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000080; extra_ = value; onChanged(); return this; } /** * optional string extra = 8; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000080); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 8; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000080; extra_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:FriendRequest) } static { defaultInstance = new FriendRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:FriendRequest) } public interface GeneralResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int32 error_code = 1; /** * required int32 error_code = 1; */ boolean hasErrorCode(); /** * required int32 error_code = 1; */ int getErrorCode(); } /** * Protobuf type {@code GeneralResult} */ public static final class GeneralResult extends com.google.protobuf.GeneratedMessage implements GeneralResultOrBuilder { // Use GeneralResult.newBuilder() to construct. private GeneralResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private GeneralResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final GeneralResult defaultInstance; public static GeneralResult getDefaultInstance() { return defaultInstance; } public GeneralResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GeneralResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; errorCode_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GeneralResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GeneralResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GeneralResult.class, cn.wildfirechat.proto.WFCMessage.GeneralResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public GeneralResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GeneralResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int32 error_code = 1; public static final int ERROR_CODE_FIELD_NUMBER = 1; private int errorCode_; /** * required int32 error_code = 1; */ public boolean hasErrorCode() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 error_code = 1; */ public int getErrorCode() { return errorCode_; } private void initFields() { errorCode_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasErrorCode()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, errorCode_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, errorCode_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.GeneralResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GeneralResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GeneralResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GeneralResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GeneralResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GeneralResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GeneralResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GeneralResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GeneralResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GeneralResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.GeneralResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code GeneralResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GeneralResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GeneralResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GeneralResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GeneralResult.class, cn.wildfirechat.proto.WFCMessage.GeneralResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.GeneralResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); errorCode_ = 0; bitField0_ = (bitField0_ & ~0x00000001); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_GeneralResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.GeneralResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.GeneralResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.GeneralResult build() { cn.wildfirechat.proto.WFCMessage.GeneralResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.GeneralResult buildPartial() { cn.wildfirechat.proto.WFCMessage.GeneralResult result = new cn.wildfirechat.proto.WFCMessage.GeneralResult(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.errorCode_ = errorCode_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.GeneralResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.GeneralResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.GeneralResult other) { if (other == cn.wildfirechat.proto.WFCMessage.GeneralResult.getDefaultInstance()) return this; if (other.hasErrorCode()) { setErrorCode(other.getErrorCode()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasErrorCode()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.GeneralResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.GeneralResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int32 error_code = 1; private int errorCode_ ; /** * required int32 error_code = 1; */ public boolean hasErrorCode() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 error_code = 1; */ public int getErrorCode() { return errorCode_; } /** * required int32 error_code = 1; */ public Builder setErrorCode(int value) { bitField0_ |= 0x00000001; errorCode_ = value; onChanged(); return this; } /** * required int32 error_code = 1; */ public Builder clearErrorCode() { bitField0_ = (bitField0_ & ~0x00000001); errorCode_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:GeneralResult) } static { defaultInstance = new GeneralResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:GeneralResult) } public interface GetUploadTokenRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int32 media_type = 1; /** * required int32 media_type = 1; */ boolean hasMediaType(); /** * required int32 media_type = 1; */ int getMediaType(); // required string media_path = 2; /** * required string media_path = 2; */ boolean hasMediaPath(); /** * required string media_path = 2; */ java.lang.String getMediaPath(); /** * required string media_path = 2; */ com.google.protobuf.ByteString getMediaPathBytes(); } /** * Protobuf type {@code GetUploadTokenRequest} */ public static final class GetUploadTokenRequest extends com.google.protobuf.GeneratedMessage implements GetUploadTokenRequestOrBuilder { // Use GetUploadTokenRequest.newBuilder() to construct. private GetUploadTokenRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private GetUploadTokenRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final GetUploadTokenRequest defaultInstance; public static GetUploadTokenRequest getDefaultInstance() { return defaultInstance; } public GetUploadTokenRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GetUploadTokenRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; mediaType_ = input.readInt32(); break; } case 18: { bitField0_ |= 0x00000002; mediaPath_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUploadTokenRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUploadTokenRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest.class, cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public GetUploadTokenRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GetUploadTokenRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int32 media_type = 1; public static final int MEDIA_TYPE_FIELD_NUMBER = 1; private int mediaType_; /** * required int32 media_type = 1; */ public boolean hasMediaType() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 media_type = 1; */ public int getMediaType() { return mediaType_; } // required string media_path = 2; public static final int MEDIA_PATH_FIELD_NUMBER = 2; private java.lang.Object mediaPath_; /** * required string media_path = 2; */ public boolean hasMediaPath() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string media_path = 2; */ public java.lang.String getMediaPath() { java.lang.Object ref = mediaPath_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { mediaPath_ = s; } return s; } } /** * required string media_path = 2; */ public com.google.protobuf.ByteString getMediaPathBytes() { java.lang.Object ref = mediaPath_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); mediaPath_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { mediaType_ = 0; mediaPath_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasMediaType()) { memoizedIsInitialized = 0; return false; } if (!hasMediaPath()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, mediaType_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getMediaPathBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, mediaType_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getMediaPathBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code GetUploadTokenRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUploadTokenRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUploadTokenRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest.class, cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); mediaType_ = 0; bitField0_ = (bitField0_ & ~0x00000001); mediaPath_ = ""; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUploadTokenRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest build() { cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest result = new cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.mediaType_ = mediaType_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.mediaPath_ = mediaPath_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest.getDefaultInstance()) return this; if (other.hasMediaType()) { setMediaType(other.getMediaType()); } if (other.hasMediaPath()) { bitField0_ |= 0x00000002; mediaPath_ = other.mediaPath_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasMediaType()) { return false; } if (!hasMediaPath()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.GetUploadTokenRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int32 media_type = 1; private int mediaType_ ; /** * required int32 media_type = 1; */ public boolean hasMediaType() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 media_type = 1; */ public int getMediaType() { return mediaType_; } /** * required int32 media_type = 1; */ public Builder setMediaType(int value) { bitField0_ |= 0x00000001; mediaType_ = value; onChanged(); return this; } /** * required int32 media_type = 1; */ public Builder clearMediaType() { bitField0_ = (bitField0_ & ~0x00000001); mediaType_ = 0; onChanged(); return this; } // required string media_path = 2; private java.lang.Object mediaPath_ = ""; /** * required string media_path = 2; */ public boolean hasMediaPath() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string media_path = 2; */ public java.lang.String getMediaPath() { java.lang.Object ref = mediaPath_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); mediaPath_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string media_path = 2; */ public com.google.protobuf.ByteString getMediaPathBytes() { java.lang.Object ref = mediaPath_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); mediaPath_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string media_path = 2; */ public Builder setMediaPath( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; mediaPath_ = value; onChanged(); return this; } /** * required string media_path = 2; */ public Builder clearMediaPath() { bitField0_ = (bitField0_ & ~0x00000002); mediaPath_ = getDefaultInstance().getMediaPath(); onChanged(); return this; } /** * required string media_path = 2; */ public Builder setMediaPathBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; mediaPath_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:GetUploadTokenRequest) } static { defaultInstance = new GetUploadTokenRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:GetUploadTokenRequest) } public interface GetUploadTokenResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string domain = 1; /** * required string domain = 1; */ boolean hasDomain(); /** * required string domain = 1; */ java.lang.String getDomain(); /** * required string domain = 1; */ com.google.protobuf.ByteString getDomainBytes(); // required string token = 2; /** * required string token = 2; */ boolean hasToken(); /** * required string token = 2; */ java.lang.String getToken(); /** * required string token = 2; */ com.google.protobuf.ByteString getTokenBytes(); // required string server = 3; /** * required string server = 3; */ boolean hasServer(); /** * required string server = 3; */ java.lang.String getServer(); /** * required string server = 3; */ com.google.protobuf.ByteString getServerBytes(); // optional int32 port = 4; /** * optional int32 port = 4; */ boolean hasPort(); /** * optional int32 port = 4; */ int getPort(); } /** * Protobuf type {@code GetUploadTokenResult} */ public static final class GetUploadTokenResult extends com.google.protobuf.GeneratedMessage implements GetUploadTokenResultOrBuilder { // Use GetUploadTokenResult.newBuilder() to construct. private GetUploadTokenResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private GetUploadTokenResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final GetUploadTokenResult defaultInstance; public static GetUploadTokenResult getDefaultInstance() { return defaultInstance; } public GetUploadTokenResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GetUploadTokenResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; domain_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; token_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; server_ = input.readBytes(); break; } case 32: { bitField0_ |= 0x00000008; port_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUploadTokenResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUploadTokenResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult.class, cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public GetUploadTokenResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GetUploadTokenResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string domain = 1; public static final int DOMAIN_FIELD_NUMBER = 1; private java.lang.Object domain_; /** * required string domain = 1; */ public boolean hasDomain() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string domain = 1; */ public java.lang.String getDomain() { java.lang.Object ref = domain_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { domain_ = s; } return s; } } /** * required string domain = 1; */ public com.google.protobuf.ByteString getDomainBytes() { java.lang.Object ref = domain_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); domain_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string token = 2; public static final int TOKEN_FIELD_NUMBER = 2; private java.lang.Object token_; /** * required string token = 2; */ public boolean hasToken() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string token = 2; */ public java.lang.String getToken() { java.lang.Object ref = token_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { token_ = s; } return s; } } /** * required string token = 2; */ public com.google.protobuf.ByteString getTokenBytes() { java.lang.Object ref = token_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); token_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string server = 3; public static final int SERVER_FIELD_NUMBER = 3; private java.lang.Object server_; /** * required string server = 3; */ public boolean hasServer() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string server = 3; */ public java.lang.String getServer() { java.lang.Object ref = server_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { server_ = s; } return s; } } /** * required string server = 3; */ public com.google.protobuf.ByteString getServerBytes() { java.lang.Object ref = server_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); server_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 port = 4; public static final int PORT_FIELD_NUMBER = 4; private int port_; /** * optional int32 port = 4; */ public boolean hasPort() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int32 port = 4; */ public int getPort() { return port_; } private void initFields() { domain_ = ""; token_ = ""; server_ = ""; port_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasDomain()) { memoizedIsInitialized = 0; return false; } if (!hasToken()) { memoizedIsInitialized = 0; return false; } if (!hasServer()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getDomainBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getTokenBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getServerBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeInt32(4, port_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getDomainBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getTokenBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getServerBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(4, port_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code GetUploadTokenResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GetUploadTokenResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUploadTokenResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUploadTokenResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult.class, cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); domain_ = ""; bitField0_ = (bitField0_ & ~0x00000001); token_ = ""; bitField0_ = (bitField0_ & ~0x00000002); server_ = ""; bitField0_ = (bitField0_ & ~0x00000004); port_ = 0; bitField0_ = (bitField0_ & ~0x00000008); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUploadTokenResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult build() { cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult buildPartial() { cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult result = new cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.domain_ = domain_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.token_ = token_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.server_ = server_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.port_ = port_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult other) { if (other == cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult.getDefaultInstance()) return this; if (other.hasDomain()) { bitField0_ |= 0x00000001; domain_ = other.domain_; onChanged(); } if (other.hasToken()) { bitField0_ |= 0x00000002; token_ = other.token_; onChanged(); } if (other.hasServer()) { bitField0_ |= 0x00000004; server_ = other.server_; onChanged(); } if (other.hasPort()) { setPort(other.getPort()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasDomain()) { return false; } if (!hasToken()) { return false; } if (!hasServer()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.GetUploadTokenResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string domain = 1; private java.lang.Object domain_ = ""; /** * required string domain = 1; */ public boolean hasDomain() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string domain = 1; */ public java.lang.String getDomain() { java.lang.Object ref = domain_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); domain_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string domain = 1; */ public com.google.protobuf.ByteString getDomainBytes() { java.lang.Object ref = domain_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); domain_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string domain = 1; */ public Builder setDomain( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; domain_ = value; onChanged(); return this; } /** * required string domain = 1; */ public Builder clearDomain() { bitField0_ = (bitField0_ & ~0x00000001); domain_ = getDefaultInstance().getDomain(); onChanged(); return this; } /** * required string domain = 1; */ public Builder setDomainBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; domain_ = value; onChanged(); return this; } // required string token = 2; private java.lang.Object token_ = ""; /** * required string token = 2; */ public boolean hasToken() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string token = 2; */ public java.lang.String getToken() { java.lang.Object ref = token_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); token_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string token = 2; */ public com.google.protobuf.ByteString getTokenBytes() { java.lang.Object ref = token_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); token_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string token = 2; */ public Builder setToken( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; token_ = value; onChanged(); return this; } /** * required string token = 2; */ public Builder clearToken() { bitField0_ = (bitField0_ & ~0x00000002); token_ = getDefaultInstance().getToken(); onChanged(); return this; } /** * required string token = 2; */ public Builder setTokenBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; token_ = value; onChanged(); return this; } // required string server = 3; private java.lang.Object server_ = ""; /** * required string server = 3; */ public boolean hasServer() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string server = 3; */ public java.lang.String getServer() { java.lang.Object ref = server_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); server_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string server = 3; */ public com.google.protobuf.ByteString getServerBytes() { java.lang.Object ref = server_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); server_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string server = 3; */ public Builder setServer( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; server_ = value; onChanged(); return this; } /** * required string server = 3; */ public Builder clearServer() { bitField0_ = (bitField0_ & ~0x00000004); server_ = getDefaultInstance().getServer(); onChanged(); return this; } /** * required string server = 3; */ public Builder setServerBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; server_ = value; onChanged(); return this; } // optional int32 port = 4; private int port_ ; /** * optional int32 port = 4; */ public boolean hasPort() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int32 port = 4; */ public int getPort() { return port_; } /** * optional int32 port = 4; */ public Builder setPort(int value) { bitField0_ |= 0x00000008; port_ = value; onChanged(); return this; } /** * optional int32 port = 4; */ public Builder clearPort() { bitField0_ = (bitField0_ & ~0x00000008); port_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:GetUploadTokenResult) } static { defaultInstance = new GetUploadTokenResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:GetUploadTokenResult) } public interface HandleFriendRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string target_uid = 1; /** * required string target_uid = 1; */ boolean hasTargetUid(); /** * required string target_uid = 1; */ java.lang.String getTargetUid(); /** * required string target_uid = 1; */ com.google.protobuf.ByteString getTargetUidBytes(); // required int32 status = 2; /** * required int32 status = 2; */ boolean hasStatus(); /** * required int32 status = 2; */ int getStatus(); // optional string extra = 3; /** * optional string extra = 3; */ boolean hasExtra(); /** * optional string extra = 3; */ java.lang.String getExtra(); /** * optional string extra = 3; */ com.google.protobuf.ByteString getExtraBytes(); } /** * Protobuf type {@code HandleFriendRequest} */ public static final class HandleFriendRequest extends com.google.protobuf.GeneratedMessage implements HandleFriendRequestOrBuilder { // Use HandleFriendRequest.newBuilder() to construct. private HandleFriendRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private HandleFriendRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final HandleFriendRequest defaultInstance; public static HandleFriendRequest getDefaultInstance() { return defaultInstance; } public HandleFriendRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private HandleFriendRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; targetUid_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; status_ = input.readInt32(); break; } case 26: { bitField0_ |= 0x00000004; extra_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_HandleFriendRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_HandleFriendRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.HandleFriendRequest.class, cn.wildfirechat.proto.WFCMessage.HandleFriendRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public HandleFriendRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new HandleFriendRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string target_uid = 1; public static final int TARGET_UID_FIELD_NUMBER = 1; private java.lang.Object targetUid_; /** * required string target_uid = 1; */ public boolean hasTargetUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string target_uid = 1; */ public java.lang.String getTargetUid() { java.lang.Object ref = targetUid_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { targetUid_ = s; } return s; } } /** * required string target_uid = 1; */ public com.google.protobuf.ByteString getTargetUidBytes() { java.lang.Object ref = targetUid_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); targetUid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 status = 2; public static final int STATUS_FIELD_NUMBER = 2; private int status_; /** * required int32 status = 2; */ public boolean hasStatus() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 status = 2; */ public int getStatus() { return status_; } // optional string extra = 3; public static final int EXTRA_FIELD_NUMBER = 3; private java.lang.Object extra_; /** * optional string extra = 3; */ public boolean hasExtra() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string extra = 3; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 3; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { targetUid_ = ""; status_ = 0; extra_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTargetUid()) { memoizedIsInitialized = 0; return false; } if (!hasStatus()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTargetUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, status_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getExtraBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTargetUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, status_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getExtraBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.HandleFriendRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.HandleFriendRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.HandleFriendRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.HandleFriendRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.HandleFriendRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.HandleFriendRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.HandleFriendRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.HandleFriendRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.HandleFriendRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.HandleFriendRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.HandleFriendRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code HandleFriendRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.HandleFriendRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_HandleFriendRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_HandleFriendRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.HandleFriendRequest.class, cn.wildfirechat.proto.WFCMessage.HandleFriendRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.HandleFriendRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); targetUid_ = ""; bitField0_ = (bitField0_ & ~0x00000001); status_ = 0; bitField0_ = (bitField0_ & ~0x00000002); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_HandleFriendRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.HandleFriendRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.HandleFriendRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.HandleFriendRequest build() { cn.wildfirechat.proto.WFCMessage.HandleFriendRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.HandleFriendRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.HandleFriendRequest result = new cn.wildfirechat.proto.WFCMessage.HandleFriendRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.targetUid_ = targetUid_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.status_ = status_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.extra_ = extra_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.HandleFriendRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.HandleFriendRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.HandleFriendRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.HandleFriendRequest.getDefaultInstance()) return this; if (other.hasTargetUid()) { bitField0_ |= 0x00000001; targetUid_ = other.targetUid_; onChanged(); } if (other.hasStatus()) { setStatus(other.getStatus()); } if (other.hasExtra()) { bitField0_ |= 0x00000004; extra_ = other.extra_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTargetUid()) { return false; } if (!hasStatus()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.HandleFriendRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.HandleFriendRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string target_uid = 1; private java.lang.Object targetUid_ = ""; /** * required string target_uid = 1; */ public boolean hasTargetUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string target_uid = 1; */ public java.lang.String getTargetUid() { java.lang.Object ref = targetUid_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); targetUid_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string target_uid = 1; */ public com.google.protobuf.ByteString getTargetUidBytes() { java.lang.Object ref = targetUid_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); targetUid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string target_uid = 1; */ public Builder setTargetUid( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; targetUid_ = value; onChanged(); return this; } /** * required string target_uid = 1; */ public Builder clearTargetUid() { bitField0_ = (bitField0_ & ~0x00000001); targetUid_ = getDefaultInstance().getTargetUid(); onChanged(); return this; } /** * required string target_uid = 1; */ public Builder setTargetUidBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; targetUid_ = value; onChanged(); return this; } // required int32 status = 2; private int status_ ; /** * required int32 status = 2; */ public boolean hasStatus() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 status = 2; */ public int getStatus() { return status_; } /** * required int32 status = 2; */ public Builder setStatus(int value) { bitField0_ |= 0x00000002; status_ = value; onChanged(); return this; } /** * required int32 status = 2; */ public Builder clearStatus() { bitField0_ = (bitField0_ & ~0x00000002); status_ = 0; onChanged(); return this; } // optional string extra = 3; private java.lang.Object extra_ = ""; /** * optional string extra = 3; */ public boolean hasExtra() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string extra = 3; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 3; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 3; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; extra_ = value; onChanged(); return this; } /** * optional string extra = 3; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000004); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 3; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; extra_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:HandleFriendRequest) } static { defaultInstance = new HandleFriendRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:HandleFriendRequest) } public interface IDBufOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string id = 1; /** * required string id = 1; */ boolean hasId(); /** * required string id = 1; */ java.lang.String getId(); /** * required string id = 1; */ com.google.protobuf.ByteString getIdBytes(); } /** * Protobuf type {@code IDBuf} */ public static final class IDBuf extends com.google.protobuf.GeneratedMessage implements IDBufOrBuilder { // Use IDBuf.newBuilder() to construct. private IDBuf(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private IDBuf(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final IDBuf defaultInstance; public static IDBuf getDefaultInstance() { return defaultInstance; } public IDBuf getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private IDBuf( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; id_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_IDBuf_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_IDBuf_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.IDBuf.class, cn.wildfirechat.proto.WFCMessage.IDBuf.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public IDBuf parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new IDBuf(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string id = 1; public static final int ID_FIELD_NUMBER = 1; private java.lang.Object id_; /** * required string id = 1; */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string id = 1; */ public java.lang.String getId() { java.lang.Object ref = id_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { id_ = s; } return s; } } /** * required string id = 1; */ public com.google.protobuf.ByteString getIdBytes() { java.lang.Object ref = id_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); id_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { id_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasId()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getIdBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getIdBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.IDBuf parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.IDBuf parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.IDBuf parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.IDBuf parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.IDBuf parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.IDBuf parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.IDBuf parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.IDBuf parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.IDBuf parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.IDBuf parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.IDBuf prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code IDBuf} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.IDBufOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_IDBuf_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_IDBuf_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.IDBuf.class, cn.wildfirechat.proto.WFCMessage.IDBuf.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.IDBuf.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); id_ = ""; bitField0_ = (bitField0_ & ~0x00000001); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_IDBuf_descriptor; } public cn.wildfirechat.proto.WFCMessage.IDBuf getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.IDBuf.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.IDBuf build() { cn.wildfirechat.proto.WFCMessage.IDBuf result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.IDBuf buildPartial() { cn.wildfirechat.proto.WFCMessage.IDBuf result = new cn.wildfirechat.proto.WFCMessage.IDBuf(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.id_ = id_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.IDBuf) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.IDBuf)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.IDBuf other) { if (other == cn.wildfirechat.proto.WFCMessage.IDBuf.getDefaultInstance()) return this; if (other.hasId()) { bitField0_ |= 0x00000001; id_ = other.id_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasId()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.IDBuf parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.IDBuf) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string id = 1; private java.lang.Object id_ = ""; /** * required string id = 1; */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string id = 1; */ public java.lang.String getId() { java.lang.Object ref = id_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); id_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string id = 1; */ public com.google.protobuf.ByteString getIdBytes() { java.lang.Object ref = id_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); id_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string id = 1; */ public Builder setId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; id_ = value; onChanged(); return this; } /** * required string id = 1; */ public Builder clearId() { bitField0_ = (bitField0_ & ~0x00000001); id_ = getDefaultInstance().getId(); onChanged(); return this; } /** * required string id = 1; */ public Builder setIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; id_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:IDBuf) } static { defaultInstance = new IDBuf(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:IDBuf) } public interface IDListBufOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated string id = 1; /** * repeated string id = 1; */ java.util.List getIdList(); /** * repeated string id = 1; */ int getIdCount(); /** * repeated string id = 1; */ java.lang.String getId(int index); /** * repeated string id = 1; */ com.google.protobuf.ByteString getIdBytes(int index); } /** * Protobuf type {@code IDListBuf} */ public static final class IDListBuf extends com.google.protobuf.GeneratedMessage implements IDListBufOrBuilder { // Use IDListBuf.newBuilder() to construct. private IDListBuf(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private IDListBuf(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final IDListBuf defaultInstance; public static IDListBuf getDefaultInstance() { return defaultInstance; } public IDListBuf getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private IDListBuf( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { id_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000001; } id_.add(input.readBytes()); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { id_ = new com.google.protobuf.UnmodifiableLazyStringList(id_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_IDListBuf_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_IDListBuf_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.IDListBuf.class, cn.wildfirechat.proto.WFCMessage.IDListBuf.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public IDListBuf parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new IDListBuf(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } // repeated string id = 1; public static final int ID_FIELD_NUMBER = 1; private com.google.protobuf.LazyStringList id_; /** * repeated string id = 1; */ public java.util.List getIdList() { return id_; } /** * repeated string id = 1; */ public int getIdCount() { return id_.size(); } /** * repeated string id = 1; */ public java.lang.String getId(int index) { return id_.get(index); } /** * repeated string id = 1; */ public com.google.protobuf.ByteString getIdBytes(int index) { return id_.getByteString(index); } private void initFields() { id_ = com.google.protobuf.LazyStringArrayList.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < id_.size(); i++) { output.writeBytes(1, id_.getByteString(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; { int dataSize = 0; for (int i = 0; i < id_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeBytesSizeNoTag(id_.getByteString(i)); } size += dataSize; size += 1 * getIdList().size(); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.IDListBuf parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.IDListBuf parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.IDListBuf parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.IDListBuf parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.IDListBuf parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.IDListBuf parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.IDListBuf parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.IDListBuf parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.IDListBuf parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.IDListBuf parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.IDListBuf prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code IDListBuf} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.IDListBufOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_IDListBuf_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_IDListBuf_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.IDListBuf.class, cn.wildfirechat.proto.WFCMessage.IDListBuf.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.IDListBuf.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); id_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000001); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_IDListBuf_descriptor; } public cn.wildfirechat.proto.WFCMessage.IDListBuf getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.IDListBuf.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.IDListBuf build() { cn.wildfirechat.proto.WFCMessage.IDListBuf result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.IDListBuf buildPartial() { cn.wildfirechat.proto.WFCMessage.IDListBuf result = new cn.wildfirechat.proto.WFCMessage.IDListBuf(this); int from_bitField0_ = bitField0_; if (((bitField0_ & 0x00000001) == 0x00000001)) { id_ = new com.google.protobuf.UnmodifiableLazyStringList( id_); bitField0_ = (bitField0_ & ~0x00000001); } result.id_ = id_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.IDListBuf) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.IDListBuf)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.IDListBuf other) { if (other == cn.wildfirechat.proto.WFCMessage.IDListBuf.getDefaultInstance()) return this; if (!other.id_.isEmpty()) { if (id_.isEmpty()) { id_ = other.id_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureIdIsMutable(); id_.addAll(other.id_); } onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.IDListBuf parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.IDListBuf) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated string id = 1; private com.google.protobuf.LazyStringList id_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureIdIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { id_ = new com.google.protobuf.LazyStringArrayList(id_); bitField0_ |= 0x00000001; } } /** * repeated string id = 1; */ public java.util.List getIdList() { return java.util.Collections.unmodifiableList(id_); } /** * repeated string id = 1; */ public int getIdCount() { return id_.size(); } /** * repeated string id = 1; */ public java.lang.String getId(int index) { return id_.get(index); } /** * repeated string id = 1; */ public com.google.protobuf.ByteString getIdBytes(int index) { return id_.getByteString(index); } /** * repeated string id = 1; */ public Builder setId( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureIdIsMutable(); id_.set(index, value); onChanged(); return this; } /** * repeated string id = 1; */ public Builder addId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureIdIsMutable(); id_.add(value); onChanged(); return this; } /** * repeated string id = 1; */ public Builder addAllId( java.lang.Iterable values) { ensureIdIsMutable(); super.addAll(values, id_); onChanged(); return this; } /** * repeated string id = 1; */ public Builder clearId() { id_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000001); onChanged(); return this; } /** * repeated string id = 1; */ public Builder addIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } ensureIdIsMutable(); id_.add(value); onChanged(); return this; } // @@protoc_insertion_point(builder_scope:IDListBuf) } static { defaultInstance = new IDListBuf(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:IDListBuf) } public interface MessageOrBuilder extends com.google.protobuf.MessageOrBuilder { // required .Conversation conversation = 1; /** * required .Conversation conversation = 1; */ boolean hasConversation(); /** * required .Conversation conversation = 1; */ cn.wildfirechat.proto.WFCMessage.Conversation getConversation(); /** * required .Conversation conversation = 1; */ cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder getConversationOrBuilder(); // required string from_user = 2; /** * required string from_user = 2; */ boolean hasFromUser(); /** * required string from_user = 2; */ java.lang.String getFromUser(); /** * required string from_user = 2; */ com.google.protobuf.ByteString getFromUserBytes(); // required .MessageContent content = 3; /** * required .MessageContent content = 3; */ boolean hasContent(); /** * required .MessageContent content = 3; */ cn.wildfirechat.proto.WFCMessage.MessageContent getContent(); /** * required .MessageContent content = 3; */ cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getContentOrBuilder(); // optional int64 message_id = 4; /** * optional int64 message_id = 4; */ boolean hasMessageId(); /** * optional int64 message_id = 4; */ long getMessageId(); // optional int64 server_timestamp = 5; /** * optional int64 server_timestamp = 5; */ boolean hasServerTimestamp(); /** * optional int64 server_timestamp = 5; */ long getServerTimestamp(); // optional string to_user = 6; /** * optional string to_user = 6; * *
     *not use anymore
     * 
*/ boolean hasToUser(); /** * optional string to_user = 6; * *
     *not use anymore
     * 
*/ java.lang.String getToUser(); /** * optional string to_user = 6; * *
     *not use anymore
     * 
*/ com.google.protobuf.ByteString getToUserBytes(); // repeated string to = 7; /** * repeated string to = 7; */ java.util.List getToList(); /** * repeated string to = 7; */ int getToCount(); /** * repeated string to = 7; */ java.lang.String getTo(int index); /** * repeated string to = 7; */ com.google.protobuf.ByteString getToBytes(int index); } /** * Protobuf type {@code Message} */ public static final class Message extends com.google.protobuf.GeneratedMessage implements MessageOrBuilder { // Use Message.newBuilder() to construct. private Message(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private Message(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final Message defaultInstance; public static Message getDefaultInstance() { return defaultInstance; } public Message getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Message( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { cn.wildfirechat.proto.WFCMessage.Conversation.Builder subBuilder = null; if (((bitField0_ & 0x00000001) == 0x00000001)) { subBuilder = conversation_.toBuilder(); } conversation_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.Conversation.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(conversation_); conversation_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000001; break; } case 18: { bitField0_ |= 0x00000002; fromUser_ = input.readBytes(); break; } case 26: { cn.wildfirechat.proto.WFCMessage.MessageContent.Builder subBuilder = null; if (((bitField0_ & 0x00000004) == 0x00000004)) { subBuilder = content_.toBuilder(); } content_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.MessageContent.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(content_); content_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000004; break; } case 32: { bitField0_ |= 0x00000008; messageId_ = input.readInt64(); break; } case 40: { bitField0_ |= 0x00000010; serverTimestamp_ = input.readInt64(); break; } case 50: { bitField0_ |= 0x00000020; toUser_ = input.readBytes(); break; } case 58: { if (!((mutable_bitField0_ & 0x00000040) == 0x00000040)) { to_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000040; } to_.add(input.readBytes()); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000040) == 0x00000040)) { to_ = new com.google.protobuf.UnmodifiableLazyStringList(to_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_Message_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_Message_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.Message.class, cn.wildfirechat.proto.WFCMessage.Message.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public Message parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Message(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required .Conversation conversation = 1; public static final int CONVERSATION_FIELD_NUMBER = 1; private cn.wildfirechat.proto.WFCMessage.Conversation conversation_; /** * required .Conversation conversation = 1; */ public boolean hasConversation() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required .Conversation conversation = 1; */ public cn.wildfirechat.proto.WFCMessage.Conversation getConversation() { return conversation_; } /** * required .Conversation conversation = 1; */ public cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder getConversationOrBuilder() { return conversation_; } // required string from_user = 2; public static final int FROM_USER_FIELD_NUMBER = 2; private java.lang.Object fromUser_; /** * required string from_user = 2; */ public boolean hasFromUser() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string from_user = 2; */ public java.lang.String getFromUser() { java.lang.Object ref = fromUser_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { fromUser_ = s; } return s; } } /** * required string from_user = 2; */ public com.google.protobuf.ByteString getFromUserBytes() { java.lang.Object ref = fromUser_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); fromUser_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required .MessageContent content = 3; public static final int CONTENT_FIELD_NUMBER = 3; private cn.wildfirechat.proto.WFCMessage.MessageContent content_; /** * required .MessageContent content = 3; */ public boolean hasContent() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required .MessageContent content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getContent() { return content_; } /** * required .MessageContent content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getContentOrBuilder() { return content_; } // optional int64 message_id = 4; public static final int MESSAGE_ID_FIELD_NUMBER = 4; private long messageId_; /** * optional int64 message_id = 4; */ public boolean hasMessageId() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int64 message_id = 4; */ public long getMessageId() { return messageId_; } // optional int64 server_timestamp = 5; public static final int SERVER_TIMESTAMP_FIELD_NUMBER = 5; private long serverTimestamp_; /** * optional int64 server_timestamp = 5; */ public boolean hasServerTimestamp() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int64 server_timestamp = 5; */ public long getServerTimestamp() { return serverTimestamp_; } // optional string to_user = 6; public static final int TO_USER_FIELD_NUMBER = 6; private java.lang.Object toUser_; /** * optional string to_user = 6; * *
     *not use anymore
     * 
*/ public boolean hasToUser() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string to_user = 6; * *
     *not use anymore
     * 
*/ public java.lang.String getToUser() { java.lang.Object ref = toUser_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { toUser_ = s; } return s; } } /** * optional string to_user = 6; * *
     *not use anymore
     * 
*/ public com.google.protobuf.ByteString getToUserBytes() { java.lang.Object ref = toUser_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); toUser_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // repeated string to = 7; public static final int TO_FIELD_NUMBER = 7; private com.google.protobuf.LazyStringList to_; /** * repeated string to = 7; */ public java.util.List getToList() { return to_; } /** * repeated string to = 7; */ public int getToCount() { return to_.size(); } /** * repeated string to = 7; */ public java.lang.String getTo(int index) { return to_.get(index); } /** * repeated string to = 7; */ public com.google.protobuf.ByteString getToBytes(int index) { return to_.getByteString(index); } private void initFields() { conversation_ = cn.wildfirechat.proto.WFCMessage.Conversation.getDefaultInstance(); fromUser_ = ""; content_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); messageId_ = 0L; serverTimestamp_ = 0L; toUser_ = ""; to_ = com.google.protobuf.LazyStringArrayList.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasConversation()) { memoizedIsInitialized = 0; return false; } if (!hasFromUser()) { memoizedIsInitialized = 0; return false; } if (!hasContent()) { memoizedIsInitialized = 0; return false; } if (!getConversation().isInitialized()) { memoizedIsInitialized = 0; return false; } if (!getContent().isInitialized()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeMessage(1, conversation_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getFromUserBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeMessage(3, content_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeInt64(4, messageId_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeInt64(5, serverTimestamp_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, getToUserBytes()); } for (int i = 0; i < to_.size(); i++) { output.writeBytes(7, to_.getByteString(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, conversation_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getFromUserBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(3, content_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(4, messageId_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(5, serverTimestamp_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(6, getToUserBytes()); } { int dataSize = 0; for (int i = 0; i < to_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeBytesSizeNoTag(to_.getByteString(i)); } size += dataSize; size += 1 * getToList().size(); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.Message parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.Message parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Message parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.Message parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Message parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Message parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Message parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Message parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Message parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Message parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.Message prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code Message} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.MessageOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_Message_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_Message_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.Message.class, cn.wildfirechat.proto.WFCMessage.Message.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.Message.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getConversationFieldBuilder(); getContentFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (conversationBuilder_ == null) { conversation_ = cn.wildfirechat.proto.WFCMessage.Conversation.getDefaultInstance(); } else { conversationBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); fromUser_ = ""; bitField0_ = (bitField0_ & ~0x00000002); if (contentBuilder_ == null) { content_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } else { contentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000004); messageId_ = 0L; bitField0_ = (bitField0_ & ~0x00000008); serverTimestamp_ = 0L; bitField0_ = (bitField0_ & ~0x00000010); toUser_ = ""; bitField0_ = (bitField0_ & ~0x00000020); to_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000040); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_Message_descriptor; } public cn.wildfirechat.proto.WFCMessage.Message getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.Message.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.Message build() { cn.wildfirechat.proto.WFCMessage.Message result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.Message buildPartial() { cn.wildfirechat.proto.WFCMessage.Message result = new cn.wildfirechat.proto.WFCMessage.Message(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } if (conversationBuilder_ == null) { result.conversation_ = conversation_; } else { result.conversation_ = conversationBuilder_.build(); } if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.fromUser_ = fromUser_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } if (contentBuilder_ == null) { result.content_ = content_; } else { result.content_ = contentBuilder_.build(); } if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.messageId_ = messageId_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.serverTimestamp_ = serverTimestamp_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.toUser_ = toUser_; if (((bitField0_ & 0x00000040) == 0x00000040)) { to_ = new com.google.protobuf.UnmodifiableLazyStringList( to_); bitField0_ = (bitField0_ & ~0x00000040); } result.to_ = to_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.Message) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.Message)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.Message other) { if (other == cn.wildfirechat.proto.WFCMessage.Message.getDefaultInstance()) return this; if (other.hasConversation()) { mergeConversation(other.getConversation()); } if (other.hasFromUser()) { bitField0_ |= 0x00000002; fromUser_ = other.fromUser_; onChanged(); } if (other.hasContent()) { mergeContent(other.getContent()); } if (other.hasMessageId()) { setMessageId(other.getMessageId()); } if (other.hasServerTimestamp()) { setServerTimestamp(other.getServerTimestamp()); } if (other.hasToUser()) { bitField0_ |= 0x00000020; toUser_ = other.toUser_; onChanged(); } if (!other.to_.isEmpty()) { if (to_.isEmpty()) { to_ = other.to_; bitField0_ = (bitField0_ & ~0x00000040); } else { ensureToIsMutable(); to_.addAll(other.to_); } onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasConversation()) { return false; } if (!hasFromUser()) { return false; } if (!hasContent()) { return false; } if (!getConversation().isInitialized()) { return false; } if (!getContent().isInitialized()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.Message parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.Message) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required .Conversation conversation = 1; private cn.wildfirechat.proto.WFCMessage.Conversation conversation_ = cn.wildfirechat.proto.WFCMessage.Conversation.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.Conversation, cn.wildfirechat.proto.WFCMessage.Conversation.Builder, cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder> conversationBuilder_; /** * required .Conversation conversation = 1; */ public boolean hasConversation() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required .Conversation conversation = 1; */ public cn.wildfirechat.proto.WFCMessage.Conversation getConversation() { if (conversationBuilder_ == null) { return conversation_; } else { return conversationBuilder_.getMessage(); } } /** * required .Conversation conversation = 1; */ public Builder setConversation(cn.wildfirechat.proto.WFCMessage.Conversation value) { if (conversationBuilder_ == null) { if (value == null) { throw new NullPointerException(); } conversation_ = value; onChanged(); } else { conversationBuilder_.setMessage(value); } bitField0_ |= 0x00000001; return this; } /** * required .Conversation conversation = 1; */ public Builder setConversation( cn.wildfirechat.proto.WFCMessage.Conversation.Builder builderForValue) { if (conversationBuilder_ == null) { conversation_ = builderForValue.build(); onChanged(); } else { conversationBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000001; return this; } /** * required .Conversation conversation = 1; */ public Builder mergeConversation(cn.wildfirechat.proto.WFCMessage.Conversation value) { if (conversationBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && conversation_ != cn.wildfirechat.proto.WFCMessage.Conversation.getDefaultInstance()) { conversation_ = cn.wildfirechat.proto.WFCMessage.Conversation.newBuilder(conversation_).mergeFrom(value).buildPartial(); } else { conversation_ = value; } onChanged(); } else { conversationBuilder_.mergeFrom(value); } bitField0_ |= 0x00000001; return this; } /** * required .Conversation conversation = 1; */ public Builder clearConversation() { if (conversationBuilder_ == null) { conversation_ = cn.wildfirechat.proto.WFCMessage.Conversation.getDefaultInstance(); onChanged(); } else { conversationBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); return this; } /** * required .Conversation conversation = 1; */ public cn.wildfirechat.proto.WFCMessage.Conversation.Builder getConversationBuilder() { bitField0_ |= 0x00000001; onChanged(); return getConversationFieldBuilder().getBuilder(); } /** * required .Conversation conversation = 1; */ public cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder getConversationOrBuilder() { if (conversationBuilder_ != null) { return conversationBuilder_.getMessageOrBuilder(); } else { return conversation_; } } /** * required .Conversation conversation = 1; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.Conversation, cn.wildfirechat.proto.WFCMessage.Conversation.Builder, cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder> getConversationFieldBuilder() { if (conversationBuilder_ == null) { conversationBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.Conversation, cn.wildfirechat.proto.WFCMessage.Conversation.Builder, cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder>( conversation_, getParentForChildren(), isClean()); conversation_ = null; } return conversationBuilder_; } // required string from_user = 2; private java.lang.Object fromUser_ = ""; /** * required string from_user = 2; */ public boolean hasFromUser() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string from_user = 2; */ public java.lang.String getFromUser() { java.lang.Object ref = fromUser_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); fromUser_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string from_user = 2; */ public com.google.protobuf.ByteString getFromUserBytes() { java.lang.Object ref = fromUser_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); fromUser_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string from_user = 2; */ public Builder setFromUser( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; fromUser_ = value; onChanged(); return this; } /** * required string from_user = 2; */ public Builder clearFromUser() { bitField0_ = (bitField0_ & ~0x00000002); fromUser_ = getDefaultInstance().getFromUser(); onChanged(); return this; } /** * required string from_user = 2; */ public Builder setFromUserBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; fromUser_ = value; onChanged(); return this; } // required .MessageContent content = 3; private cn.wildfirechat.proto.WFCMessage.MessageContent content_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> contentBuilder_; /** * required .MessageContent content = 3; */ public boolean hasContent() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required .MessageContent content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getContent() { if (contentBuilder_ == null) { return content_; } else { return contentBuilder_.getMessage(); } } /** * required .MessageContent content = 3; */ public Builder setContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (contentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } content_ = value; onChanged(); } else { contentBuilder_.setMessage(value); } bitField0_ |= 0x00000004; return this; } /** * required .MessageContent content = 3; */ public Builder setContent( cn.wildfirechat.proto.WFCMessage.MessageContent.Builder builderForValue) { if (contentBuilder_ == null) { content_ = builderForValue.build(); onChanged(); } else { contentBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000004; return this; } /** * required .MessageContent content = 3; */ public Builder mergeContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (contentBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004) && content_ != cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) { content_ = cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder(content_).mergeFrom(value).buildPartial(); } else { content_ = value; } onChanged(); } else { contentBuilder_.mergeFrom(value); } bitField0_ |= 0x00000004; return this; } /** * required .MessageContent content = 3; */ public Builder clearContent() { if (contentBuilder_ == null) { content_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); onChanged(); } else { contentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000004); return this; } /** * required .MessageContent content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent.Builder getContentBuilder() { bitField0_ |= 0x00000004; onChanged(); return getContentFieldBuilder().getBuilder(); } /** * required .MessageContent content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getContentOrBuilder() { if (contentBuilder_ != null) { return contentBuilder_.getMessageOrBuilder(); } else { return content_; } } /** * required .MessageContent content = 3; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> getContentFieldBuilder() { if (contentBuilder_ == null) { contentBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder>( content_, getParentForChildren(), isClean()); content_ = null; } return contentBuilder_; } // optional int64 message_id = 4; private long messageId_ ; /** * optional int64 message_id = 4; */ public boolean hasMessageId() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int64 message_id = 4; */ public long getMessageId() { return messageId_; } /** * optional int64 message_id = 4; */ public Builder setMessageId(long value) { bitField0_ |= 0x00000008; messageId_ = value; onChanged(); return this; } /** * optional int64 message_id = 4; */ public Builder clearMessageId() { bitField0_ = (bitField0_ & ~0x00000008); messageId_ = 0L; onChanged(); return this; } // optional int64 server_timestamp = 5; private long serverTimestamp_ ; /** * optional int64 server_timestamp = 5; */ public boolean hasServerTimestamp() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int64 server_timestamp = 5; */ public long getServerTimestamp() { return serverTimestamp_; } /** * optional int64 server_timestamp = 5; */ public Builder setServerTimestamp(long value) { bitField0_ |= 0x00000010; serverTimestamp_ = value; onChanged(); return this; } /** * optional int64 server_timestamp = 5; */ public Builder clearServerTimestamp() { bitField0_ = (bitField0_ & ~0x00000010); serverTimestamp_ = 0L; onChanged(); return this; } // optional string to_user = 6; private java.lang.Object toUser_ = ""; /** * optional string to_user = 6; * *
       *not use anymore
       * 
*/ public boolean hasToUser() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string to_user = 6; * *
       *not use anymore
       * 
*/ public java.lang.String getToUser() { java.lang.Object ref = toUser_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); toUser_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string to_user = 6; * *
       *not use anymore
       * 
*/ public com.google.protobuf.ByteString getToUserBytes() { java.lang.Object ref = toUser_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); toUser_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string to_user = 6; * *
       *not use anymore
       * 
*/ public Builder setToUser( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; toUser_ = value; onChanged(); return this; } /** * optional string to_user = 6; * *
       *not use anymore
       * 
*/ public Builder clearToUser() { bitField0_ = (bitField0_ & ~0x00000020); toUser_ = getDefaultInstance().getToUser(); onChanged(); return this; } /** * optional string to_user = 6; * *
       *not use anymore
       * 
*/ public Builder setToUserBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; toUser_ = value; onChanged(); return this; } // repeated string to = 7; private com.google.protobuf.LazyStringList to_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureToIsMutable() { if (!((bitField0_ & 0x00000040) == 0x00000040)) { to_ = new com.google.protobuf.LazyStringArrayList(to_); bitField0_ |= 0x00000040; } } /** * repeated string to = 7; */ public java.util.List getToList() { return java.util.Collections.unmodifiableList(to_); } /** * repeated string to = 7; */ public int getToCount() { return to_.size(); } /** * repeated string to = 7; */ public java.lang.String getTo(int index) { return to_.get(index); } /** * repeated string to = 7; */ public com.google.protobuf.ByteString getToBytes(int index) { return to_.getByteString(index); } /** * repeated string to = 7; */ public Builder setTo( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureToIsMutable(); to_.set(index, value); onChanged(); return this; } /** * repeated string to = 7; */ public Builder addTo( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureToIsMutable(); to_.add(value); onChanged(); return this; } /** * repeated string to = 7; */ public Builder addAllTo( java.lang.Iterable values) { ensureToIsMutable(); super.addAll(values, to_); onChanged(); return this; } /** * repeated string to = 7; */ public Builder clearTo() { to_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000040); onChanged(); return this; } /** * repeated string to = 7; */ public Builder addToBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } ensureToIsMutable(); to_.add(value); onChanged(); return this; } // @@protoc_insertion_point(builder_scope:Message) } static { defaultInstance = new Message(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:Message) } public interface UserOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string uid = 1; /** * required string uid = 1; */ boolean hasUid(); /** * required string uid = 1; */ java.lang.String getUid(); /** * required string uid = 1; */ com.google.protobuf.ByteString getUidBytes(); // optional string name = 2; /** * optional string name = 2; */ boolean hasName(); /** * optional string name = 2; */ java.lang.String getName(); /** * optional string name = 2; */ com.google.protobuf.ByteString getNameBytes(); // optional string display_name = 3; /** * optional string display_name = 3; */ boolean hasDisplayName(); /** * optional string display_name = 3; */ java.lang.String getDisplayName(); /** * optional string display_name = 3; */ com.google.protobuf.ByteString getDisplayNameBytes(); // optional string portrait = 4; /** * optional string portrait = 4; */ boolean hasPortrait(); /** * optional string portrait = 4; */ java.lang.String getPortrait(); /** * optional string portrait = 4; */ com.google.protobuf.ByteString getPortraitBytes(); // optional string mobile = 5; /** * optional string mobile = 5; */ boolean hasMobile(); /** * optional string mobile = 5; */ java.lang.String getMobile(); /** * optional string mobile = 5; */ com.google.protobuf.ByteString getMobileBytes(); // optional string email = 6; /** * optional string email = 6; */ boolean hasEmail(); /** * optional string email = 6; */ java.lang.String getEmail(); /** * optional string email = 6; */ com.google.protobuf.ByteString getEmailBytes(); // optional string address = 7; /** * optional string address = 7; */ boolean hasAddress(); /** * optional string address = 7; */ java.lang.String getAddress(); /** * optional string address = 7; */ com.google.protobuf.ByteString getAddressBytes(); // optional string company = 8; /** * optional string company = 8; */ boolean hasCompany(); /** * optional string company = 8; */ java.lang.String getCompany(); /** * optional string company = 8; */ com.google.protobuf.ByteString getCompanyBytes(); // optional string extra = 9; /** * optional string extra = 9; */ boolean hasExtra(); /** * optional string extra = 9; */ java.lang.String getExtra(); /** * optional string extra = 9; */ com.google.protobuf.ByteString getExtraBytes(); // optional int64 update_dt = 10; /** * optional int64 update_dt = 10; */ boolean hasUpdateDt(); /** * optional int64 update_dt = 10; */ long getUpdateDt(); // optional int32 gender = 11; /** * optional int32 gender = 11; */ boolean hasGender(); /** * optional int32 gender = 11; */ int getGender(); // optional string social = 12; /** * optional string social = 12; */ boolean hasSocial(); /** * optional string social = 12; */ java.lang.String getSocial(); /** * optional string social = 12; */ com.google.protobuf.ByteString getSocialBytes(); // optional int32 type = 13; /** * optional int32 type = 13; * *
     *0 normal user; 1 robot
     * 
*/ boolean hasType(); /** * optional int32 type = 13; * *
     *0 normal user; 1 robot
     * 
*/ int getType(); // optional int32 deleted = 14; /** * optional int32 deleted = 14; */ boolean hasDeleted(); /** * optional int32 deleted = 14; */ int getDeleted(); } /** * Protobuf type {@code User} */ public static final class User extends com.google.protobuf.GeneratedMessage implements UserOrBuilder { // Use User.newBuilder() to construct. private User(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private User(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final User defaultInstance; public static User getDefaultInstance() { return defaultInstance; } public User getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private User( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; uid_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; name_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; displayName_ = input.readBytes(); break; } case 34: { bitField0_ |= 0x00000008; portrait_ = input.readBytes(); break; } case 42: { bitField0_ |= 0x00000010; mobile_ = input.readBytes(); break; } case 50: { bitField0_ |= 0x00000020; email_ = input.readBytes(); break; } case 58: { bitField0_ |= 0x00000040; address_ = input.readBytes(); break; } case 66: { bitField0_ |= 0x00000080; company_ = input.readBytes(); break; } case 74: { bitField0_ |= 0x00000100; extra_ = input.readBytes(); break; } case 80: { bitField0_ |= 0x00000200; updateDt_ = input.readInt64(); break; } case 88: { bitField0_ |= 0x00000400; gender_ = input.readInt32(); break; } case 98: { bitField0_ |= 0x00000800; social_ = input.readBytes(); break; } case 104: { bitField0_ |= 0x00001000; type_ = input.readInt32(); break; } case 112: { bitField0_ |= 0x00002000; deleted_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_User_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_User_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.User.class, cn.wildfirechat.proto.WFCMessage.User.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public User parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new User(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string uid = 1; public static final int UID_FIELD_NUMBER = 1; private java.lang.Object uid_; /** * required string uid = 1; */ public boolean hasUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string uid = 1; */ public java.lang.String getUid() { java.lang.Object ref = uid_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { uid_ = s; } return s; } } /** * required string uid = 1; */ public com.google.protobuf.ByteString getUidBytes() { java.lang.Object ref = uid_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); uid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string name = 2; public static final int NAME_FIELD_NUMBER = 2; private java.lang.Object name_; /** * optional string name = 2; */ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional string name = 2; */ public java.lang.String getName() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { name_ = s; } return s; } } /** * optional string name = 2; */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string display_name = 3; public static final int DISPLAY_NAME_FIELD_NUMBER = 3; private java.lang.Object displayName_; /** * optional string display_name = 3; */ public boolean hasDisplayName() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string display_name = 3; */ public java.lang.String getDisplayName() { java.lang.Object ref = displayName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { displayName_ = s; } return s; } } /** * optional string display_name = 3; */ public com.google.protobuf.ByteString getDisplayNameBytes() { java.lang.Object ref = displayName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); displayName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string portrait = 4; public static final int PORTRAIT_FIELD_NUMBER = 4; private java.lang.Object portrait_; /** * optional string portrait = 4; */ public boolean hasPortrait() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string portrait = 4; */ public java.lang.String getPortrait() { java.lang.Object ref = portrait_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { portrait_ = s; } return s; } } /** * optional string portrait = 4; */ public com.google.protobuf.ByteString getPortraitBytes() { java.lang.Object ref = portrait_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); portrait_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string mobile = 5; public static final int MOBILE_FIELD_NUMBER = 5; private java.lang.Object mobile_; /** * optional string mobile = 5; */ public boolean hasMobile() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string mobile = 5; */ public java.lang.String getMobile() { java.lang.Object ref = mobile_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { mobile_ = s; } return s; } } /** * optional string mobile = 5; */ public com.google.protobuf.ByteString getMobileBytes() { java.lang.Object ref = mobile_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); mobile_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string email = 6; public static final int EMAIL_FIELD_NUMBER = 6; private java.lang.Object email_; /** * optional string email = 6; */ public boolean hasEmail() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string email = 6; */ public java.lang.String getEmail() { java.lang.Object ref = email_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { email_ = s; } return s; } } /** * optional string email = 6; */ public com.google.protobuf.ByteString getEmailBytes() { java.lang.Object ref = email_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); email_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string address = 7; public static final int ADDRESS_FIELD_NUMBER = 7; private java.lang.Object address_; /** * optional string address = 7; */ public boolean hasAddress() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string address = 7; */ public java.lang.String getAddress() { java.lang.Object ref = address_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { address_ = s; } return s; } } /** * optional string address = 7; */ public com.google.protobuf.ByteString getAddressBytes() { java.lang.Object ref = address_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); address_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string company = 8; public static final int COMPANY_FIELD_NUMBER = 8; private java.lang.Object company_; /** * optional string company = 8; */ public boolean hasCompany() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional string company = 8; */ public java.lang.String getCompany() { java.lang.Object ref = company_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { company_ = s; } return s; } } /** * optional string company = 8; */ public com.google.protobuf.ByteString getCompanyBytes() { java.lang.Object ref = company_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); company_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string extra = 9; public static final int EXTRA_FIELD_NUMBER = 9; private java.lang.Object extra_; /** * optional string extra = 9; */ public boolean hasExtra() { return ((bitField0_ & 0x00000100) == 0x00000100); } /** * optional string extra = 9; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 9; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int64 update_dt = 10; public static final int UPDATE_DT_FIELD_NUMBER = 10; private long updateDt_; /** * optional int64 update_dt = 10; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional int64 update_dt = 10; */ public long getUpdateDt() { return updateDt_; } // optional int32 gender = 11; public static final int GENDER_FIELD_NUMBER = 11; private int gender_; /** * optional int32 gender = 11; */ public boolean hasGender() { return ((bitField0_ & 0x00000400) == 0x00000400); } /** * optional int32 gender = 11; */ public int getGender() { return gender_; } // optional string social = 12; public static final int SOCIAL_FIELD_NUMBER = 12; private java.lang.Object social_; /** * optional string social = 12; */ public boolean hasSocial() { return ((bitField0_ & 0x00000800) == 0x00000800); } /** * optional string social = 12; */ public java.lang.String getSocial() { java.lang.Object ref = social_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { social_ = s; } return s; } } /** * optional string social = 12; */ public com.google.protobuf.ByteString getSocialBytes() { java.lang.Object ref = social_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); social_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 type = 13; public static final int TYPE_FIELD_NUMBER = 13; private int type_; /** * optional int32 type = 13; * *
     *0 normal user; 1 robot
     * 
*/ public boolean hasType() { return ((bitField0_ & 0x00001000) == 0x00001000); } /** * optional int32 type = 13; * *
     *0 normal user; 1 robot
     * 
*/ public int getType() { return type_; } // optional int32 deleted = 14; public static final int DELETED_FIELD_NUMBER = 14; private int deleted_; /** * optional int32 deleted = 14; */ public boolean hasDeleted() { return ((bitField0_ & 0x00002000) == 0x00002000); } /** * optional int32 deleted = 14; */ public int getDeleted() { return deleted_; } private void initFields() { uid_ = ""; name_ = ""; displayName_ = ""; portrait_ = ""; mobile_ = ""; email_ = ""; address_ = ""; company_ = ""; extra_ = ""; updateDt_ = 0L; gender_ = 0; social_ = ""; type_ = 0; deleted_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasUid()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getDisplayNameBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getPortraitBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBytes(5, getMobileBytes()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, getEmailBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, getAddressBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeBytes(8, getCompanyBytes()); } if (((bitField0_ & 0x00000100) == 0x00000100)) { output.writeBytes(9, getExtraBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { output.writeInt64(10, updateDt_); } if (((bitField0_ & 0x00000400) == 0x00000400)) { output.writeInt32(11, gender_); } if (((bitField0_ & 0x00000800) == 0x00000800)) { output.writeBytes(12, getSocialBytes()); } if (((bitField0_ & 0x00001000) == 0x00001000)) { output.writeInt32(13, type_); } if (((bitField0_ & 0x00002000) == 0x00002000)) { output.writeInt32(14, deleted_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getDisplayNameBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getPortraitBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(5, getMobileBytes()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(6, getEmailBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(7, getAddressBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(8, getCompanyBytes()); } if (((bitField0_ & 0x00000100) == 0x00000100)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(9, getExtraBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(10, updateDt_); } if (((bitField0_ & 0x00000400) == 0x00000400)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(11, gender_); } if (((bitField0_ & 0x00000800) == 0x00000800)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(12, getSocialBytes()); } if (((bitField0_ & 0x00001000) == 0x00001000)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(13, type_); } if (((bitField0_ & 0x00002000) == 0x00002000)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(14, deleted_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.User parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.User parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.User parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.User parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.User parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.User parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.User parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.User parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.User parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.User parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.User prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code User} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.UserOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_User_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_User_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.User.class, cn.wildfirechat.proto.WFCMessage.User.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.User.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); uid_ = ""; bitField0_ = (bitField0_ & ~0x00000001); name_ = ""; bitField0_ = (bitField0_ & ~0x00000002); displayName_ = ""; bitField0_ = (bitField0_ & ~0x00000004); portrait_ = ""; bitField0_ = (bitField0_ & ~0x00000008); mobile_ = ""; bitField0_ = (bitField0_ & ~0x00000010); email_ = ""; bitField0_ = (bitField0_ & ~0x00000020); address_ = ""; bitField0_ = (bitField0_ & ~0x00000040); company_ = ""; bitField0_ = (bitField0_ & ~0x00000080); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000100); updateDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000200); gender_ = 0; bitField0_ = (bitField0_ & ~0x00000400); social_ = ""; bitField0_ = (bitField0_ & ~0x00000800); type_ = 0; bitField0_ = (bitField0_ & ~0x00001000); deleted_ = 0; bitField0_ = (bitField0_ & ~0x00002000); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_User_descriptor; } public cn.wildfirechat.proto.WFCMessage.User getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.User.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.User build() { cn.wildfirechat.proto.WFCMessage.User result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.User buildPartial() { cn.wildfirechat.proto.WFCMessage.User result = new cn.wildfirechat.proto.WFCMessage.User(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.uid_ = uid_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.name_ = name_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.displayName_ = displayName_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.portrait_ = portrait_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.mobile_ = mobile_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.email_ = email_; if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000040; } result.address_ = address_; if (((from_bitField0_ & 0x00000080) == 0x00000080)) { to_bitField0_ |= 0x00000080; } result.company_ = company_; if (((from_bitField0_ & 0x00000100) == 0x00000100)) { to_bitField0_ |= 0x00000100; } result.extra_ = extra_; if (((from_bitField0_ & 0x00000200) == 0x00000200)) { to_bitField0_ |= 0x00000200; } result.updateDt_ = updateDt_; if (((from_bitField0_ & 0x00000400) == 0x00000400)) { to_bitField0_ |= 0x00000400; } result.gender_ = gender_; if (((from_bitField0_ & 0x00000800) == 0x00000800)) { to_bitField0_ |= 0x00000800; } result.social_ = social_; if (((from_bitField0_ & 0x00001000) == 0x00001000)) { to_bitField0_ |= 0x00001000; } result.type_ = type_; if (((from_bitField0_ & 0x00002000) == 0x00002000)) { to_bitField0_ |= 0x00002000; } result.deleted_ = deleted_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.User) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.User)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.User other) { if (other == cn.wildfirechat.proto.WFCMessage.User.getDefaultInstance()) return this; if (other.hasUid()) { bitField0_ |= 0x00000001; uid_ = other.uid_; onChanged(); } if (other.hasName()) { bitField0_ |= 0x00000002; name_ = other.name_; onChanged(); } if (other.hasDisplayName()) { bitField0_ |= 0x00000004; displayName_ = other.displayName_; onChanged(); } if (other.hasPortrait()) { bitField0_ |= 0x00000008; portrait_ = other.portrait_; onChanged(); } if (other.hasMobile()) { bitField0_ |= 0x00000010; mobile_ = other.mobile_; onChanged(); } if (other.hasEmail()) { bitField0_ |= 0x00000020; email_ = other.email_; onChanged(); } if (other.hasAddress()) { bitField0_ |= 0x00000040; address_ = other.address_; onChanged(); } if (other.hasCompany()) { bitField0_ |= 0x00000080; company_ = other.company_; onChanged(); } if (other.hasExtra()) { bitField0_ |= 0x00000100; extra_ = other.extra_; onChanged(); } if (other.hasUpdateDt()) { setUpdateDt(other.getUpdateDt()); } if (other.hasGender()) { setGender(other.getGender()); } if (other.hasSocial()) { bitField0_ |= 0x00000800; social_ = other.social_; onChanged(); } if (other.hasType()) { setType(other.getType()); } if (other.hasDeleted()) { setDeleted(other.getDeleted()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasUid()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.User parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.User) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string uid = 1; private java.lang.Object uid_ = ""; /** * required string uid = 1; */ public boolean hasUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string uid = 1; */ public java.lang.String getUid() { java.lang.Object ref = uid_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); uid_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string uid = 1; */ public com.google.protobuf.ByteString getUidBytes() { java.lang.Object ref = uid_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); uid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string uid = 1; */ public Builder setUid( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; uid_ = value; onChanged(); return this; } /** * required string uid = 1; */ public Builder clearUid() { bitField0_ = (bitField0_ & ~0x00000001); uid_ = getDefaultInstance().getUid(); onChanged(); return this; } /** * required string uid = 1; */ public Builder setUidBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; uid_ = value; onChanged(); return this; } // optional string name = 2; private java.lang.Object name_ = ""; /** * optional string name = 2; */ public boolean hasName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional string name = 2; */ public java.lang.String getName() { java.lang.Object ref = name_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); name_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string name = 2; */ public com.google.protobuf.ByteString getNameBytes() { java.lang.Object ref = name_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); name_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string name = 2; */ public Builder setName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; name_ = value; onChanged(); return this; } /** * optional string name = 2; */ public Builder clearName() { bitField0_ = (bitField0_ & ~0x00000002); name_ = getDefaultInstance().getName(); onChanged(); return this; } /** * optional string name = 2; */ public Builder setNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; name_ = value; onChanged(); return this; } // optional string display_name = 3; private java.lang.Object displayName_ = ""; /** * optional string display_name = 3; */ public boolean hasDisplayName() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string display_name = 3; */ public java.lang.String getDisplayName() { java.lang.Object ref = displayName_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); displayName_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string display_name = 3; */ public com.google.protobuf.ByteString getDisplayNameBytes() { java.lang.Object ref = displayName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); displayName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string display_name = 3; */ public Builder setDisplayName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; displayName_ = value; onChanged(); return this; } /** * optional string display_name = 3; */ public Builder clearDisplayName() { bitField0_ = (bitField0_ & ~0x00000004); displayName_ = getDefaultInstance().getDisplayName(); onChanged(); return this; } /** * optional string display_name = 3; */ public Builder setDisplayNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; displayName_ = value; onChanged(); return this; } // optional string portrait = 4; private java.lang.Object portrait_ = ""; /** * optional string portrait = 4; */ public boolean hasPortrait() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string portrait = 4; */ public java.lang.String getPortrait() { java.lang.Object ref = portrait_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); portrait_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string portrait = 4; */ public com.google.protobuf.ByteString getPortraitBytes() { java.lang.Object ref = portrait_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); portrait_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string portrait = 4; */ public Builder setPortrait( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; portrait_ = value; onChanged(); return this; } /** * optional string portrait = 4; */ public Builder clearPortrait() { bitField0_ = (bitField0_ & ~0x00000008); portrait_ = getDefaultInstance().getPortrait(); onChanged(); return this; } /** * optional string portrait = 4; */ public Builder setPortraitBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; portrait_ = value; onChanged(); return this; } // optional string mobile = 5; private java.lang.Object mobile_ = ""; /** * optional string mobile = 5; */ public boolean hasMobile() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string mobile = 5; */ public java.lang.String getMobile() { java.lang.Object ref = mobile_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); mobile_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string mobile = 5; */ public com.google.protobuf.ByteString getMobileBytes() { java.lang.Object ref = mobile_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); mobile_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string mobile = 5; */ public Builder setMobile( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; mobile_ = value; onChanged(); return this; } /** * optional string mobile = 5; */ public Builder clearMobile() { bitField0_ = (bitField0_ & ~0x00000010); mobile_ = getDefaultInstance().getMobile(); onChanged(); return this; } /** * optional string mobile = 5; */ public Builder setMobileBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; mobile_ = value; onChanged(); return this; } // optional string email = 6; private java.lang.Object email_ = ""; /** * optional string email = 6; */ public boolean hasEmail() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string email = 6; */ public java.lang.String getEmail() { java.lang.Object ref = email_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); email_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string email = 6; */ public com.google.protobuf.ByteString getEmailBytes() { java.lang.Object ref = email_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); email_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string email = 6; */ public Builder setEmail( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; email_ = value; onChanged(); return this; } /** * optional string email = 6; */ public Builder clearEmail() { bitField0_ = (bitField0_ & ~0x00000020); email_ = getDefaultInstance().getEmail(); onChanged(); return this; } /** * optional string email = 6; */ public Builder setEmailBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; email_ = value; onChanged(); return this; } // optional string address = 7; private java.lang.Object address_ = ""; /** * optional string address = 7; */ public boolean hasAddress() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string address = 7; */ public java.lang.String getAddress() { java.lang.Object ref = address_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); address_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string address = 7; */ public com.google.protobuf.ByteString getAddressBytes() { java.lang.Object ref = address_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); address_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string address = 7; */ public Builder setAddress( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; address_ = value; onChanged(); return this; } /** * optional string address = 7; */ public Builder clearAddress() { bitField0_ = (bitField0_ & ~0x00000040); address_ = getDefaultInstance().getAddress(); onChanged(); return this; } /** * optional string address = 7; */ public Builder setAddressBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; address_ = value; onChanged(); return this; } // optional string company = 8; private java.lang.Object company_ = ""; /** * optional string company = 8; */ public boolean hasCompany() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional string company = 8; */ public java.lang.String getCompany() { java.lang.Object ref = company_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); company_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string company = 8; */ public com.google.protobuf.ByteString getCompanyBytes() { java.lang.Object ref = company_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); company_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string company = 8; */ public Builder setCompany( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000080; company_ = value; onChanged(); return this; } /** * optional string company = 8; */ public Builder clearCompany() { bitField0_ = (bitField0_ & ~0x00000080); company_ = getDefaultInstance().getCompany(); onChanged(); return this; } /** * optional string company = 8; */ public Builder setCompanyBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000080; company_ = value; onChanged(); return this; } // optional string extra = 9; private java.lang.Object extra_ = ""; /** * optional string extra = 9; */ public boolean hasExtra() { return ((bitField0_ & 0x00000100) == 0x00000100); } /** * optional string extra = 9; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 9; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 9; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000100; extra_ = value; onChanged(); return this; } /** * optional string extra = 9; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000100); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 9; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000100; extra_ = value; onChanged(); return this; } // optional int64 update_dt = 10; private long updateDt_ ; /** * optional int64 update_dt = 10; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional int64 update_dt = 10; */ public long getUpdateDt() { return updateDt_; } /** * optional int64 update_dt = 10; */ public Builder setUpdateDt(long value) { bitField0_ |= 0x00000200; updateDt_ = value; onChanged(); return this; } /** * optional int64 update_dt = 10; */ public Builder clearUpdateDt() { bitField0_ = (bitField0_ & ~0x00000200); updateDt_ = 0L; onChanged(); return this; } // optional int32 gender = 11; private int gender_ ; /** * optional int32 gender = 11; */ public boolean hasGender() { return ((bitField0_ & 0x00000400) == 0x00000400); } /** * optional int32 gender = 11; */ public int getGender() { return gender_; } /** * optional int32 gender = 11; */ public Builder setGender(int value) { bitField0_ |= 0x00000400; gender_ = value; onChanged(); return this; } /** * optional int32 gender = 11; */ public Builder clearGender() { bitField0_ = (bitField0_ & ~0x00000400); gender_ = 0; onChanged(); return this; } // optional string social = 12; private java.lang.Object social_ = ""; /** * optional string social = 12; */ public boolean hasSocial() { return ((bitField0_ & 0x00000800) == 0x00000800); } /** * optional string social = 12; */ public java.lang.String getSocial() { java.lang.Object ref = social_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); social_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string social = 12; */ public com.google.protobuf.ByteString getSocialBytes() { java.lang.Object ref = social_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); social_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string social = 12; */ public Builder setSocial( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000800; social_ = value; onChanged(); return this; } /** * optional string social = 12; */ public Builder clearSocial() { bitField0_ = (bitField0_ & ~0x00000800); social_ = getDefaultInstance().getSocial(); onChanged(); return this; } /** * optional string social = 12; */ public Builder setSocialBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000800; social_ = value; onChanged(); return this; } // optional int32 type = 13; private int type_ ; /** * optional int32 type = 13; * *
       *0 normal user; 1 robot
       * 
*/ public boolean hasType() { return ((bitField0_ & 0x00001000) == 0x00001000); } /** * optional int32 type = 13; * *
       *0 normal user; 1 robot
       * 
*/ public int getType() { return type_; } /** * optional int32 type = 13; * *
       *0 normal user; 1 robot
       * 
*/ public Builder setType(int value) { bitField0_ |= 0x00001000; type_ = value; onChanged(); return this; } /** * optional int32 type = 13; * *
       *0 normal user; 1 robot
       * 
*/ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00001000); type_ = 0; onChanged(); return this; } // optional int32 deleted = 14; private int deleted_ ; /** * optional int32 deleted = 14; */ public boolean hasDeleted() { return ((bitField0_ & 0x00002000) == 0x00002000); } /** * optional int32 deleted = 14; */ public int getDeleted() { return deleted_; } /** * optional int32 deleted = 14; */ public Builder setDeleted(int value) { bitField0_ |= 0x00002000; deleted_ = value; onChanged(); return this; } /** * optional int32 deleted = 14; */ public Builder clearDeleted() { bitField0_ = (bitField0_ & ~0x00002000); deleted_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:User) } static { defaultInstance = new User(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:User) } public interface RobotOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string uid = 1; /** * required string uid = 1; */ boolean hasUid(); /** * required string uid = 1; */ java.lang.String getUid(); /** * required string uid = 1; */ com.google.protobuf.ByteString getUidBytes(); // required int32 state = 2; /** * required int32 state = 2; * *
     *0 normal; 1 deleted;
     * 
*/ boolean hasState(); /** * required int32 state = 2; * *
     *0 normal; 1 deleted;
     * 
*/ int getState(); // optional string owner = 3; /** * optional string owner = 3; */ boolean hasOwner(); /** * optional string owner = 3; */ java.lang.String getOwner(); /** * optional string owner = 3; */ com.google.protobuf.ByteString getOwnerBytes(); // optional string secret = 4; /** * optional string secret = 4; */ boolean hasSecret(); /** * optional string secret = 4; */ java.lang.String getSecret(); /** * optional string secret = 4; */ com.google.protobuf.ByteString getSecretBytes(); // optional string callback = 5; /** * optional string callback = 5; */ boolean hasCallback(); /** * optional string callback = 5; */ java.lang.String getCallback(); /** * optional string callback = 5; */ com.google.protobuf.ByteString getCallbackBytes(); // optional string extra = 6; /** * optional string extra = 6; */ boolean hasExtra(); /** * optional string extra = 6; */ java.lang.String getExtra(); /** * optional string extra = 6; */ com.google.protobuf.ByteString getExtraBytes(); } /** * Protobuf type {@code Robot} */ public static final class Robot extends com.google.protobuf.GeneratedMessage implements RobotOrBuilder { // Use Robot.newBuilder() to construct. private Robot(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private Robot(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final Robot defaultInstance; public static Robot getDefaultInstance() { return defaultInstance; } public Robot getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Robot( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; uid_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; state_ = input.readInt32(); break; } case 26: { bitField0_ |= 0x00000004; owner_ = input.readBytes(); break; } case 34: { bitField0_ |= 0x00000008; secret_ = input.readBytes(); break; } case 42: { bitField0_ |= 0x00000010; callback_ = input.readBytes(); break; } case 50: { bitField0_ |= 0x00000020; extra_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_Robot_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_Robot_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.Robot.class, cn.wildfirechat.proto.WFCMessage.Robot.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public Robot parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Robot(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string uid = 1; public static final int UID_FIELD_NUMBER = 1; private java.lang.Object uid_; /** * required string uid = 1; */ public boolean hasUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string uid = 1; */ public java.lang.String getUid() { java.lang.Object ref = uid_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { uid_ = s; } return s; } } /** * required string uid = 1; */ public com.google.protobuf.ByteString getUidBytes() { java.lang.Object ref = uid_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); uid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 state = 2; public static final int STATE_FIELD_NUMBER = 2; private int state_; /** * required int32 state = 2; * *
     *0 normal; 1 deleted;
     * 
*/ public boolean hasState() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 state = 2; * *
     *0 normal; 1 deleted;
     * 
*/ public int getState() { return state_; } // optional string owner = 3; public static final int OWNER_FIELD_NUMBER = 3; private java.lang.Object owner_; /** * optional string owner = 3; */ public boolean hasOwner() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string owner = 3; */ public java.lang.String getOwner() { java.lang.Object ref = owner_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { owner_ = s; } return s; } } /** * optional string owner = 3; */ public com.google.protobuf.ByteString getOwnerBytes() { java.lang.Object ref = owner_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); owner_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string secret = 4; public static final int SECRET_FIELD_NUMBER = 4; private java.lang.Object secret_; /** * optional string secret = 4; */ public boolean hasSecret() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string secret = 4; */ public java.lang.String getSecret() { java.lang.Object ref = secret_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { secret_ = s; } return s; } } /** * optional string secret = 4; */ public com.google.protobuf.ByteString getSecretBytes() { java.lang.Object ref = secret_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); secret_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string callback = 5; public static final int CALLBACK_FIELD_NUMBER = 5; private java.lang.Object callback_; /** * optional string callback = 5; */ public boolean hasCallback() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string callback = 5; */ public java.lang.String getCallback() { java.lang.Object ref = callback_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { callback_ = s; } return s; } } /** * optional string callback = 5; */ public com.google.protobuf.ByteString getCallbackBytes() { java.lang.Object ref = callback_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); callback_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string extra = 6; public static final int EXTRA_FIELD_NUMBER = 6; private java.lang.Object extra_; /** * optional string extra = 6; */ public boolean hasExtra() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string extra = 6; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 6; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { uid_ = ""; state_ = 0; owner_ = ""; secret_ = ""; callback_ = ""; extra_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasUid()) { memoizedIsInitialized = 0; return false; } if (!hasState()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, state_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getOwnerBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getSecretBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBytes(5, getCallbackBytes()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, getExtraBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, state_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getOwnerBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getSecretBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(5, getCallbackBytes()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(6, getExtraBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.Robot parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.Robot parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Robot parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.Robot parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Robot parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Robot parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Robot parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Robot parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Robot parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Robot parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.Robot prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code Robot} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.RobotOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_Robot_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_Robot_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.Robot.class, cn.wildfirechat.proto.WFCMessage.Robot.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.Robot.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); uid_ = ""; bitField0_ = (bitField0_ & ~0x00000001); state_ = 0; bitField0_ = (bitField0_ & ~0x00000002); owner_ = ""; bitField0_ = (bitField0_ & ~0x00000004); secret_ = ""; bitField0_ = (bitField0_ & ~0x00000008); callback_ = ""; bitField0_ = (bitField0_ & ~0x00000010); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000020); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_Robot_descriptor; } public cn.wildfirechat.proto.WFCMessage.Robot getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.Robot.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.Robot build() { cn.wildfirechat.proto.WFCMessage.Robot result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.Robot buildPartial() { cn.wildfirechat.proto.WFCMessage.Robot result = new cn.wildfirechat.proto.WFCMessage.Robot(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.uid_ = uid_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.state_ = state_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.owner_ = owner_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.secret_ = secret_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.callback_ = callback_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.extra_ = extra_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.Robot) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.Robot)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.Robot other) { if (other == cn.wildfirechat.proto.WFCMessage.Robot.getDefaultInstance()) return this; if (other.hasUid()) { bitField0_ |= 0x00000001; uid_ = other.uid_; onChanged(); } if (other.hasState()) { setState(other.getState()); } if (other.hasOwner()) { bitField0_ |= 0x00000004; owner_ = other.owner_; onChanged(); } if (other.hasSecret()) { bitField0_ |= 0x00000008; secret_ = other.secret_; onChanged(); } if (other.hasCallback()) { bitField0_ |= 0x00000010; callback_ = other.callback_; onChanged(); } if (other.hasExtra()) { bitField0_ |= 0x00000020; extra_ = other.extra_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasUid()) { return false; } if (!hasState()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.Robot parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.Robot) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string uid = 1; private java.lang.Object uid_ = ""; /** * required string uid = 1; */ public boolean hasUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string uid = 1; */ public java.lang.String getUid() { java.lang.Object ref = uid_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); uid_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string uid = 1; */ public com.google.protobuf.ByteString getUidBytes() { java.lang.Object ref = uid_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); uid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string uid = 1; */ public Builder setUid( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; uid_ = value; onChanged(); return this; } /** * required string uid = 1; */ public Builder clearUid() { bitField0_ = (bitField0_ & ~0x00000001); uid_ = getDefaultInstance().getUid(); onChanged(); return this; } /** * required string uid = 1; */ public Builder setUidBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; uid_ = value; onChanged(); return this; } // required int32 state = 2; private int state_ ; /** * required int32 state = 2; * *
       *0 normal; 1 deleted;
       * 
*/ public boolean hasState() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 state = 2; * *
       *0 normal; 1 deleted;
       * 
*/ public int getState() { return state_; } /** * required int32 state = 2; * *
       *0 normal; 1 deleted;
       * 
*/ public Builder setState(int value) { bitField0_ |= 0x00000002; state_ = value; onChanged(); return this; } /** * required int32 state = 2; * *
       *0 normal; 1 deleted;
       * 
*/ public Builder clearState() { bitField0_ = (bitField0_ & ~0x00000002); state_ = 0; onChanged(); return this; } // optional string owner = 3; private java.lang.Object owner_ = ""; /** * optional string owner = 3; */ public boolean hasOwner() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string owner = 3; */ public java.lang.String getOwner() { java.lang.Object ref = owner_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); owner_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string owner = 3; */ public com.google.protobuf.ByteString getOwnerBytes() { java.lang.Object ref = owner_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); owner_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string owner = 3; */ public Builder setOwner( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; owner_ = value; onChanged(); return this; } /** * optional string owner = 3; */ public Builder clearOwner() { bitField0_ = (bitField0_ & ~0x00000004); owner_ = getDefaultInstance().getOwner(); onChanged(); return this; } /** * optional string owner = 3; */ public Builder setOwnerBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; owner_ = value; onChanged(); return this; } // optional string secret = 4; private java.lang.Object secret_ = ""; /** * optional string secret = 4; */ public boolean hasSecret() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string secret = 4; */ public java.lang.String getSecret() { java.lang.Object ref = secret_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); secret_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string secret = 4; */ public com.google.protobuf.ByteString getSecretBytes() { java.lang.Object ref = secret_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); secret_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string secret = 4; */ public Builder setSecret( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; secret_ = value; onChanged(); return this; } /** * optional string secret = 4; */ public Builder clearSecret() { bitField0_ = (bitField0_ & ~0x00000008); secret_ = getDefaultInstance().getSecret(); onChanged(); return this; } /** * optional string secret = 4; */ public Builder setSecretBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; secret_ = value; onChanged(); return this; } // optional string callback = 5; private java.lang.Object callback_ = ""; /** * optional string callback = 5; */ public boolean hasCallback() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string callback = 5; */ public java.lang.String getCallback() { java.lang.Object ref = callback_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); callback_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string callback = 5; */ public com.google.protobuf.ByteString getCallbackBytes() { java.lang.Object ref = callback_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); callback_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string callback = 5; */ public Builder setCallback( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; callback_ = value; onChanged(); return this; } /** * optional string callback = 5; */ public Builder clearCallback() { bitField0_ = (bitField0_ & ~0x00000010); callback_ = getDefaultInstance().getCallback(); onChanged(); return this; } /** * optional string callback = 5; */ public Builder setCallbackBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; callback_ = value; onChanged(); return this; } // optional string extra = 6; private java.lang.Object extra_ = ""; /** * optional string extra = 6; */ public boolean hasExtra() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string extra = 6; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 6; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 6; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; extra_ = value; onChanged(); return this; } /** * optional string extra = 6; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000020); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 6; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; extra_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:Robot) } static { defaultInstance = new Robot(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:Robot) } public interface GetRobotsResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .Robot entry = 1; /** * repeated .Robot entry = 1; */ java.util.List getEntryList(); /** * repeated .Robot entry = 1; */ cn.wildfirechat.proto.WFCMessage.Robot getEntry(int index); /** * repeated .Robot entry = 1; */ int getEntryCount(); /** * repeated .Robot entry = 1; */ java.util.List getEntryOrBuilderList(); /** * repeated .Robot entry = 1; */ cn.wildfirechat.proto.WFCMessage.RobotOrBuilder getEntryOrBuilder( int index); } /** * Protobuf type {@code GetRobotsResult} */ public static final class GetRobotsResult extends com.google.protobuf.GeneratedMessage implements GetRobotsResultOrBuilder { // Use GetRobotsResult.newBuilder() to construct. private GetRobotsResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private GetRobotsResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final GetRobotsResult defaultInstance; public static GetRobotsResult getDefaultInstance() { return defaultInstance; } public GetRobotsResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GetRobotsResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { entry_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } entry_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.Robot.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { entry_ = java.util.Collections.unmodifiableList(entry_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetRobotsResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetRobotsResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetRobotsResult.class, cn.wildfirechat.proto.WFCMessage.GetRobotsResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public GetRobotsResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GetRobotsResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } // repeated .Robot entry = 1; public static final int ENTRY_FIELD_NUMBER = 1; private java.util.List entry_; /** * repeated .Robot entry = 1; */ public java.util.List getEntryList() { return entry_; } /** * repeated .Robot entry = 1; */ public java.util.List getEntryOrBuilderList() { return entry_; } /** * repeated .Robot entry = 1; */ public int getEntryCount() { return entry_.size(); } /** * repeated .Robot entry = 1; */ public cn.wildfirechat.proto.WFCMessage.Robot getEntry(int index) { return entry_.get(index); } /** * repeated .Robot entry = 1; */ public cn.wildfirechat.proto.WFCMessage.RobotOrBuilder getEntryOrBuilder( int index) { return entry_.get(index); } private void initFields() { entry_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getEntryCount(); i++) { if (!getEntry(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < entry_.size(); i++) { output.writeMessage(1, entry_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < entry_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, entry_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.GetRobotsResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetRobotsResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetRobotsResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetRobotsResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetRobotsResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetRobotsResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetRobotsResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetRobotsResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetRobotsResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetRobotsResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.GetRobotsResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code GetRobotsResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GetRobotsResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetRobotsResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetRobotsResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetRobotsResult.class, cn.wildfirechat.proto.WFCMessage.GetRobotsResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.GetRobotsResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getEntryFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (entryBuilder_ == null) { entry_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { entryBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetRobotsResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.GetRobotsResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.GetRobotsResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.GetRobotsResult build() { cn.wildfirechat.proto.WFCMessage.GetRobotsResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.GetRobotsResult buildPartial() { cn.wildfirechat.proto.WFCMessage.GetRobotsResult result = new cn.wildfirechat.proto.WFCMessage.GetRobotsResult(this); int from_bitField0_ = bitField0_; if (entryBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { entry_ = java.util.Collections.unmodifiableList(entry_); bitField0_ = (bitField0_ & ~0x00000001); } result.entry_ = entry_; } else { result.entry_ = entryBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.GetRobotsResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.GetRobotsResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.GetRobotsResult other) { if (other == cn.wildfirechat.proto.WFCMessage.GetRobotsResult.getDefaultInstance()) return this; if (entryBuilder_ == null) { if (!other.entry_.isEmpty()) { if (entry_.isEmpty()) { entry_ = other.entry_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureEntryIsMutable(); entry_.addAll(other.entry_); } onChanged(); } } else { if (!other.entry_.isEmpty()) { if (entryBuilder_.isEmpty()) { entryBuilder_.dispose(); entryBuilder_ = null; entry_ = other.entry_; bitField0_ = (bitField0_ & ~0x00000001); entryBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getEntryFieldBuilder() : null; } else { entryBuilder_.addAllMessages(other.entry_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { for (int i = 0; i < getEntryCount(); i++) { if (!getEntry(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.GetRobotsResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.GetRobotsResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .Robot entry = 1; private java.util.List entry_ = java.util.Collections.emptyList(); private void ensureEntryIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { entry_ = new java.util.ArrayList(entry_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.Robot, cn.wildfirechat.proto.WFCMessage.Robot.Builder, cn.wildfirechat.proto.WFCMessage.RobotOrBuilder> entryBuilder_; /** * repeated .Robot entry = 1; */ public java.util.List getEntryList() { if (entryBuilder_ == null) { return java.util.Collections.unmodifiableList(entry_); } else { return entryBuilder_.getMessageList(); } } /** * repeated .Robot entry = 1; */ public int getEntryCount() { if (entryBuilder_ == null) { return entry_.size(); } else { return entryBuilder_.getCount(); } } /** * repeated .Robot entry = 1; */ public cn.wildfirechat.proto.WFCMessage.Robot getEntry(int index) { if (entryBuilder_ == null) { return entry_.get(index); } else { return entryBuilder_.getMessage(index); } } /** * repeated .Robot entry = 1; */ public Builder setEntry( int index, cn.wildfirechat.proto.WFCMessage.Robot value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.set(index, value); onChanged(); } else { entryBuilder_.setMessage(index, value); } return this; } /** * repeated .Robot entry = 1; */ public Builder setEntry( int index, cn.wildfirechat.proto.WFCMessage.Robot.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.set(index, builderForValue.build()); onChanged(); } else { entryBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .Robot entry = 1; */ public Builder addEntry(cn.wildfirechat.proto.WFCMessage.Robot value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.add(value); onChanged(); } else { entryBuilder_.addMessage(value); } return this; } /** * repeated .Robot entry = 1; */ public Builder addEntry( int index, cn.wildfirechat.proto.WFCMessage.Robot value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.add(index, value); onChanged(); } else { entryBuilder_.addMessage(index, value); } return this; } /** * repeated .Robot entry = 1; */ public Builder addEntry( cn.wildfirechat.proto.WFCMessage.Robot.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.add(builderForValue.build()); onChanged(); } else { entryBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .Robot entry = 1; */ public Builder addEntry( int index, cn.wildfirechat.proto.WFCMessage.Robot.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.add(index, builderForValue.build()); onChanged(); } else { entryBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .Robot entry = 1; */ public Builder addAllEntry( java.lang.Iterable values) { if (entryBuilder_ == null) { ensureEntryIsMutable(); super.addAll(values, entry_); onChanged(); } else { entryBuilder_.addAllMessages(values); } return this; } /** * repeated .Robot entry = 1; */ public Builder clearEntry() { if (entryBuilder_ == null) { entry_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { entryBuilder_.clear(); } return this; } /** * repeated .Robot entry = 1; */ public Builder removeEntry(int index) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.remove(index); onChanged(); } else { entryBuilder_.remove(index); } return this; } /** * repeated .Robot entry = 1; */ public cn.wildfirechat.proto.WFCMessage.Robot.Builder getEntryBuilder( int index) { return getEntryFieldBuilder().getBuilder(index); } /** * repeated .Robot entry = 1; */ public cn.wildfirechat.proto.WFCMessage.RobotOrBuilder getEntryOrBuilder( int index) { if (entryBuilder_ == null) { return entry_.get(index); } else { return entryBuilder_.getMessageOrBuilder(index); } } /** * repeated .Robot entry = 1; */ public java.util.List getEntryOrBuilderList() { if (entryBuilder_ != null) { return entryBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(entry_); } } /** * repeated .Robot entry = 1; */ public cn.wildfirechat.proto.WFCMessage.Robot.Builder addEntryBuilder() { return getEntryFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.Robot.getDefaultInstance()); } /** * repeated .Robot entry = 1; */ public cn.wildfirechat.proto.WFCMessage.Robot.Builder addEntryBuilder( int index) { return getEntryFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.Robot.getDefaultInstance()); } /** * repeated .Robot entry = 1; */ public java.util.List getEntryBuilderList() { return getEntryFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.Robot, cn.wildfirechat.proto.WFCMessage.Robot.Builder, cn.wildfirechat.proto.WFCMessage.RobotOrBuilder> getEntryFieldBuilder() { if (entryBuilder_ == null) { entryBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.Robot, cn.wildfirechat.proto.WFCMessage.Robot.Builder, cn.wildfirechat.proto.WFCMessage.RobotOrBuilder>( entry_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); entry_ = null; } return entryBuilder_; } // @@protoc_insertion_point(builder_scope:GetRobotsResult) } static { defaultInstance = new GetRobotsResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:GetRobotsResult) } public interface UploadDeviceTokenRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int32 platform = 1; /** * required int32 platform = 1; */ boolean hasPlatform(); /** * required int32 platform = 1; */ int getPlatform(); // required string app_name = 2; /** * required string app_name = 2; */ boolean hasAppName(); /** * required string app_name = 2; */ java.lang.String getAppName(); /** * required string app_name = 2; */ com.google.protobuf.ByteString getAppNameBytes(); // required string device_token = 3; /** * required string device_token = 3; */ boolean hasDeviceToken(); /** * required string device_token = 3; */ java.lang.String getDeviceToken(); /** * required string device_token = 3; */ com.google.protobuf.ByteString getDeviceTokenBytes(); // required int32 push_type = 4; /** * required int32 push_type = 4; */ boolean hasPushType(); /** * required int32 push_type = 4; */ int getPushType(); } /** * Protobuf type {@code UploadDeviceTokenRequest} */ public static final class UploadDeviceTokenRequest extends com.google.protobuf.GeneratedMessage implements UploadDeviceTokenRequestOrBuilder { // Use UploadDeviceTokenRequest.newBuilder() to construct. private UploadDeviceTokenRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private UploadDeviceTokenRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final UploadDeviceTokenRequest defaultInstance; public static UploadDeviceTokenRequest getDefaultInstance() { return defaultInstance; } public UploadDeviceTokenRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private UploadDeviceTokenRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; platform_ = input.readInt32(); break; } case 18: { bitField0_ |= 0x00000002; appName_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; deviceToken_ = input.readBytes(); break; } case 32: { bitField0_ |= 0x00000008; pushType_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_UploadDeviceTokenRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_UploadDeviceTokenRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest.class, cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public UploadDeviceTokenRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new UploadDeviceTokenRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int32 platform = 1; public static final int PLATFORM_FIELD_NUMBER = 1; private int platform_; /** * required int32 platform = 1; */ public boolean hasPlatform() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 platform = 1; */ public int getPlatform() { return platform_; } // required string app_name = 2; public static final int APP_NAME_FIELD_NUMBER = 2; private java.lang.Object appName_; /** * required string app_name = 2; */ public boolean hasAppName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string app_name = 2; */ public java.lang.String getAppName() { java.lang.Object ref = appName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { appName_ = s; } return s; } } /** * required string app_name = 2; */ public com.google.protobuf.ByteString getAppNameBytes() { java.lang.Object ref = appName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); appName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string device_token = 3; public static final int DEVICE_TOKEN_FIELD_NUMBER = 3; private java.lang.Object deviceToken_; /** * required string device_token = 3; */ public boolean hasDeviceToken() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string device_token = 3; */ public java.lang.String getDeviceToken() { java.lang.Object ref = deviceToken_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { deviceToken_ = s; } return s; } } /** * required string device_token = 3; */ public com.google.protobuf.ByteString getDeviceTokenBytes() { java.lang.Object ref = deviceToken_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); deviceToken_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 push_type = 4; public static final int PUSH_TYPE_FIELD_NUMBER = 4; private int pushType_; /** * required int32 push_type = 4; */ public boolean hasPushType() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * required int32 push_type = 4; */ public int getPushType() { return pushType_; } private void initFields() { platform_ = 0; appName_ = ""; deviceToken_ = ""; pushType_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasPlatform()) { memoizedIsInitialized = 0; return false; } if (!hasAppName()) { memoizedIsInitialized = 0; return false; } if (!hasDeviceToken()) { memoizedIsInitialized = 0; return false; } if (!hasPushType()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, platform_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getAppNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getDeviceTokenBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeInt32(4, pushType_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, platform_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getAppNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getDeviceTokenBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(4, pushType_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code UploadDeviceTokenRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_UploadDeviceTokenRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_UploadDeviceTokenRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest.class, cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); platform_ = 0; bitField0_ = (bitField0_ & ~0x00000001); appName_ = ""; bitField0_ = (bitField0_ & ~0x00000002); deviceToken_ = ""; bitField0_ = (bitField0_ & ~0x00000004); pushType_ = 0; bitField0_ = (bitField0_ & ~0x00000008); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_UploadDeviceTokenRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest build() { cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest result = new cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.platform_ = platform_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.appName_ = appName_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.deviceToken_ = deviceToken_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.pushType_ = pushType_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest.getDefaultInstance()) return this; if (other.hasPlatform()) { setPlatform(other.getPlatform()); } if (other.hasAppName()) { bitField0_ |= 0x00000002; appName_ = other.appName_; onChanged(); } if (other.hasDeviceToken()) { bitField0_ |= 0x00000004; deviceToken_ = other.deviceToken_; onChanged(); } if (other.hasPushType()) { setPushType(other.getPushType()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasPlatform()) { return false; } if (!hasAppName()) { return false; } if (!hasDeviceToken()) { return false; } if (!hasPushType()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.UploadDeviceTokenRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int32 platform = 1; private int platform_ ; /** * required int32 platform = 1; */ public boolean hasPlatform() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 platform = 1; */ public int getPlatform() { return platform_; } /** * required int32 platform = 1; */ public Builder setPlatform(int value) { bitField0_ |= 0x00000001; platform_ = value; onChanged(); return this; } /** * required int32 platform = 1; */ public Builder clearPlatform() { bitField0_ = (bitField0_ & ~0x00000001); platform_ = 0; onChanged(); return this; } // required string app_name = 2; private java.lang.Object appName_ = ""; /** * required string app_name = 2; */ public boolean hasAppName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string app_name = 2; */ public java.lang.String getAppName() { java.lang.Object ref = appName_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); appName_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string app_name = 2; */ public com.google.protobuf.ByteString getAppNameBytes() { java.lang.Object ref = appName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); appName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string app_name = 2; */ public Builder setAppName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; appName_ = value; onChanged(); return this; } /** * required string app_name = 2; */ public Builder clearAppName() { bitField0_ = (bitField0_ & ~0x00000002); appName_ = getDefaultInstance().getAppName(); onChanged(); return this; } /** * required string app_name = 2; */ public Builder setAppNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; appName_ = value; onChanged(); return this; } // required string device_token = 3; private java.lang.Object deviceToken_ = ""; /** * required string device_token = 3; */ public boolean hasDeviceToken() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string device_token = 3; */ public java.lang.String getDeviceToken() { java.lang.Object ref = deviceToken_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); deviceToken_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string device_token = 3; */ public com.google.protobuf.ByteString getDeviceTokenBytes() { java.lang.Object ref = deviceToken_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); deviceToken_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string device_token = 3; */ public Builder setDeviceToken( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; deviceToken_ = value; onChanged(); return this; } /** * required string device_token = 3; */ public Builder clearDeviceToken() { bitField0_ = (bitField0_ & ~0x00000004); deviceToken_ = getDefaultInstance().getDeviceToken(); onChanged(); return this; } /** * required string device_token = 3; */ public Builder setDeviceTokenBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; deviceToken_ = value; onChanged(); return this; } // required int32 push_type = 4; private int pushType_ ; /** * required int32 push_type = 4; */ public boolean hasPushType() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * required int32 push_type = 4; */ public int getPushType() { return pushType_; } /** * required int32 push_type = 4; */ public Builder setPushType(int value) { bitField0_ |= 0x00000008; pushType_ = value; onChanged(); return this; } /** * required int32 push_type = 4; */ public Builder clearPushType() { bitField0_ = (bitField0_ & ~0x00000008); pushType_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:UploadDeviceTokenRequest) } static { defaultInstance = new UploadDeviceTokenRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:UploadDeviceTokenRequest) } public interface ModifyGroupInfoRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string group_id = 1; /** * required string group_id = 1; */ boolean hasGroupId(); /** * required string group_id = 1; */ java.lang.String getGroupId(); /** * required string group_id = 1; */ com.google.protobuf.ByteString getGroupIdBytes(); // required int32 type = 2; /** * required int32 type = 2; */ boolean hasType(); /** * required int32 type = 2; */ int getType(); // required string value = 3; /** * required string value = 3; */ boolean hasValue(); /** * required string value = 3; */ java.lang.String getValue(); /** * required string value = 3; */ com.google.protobuf.ByteString getValueBytes(); // repeated int32 to_line = 4; /** * repeated int32 to_line = 4; */ java.util.List getToLineList(); /** * repeated int32 to_line = 4; */ int getToLineCount(); /** * repeated int32 to_line = 4; */ int getToLine(int index); // optional .MessageContent notify_content = 5; /** * optional .MessageContent notify_content = 5; */ boolean hasNotifyContent(); /** * optional .MessageContent notify_content = 5; */ cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent(); /** * optional .MessageContent notify_content = 5; */ cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder(); } /** * Protobuf type {@code ModifyGroupInfoRequest} */ public static final class ModifyGroupInfoRequest extends com.google.protobuf.GeneratedMessage implements ModifyGroupInfoRequestOrBuilder { // Use ModifyGroupInfoRequest.newBuilder() to construct. private ModifyGroupInfoRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ModifyGroupInfoRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ModifyGroupInfoRequest defaultInstance; public static ModifyGroupInfoRequest getDefaultInstance() { return defaultInstance; } public ModifyGroupInfoRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ModifyGroupInfoRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; groupId_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; type_ = input.readInt32(); break; } case 26: { bitField0_ |= 0x00000004; value_ = input.readBytes(); break; } case 32: { if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000008; } toLine_.add(input.readInt32()); break; } case 34: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000008) == 0x00000008) && input.getBytesUntilLimit() > 0) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000008; } while (input.getBytesUntilLimit() > 0) { toLine_.add(input.readInt32()); } input.popLimit(limit); break; } case 42: { cn.wildfirechat.proto.WFCMessage.MessageContent.Builder subBuilder = null; if (((bitField0_ & 0x00000008) == 0x00000008)) { subBuilder = notifyContent_.toBuilder(); } notifyContent_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.MessageContent.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(notifyContent_); notifyContent_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000008; break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupInfoRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupInfoRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest.class, cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ModifyGroupInfoRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ModifyGroupInfoRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string group_id = 1; public static final int GROUP_ID_FIELD_NUMBER = 1; private java.lang.Object groupId_; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { groupId_ = s; } return s; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 type = 2; public static final int TYPE_FIELD_NUMBER = 2; private int type_; /** * required int32 type = 2; */ public boolean hasType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 type = 2; */ public int getType() { return type_; } // required string value = 3; public static final int VALUE_FIELD_NUMBER = 3; private java.lang.Object value_; /** * required string value = 3; */ public boolean hasValue() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string value = 3; */ public java.lang.String getValue() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { value_ = s; } return s; } } /** * required string value = 3; */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // repeated int32 to_line = 4; public static final int TO_LINE_FIELD_NUMBER = 4; private java.util.List toLine_; /** * repeated int32 to_line = 4; */ public java.util.List getToLineList() { return toLine_; } /** * repeated int32 to_line = 4; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 4; */ public int getToLine(int index) { return toLine_.get(index); } // optional .MessageContent notify_content = 5; public static final int NOTIFY_CONTENT_FIELD_NUMBER = 5; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_; /** * optional .MessageContent notify_content = 5; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional .MessageContent notify_content = 5; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { return notifyContent_; } /** * optional .MessageContent notify_content = 5; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { return notifyContent_; } private void initFields() { groupId_ = ""; type_ = 0; value_ = ""; toLine_ = java.util.Collections.emptyList(); notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasGroupId()) { memoizedIsInitialized = 0; return false; } if (!hasType()) { memoizedIsInitialized = 0; return false; } if (!hasValue()) { memoizedIsInitialized = 0; return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getGroupIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, type_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getValueBytes()); } for (int i = 0; i < toLine_.size(); i++) { output.writeInt32(4, toLine_.get(i)); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeMessage(5, notifyContent_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getGroupIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, type_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getValueBytes()); } { int dataSize = 0; for (int i = 0; i < toLine_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(toLine_.get(i)); } size += dataSize; size += 1 * getToLineList().size(); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(5, notifyContent_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ModifyGroupInfoRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupInfoRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupInfoRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest.class, cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getNotifyContentFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); groupId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); type_ = 0; bitField0_ = (bitField0_ & ~0x00000002); value_ = ""; bitField0_ = (bitField0_ & ~0x00000004); toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000008); if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000010); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupInfoRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest build() { cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest result = new cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.groupId_ = groupId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.type_ = type_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.value_ = value_; if (((bitField0_ & 0x00000008) == 0x00000008)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); bitField0_ = (bitField0_ & ~0x00000008); } result.toLine_ = toLine_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000008; } if (notifyContentBuilder_ == null) { result.notifyContent_ = notifyContent_; } else { result.notifyContent_ = notifyContentBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest.getDefaultInstance()) return this; if (other.hasGroupId()) { bitField0_ |= 0x00000001; groupId_ = other.groupId_; onChanged(); } if (other.hasType()) { setType(other.getType()); } if (other.hasValue()) { bitField0_ |= 0x00000004; value_ = other.value_; onChanged(); } if (!other.toLine_.isEmpty()) { if (toLine_.isEmpty()) { toLine_ = other.toLine_; bitField0_ = (bitField0_ & ~0x00000008); } else { ensureToLineIsMutable(); toLine_.addAll(other.toLine_); } onChanged(); } if (other.hasNotifyContent()) { mergeNotifyContent(other.getNotifyContent()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasGroupId()) { return false; } if (!hasType()) { return false; } if (!hasValue()) { return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ModifyGroupInfoRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string group_id = 1; private java.lang.Object groupId_ = ""; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); groupId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string group_id = 1; */ public Builder setGroupId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } /** * required string group_id = 1; */ public Builder clearGroupId() { bitField0_ = (bitField0_ & ~0x00000001); groupId_ = getDefaultInstance().getGroupId(); onChanged(); return this; } /** * required string group_id = 1; */ public Builder setGroupIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } // required int32 type = 2; private int type_ ; /** * required int32 type = 2; */ public boolean hasType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 type = 2; */ public int getType() { return type_; } /** * required int32 type = 2; */ public Builder setType(int value) { bitField0_ |= 0x00000002; type_ = value; onChanged(); return this; } /** * required int32 type = 2; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000002); type_ = 0; onChanged(); return this; } // required string value = 3; private java.lang.Object value_ = ""; /** * required string value = 3; */ public boolean hasValue() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string value = 3; */ public java.lang.String getValue() { java.lang.Object ref = value_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); value_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string value = 3; */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string value = 3; */ public Builder setValue( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; value_ = value; onChanged(); return this; } /** * required string value = 3; */ public Builder clearValue() { bitField0_ = (bitField0_ & ~0x00000004); value_ = getDefaultInstance().getValue(); onChanged(); return this; } /** * required string value = 3; */ public Builder setValueBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; value_ = value; onChanged(); return this; } // repeated int32 to_line = 4; private java.util.List toLine_ = java.util.Collections.emptyList(); private void ensureToLineIsMutable() { if (!((bitField0_ & 0x00000008) == 0x00000008)) { toLine_ = new java.util.ArrayList(toLine_); bitField0_ |= 0x00000008; } } /** * repeated int32 to_line = 4; */ public java.util.List getToLineList() { return java.util.Collections.unmodifiableList(toLine_); } /** * repeated int32 to_line = 4; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 4; */ public int getToLine(int index) { return toLine_.get(index); } /** * repeated int32 to_line = 4; */ public Builder setToLine( int index, int value) { ensureToLineIsMutable(); toLine_.set(index, value); onChanged(); return this; } /** * repeated int32 to_line = 4; */ public Builder addToLine(int value) { ensureToLineIsMutable(); toLine_.add(value); onChanged(); return this; } /** * repeated int32 to_line = 4; */ public Builder addAllToLine( java.lang.Iterable values) { ensureToLineIsMutable(); super.addAll(values, toLine_); onChanged(); return this; } /** * repeated int32 to_line = 4; */ public Builder clearToLine() { toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000008); onChanged(); return this; } // optional .MessageContent notify_content = 5; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> notifyContentBuilder_; /** * optional .MessageContent notify_content = 5; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional .MessageContent notify_content = 5; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { if (notifyContentBuilder_ == null) { return notifyContent_; } else { return notifyContentBuilder_.getMessage(); } } /** * optional .MessageContent notify_content = 5; */ public Builder setNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } notifyContent_ = value; onChanged(); } else { notifyContentBuilder_.setMessage(value); } bitField0_ |= 0x00000010; return this; } /** * optional .MessageContent notify_content = 5; */ public Builder setNotifyContent( cn.wildfirechat.proto.WFCMessage.MessageContent.Builder builderForValue) { if (notifyContentBuilder_ == null) { notifyContent_ = builderForValue.build(); onChanged(); } else { notifyContentBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000010; return this; } /** * optional .MessageContent notify_content = 5; */ public Builder mergeNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (((bitField0_ & 0x00000010) == 0x00000010) && notifyContent_ != cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder(notifyContent_).mergeFrom(value).buildPartial(); } else { notifyContent_ = value; } onChanged(); } else { notifyContentBuilder_.mergeFrom(value); } bitField0_ |= 0x00000010; return this; } /** * optional .MessageContent notify_content = 5; */ public Builder clearNotifyContent() { if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); onChanged(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000010); return this; } /** * optional .MessageContent notify_content = 5; */ public cn.wildfirechat.proto.WFCMessage.MessageContent.Builder getNotifyContentBuilder() { bitField0_ |= 0x00000010; onChanged(); return getNotifyContentFieldBuilder().getBuilder(); } /** * optional .MessageContent notify_content = 5; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { if (notifyContentBuilder_ != null) { return notifyContentBuilder_.getMessageOrBuilder(); } else { return notifyContent_; } } /** * optional .MessageContent notify_content = 5; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> getNotifyContentFieldBuilder() { if (notifyContentBuilder_ == null) { notifyContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder>( notifyContent_, getParentForChildren(), isClean()); notifyContent_ = null; } return notifyContentBuilder_; } // @@protoc_insertion_point(builder_scope:ModifyGroupInfoRequest) } static { defaultInstance = new ModifyGroupInfoRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ModifyGroupInfoRequest) } public interface SetGroupManagerRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string group_id = 1; /** * required string group_id = 1; */ boolean hasGroupId(); /** * required string group_id = 1; */ java.lang.String getGroupId(); /** * required string group_id = 1; */ com.google.protobuf.ByteString getGroupIdBytes(); // required int32 type = 2; /** * required int32 type = 2; */ boolean hasType(); /** * required int32 type = 2; */ int getType(); // repeated string user_id = 3; /** * repeated string user_id = 3; */ java.util.List getUserIdList(); /** * repeated string user_id = 3; */ int getUserIdCount(); /** * repeated string user_id = 3; */ java.lang.String getUserId(int index); /** * repeated string user_id = 3; */ com.google.protobuf.ByteString getUserIdBytes(int index); // repeated int32 to_line = 4; /** * repeated int32 to_line = 4; */ java.util.List getToLineList(); /** * repeated int32 to_line = 4; */ int getToLineCount(); /** * repeated int32 to_line = 4; */ int getToLine(int index); // optional .MessageContent notify_content = 5; /** * optional .MessageContent notify_content = 5; */ boolean hasNotifyContent(); /** * optional .MessageContent notify_content = 5; */ cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent(); /** * optional .MessageContent notify_content = 5; */ cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder(); } /** * Protobuf type {@code SetGroupManagerRequest} */ public static final class SetGroupManagerRequest extends com.google.protobuf.GeneratedMessage implements SetGroupManagerRequestOrBuilder { // Use SetGroupManagerRequest.newBuilder() to construct. private SetGroupManagerRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private SetGroupManagerRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final SetGroupManagerRequest defaultInstance; public static SetGroupManagerRequest getDefaultInstance() { return defaultInstance; } public SetGroupManagerRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private SetGroupManagerRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; groupId_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; type_ = input.readInt32(); break; } case 26: { if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { userId_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000004; } userId_.add(input.readBytes()); break; } case 32: { if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000008; } toLine_.add(input.readInt32()); break; } case 34: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000008) == 0x00000008) && input.getBytesUntilLimit() > 0) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000008; } while (input.getBytesUntilLimit() > 0) { toLine_.add(input.readInt32()); } input.popLimit(limit); break; } case 42: { cn.wildfirechat.proto.WFCMessage.MessageContent.Builder subBuilder = null; if (((bitField0_ & 0x00000004) == 0x00000004)) { subBuilder = notifyContent_.toBuilder(); } notifyContent_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.MessageContent.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(notifyContent_); notifyContent_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000004; break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { userId_ = new com.google.protobuf.UnmodifiableLazyStringList(userId_); } if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_SetGroupManagerRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_SetGroupManagerRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest.class, cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public SetGroupManagerRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new SetGroupManagerRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string group_id = 1; public static final int GROUP_ID_FIELD_NUMBER = 1; private java.lang.Object groupId_; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { groupId_ = s; } return s; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 type = 2; public static final int TYPE_FIELD_NUMBER = 2; private int type_; /** * required int32 type = 2; */ public boolean hasType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 type = 2; */ public int getType() { return type_; } // repeated string user_id = 3; public static final int USER_ID_FIELD_NUMBER = 3; private com.google.protobuf.LazyStringList userId_; /** * repeated string user_id = 3; */ public java.util.List getUserIdList() { return userId_; } /** * repeated string user_id = 3; */ public int getUserIdCount() { return userId_.size(); } /** * repeated string user_id = 3; */ public java.lang.String getUserId(int index) { return userId_.get(index); } /** * repeated string user_id = 3; */ public com.google.protobuf.ByteString getUserIdBytes(int index) { return userId_.getByteString(index); } // repeated int32 to_line = 4; public static final int TO_LINE_FIELD_NUMBER = 4; private java.util.List toLine_; /** * repeated int32 to_line = 4; */ public java.util.List getToLineList() { return toLine_; } /** * repeated int32 to_line = 4; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 4; */ public int getToLine(int index) { return toLine_.get(index); } // optional .MessageContent notify_content = 5; public static final int NOTIFY_CONTENT_FIELD_NUMBER = 5; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_; /** * optional .MessageContent notify_content = 5; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional .MessageContent notify_content = 5; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { return notifyContent_; } /** * optional .MessageContent notify_content = 5; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { return notifyContent_; } private void initFields() { groupId_ = ""; type_ = 0; userId_ = com.google.protobuf.LazyStringArrayList.EMPTY; toLine_ = java.util.Collections.emptyList(); notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasGroupId()) { memoizedIsInitialized = 0; return false; } if (!hasType()) { memoizedIsInitialized = 0; return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getGroupIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, type_); } for (int i = 0; i < userId_.size(); i++) { output.writeBytes(3, userId_.getByteString(i)); } for (int i = 0; i < toLine_.size(); i++) { output.writeInt32(4, toLine_.get(i)); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeMessage(5, notifyContent_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getGroupIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, type_); } { int dataSize = 0; for (int i = 0; i < userId_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeBytesSizeNoTag(userId_.getByteString(i)); } size += dataSize; size += 1 * getUserIdList().size(); } { int dataSize = 0; for (int i = 0; i < toLine_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(toLine_.get(i)); } size += dataSize; size += 1 * getToLineList().size(); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(5, notifyContent_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code SetGroupManagerRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_SetGroupManagerRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_SetGroupManagerRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest.class, cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getNotifyContentFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); groupId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); type_ = 0; bitField0_ = (bitField0_ & ~0x00000002); userId_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000004); toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000008); if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000010); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_SetGroupManagerRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest build() { cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest result = new cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.groupId_ = groupId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.type_ = type_; if (((bitField0_ & 0x00000004) == 0x00000004)) { userId_ = new com.google.protobuf.UnmodifiableLazyStringList( userId_); bitField0_ = (bitField0_ & ~0x00000004); } result.userId_ = userId_; if (((bitField0_ & 0x00000008) == 0x00000008)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); bitField0_ = (bitField0_ & ~0x00000008); } result.toLine_ = toLine_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000004; } if (notifyContentBuilder_ == null) { result.notifyContent_ = notifyContent_; } else { result.notifyContent_ = notifyContentBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest.getDefaultInstance()) return this; if (other.hasGroupId()) { bitField0_ |= 0x00000001; groupId_ = other.groupId_; onChanged(); } if (other.hasType()) { setType(other.getType()); } if (!other.userId_.isEmpty()) { if (userId_.isEmpty()) { userId_ = other.userId_; bitField0_ = (bitField0_ & ~0x00000004); } else { ensureUserIdIsMutable(); userId_.addAll(other.userId_); } onChanged(); } if (!other.toLine_.isEmpty()) { if (toLine_.isEmpty()) { toLine_ = other.toLine_; bitField0_ = (bitField0_ & ~0x00000008); } else { ensureToLineIsMutable(); toLine_.addAll(other.toLine_); } onChanged(); } if (other.hasNotifyContent()) { mergeNotifyContent(other.getNotifyContent()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasGroupId()) { return false; } if (!hasType()) { return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.SetGroupManagerRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string group_id = 1; private java.lang.Object groupId_ = ""; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); groupId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string group_id = 1; */ public Builder setGroupId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } /** * required string group_id = 1; */ public Builder clearGroupId() { bitField0_ = (bitField0_ & ~0x00000001); groupId_ = getDefaultInstance().getGroupId(); onChanged(); return this; } /** * required string group_id = 1; */ public Builder setGroupIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } // required int32 type = 2; private int type_ ; /** * required int32 type = 2; */ public boolean hasType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 type = 2; */ public int getType() { return type_; } /** * required int32 type = 2; */ public Builder setType(int value) { bitField0_ |= 0x00000002; type_ = value; onChanged(); return this; } /** * required int32 type = 2; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000002); type_ = 0; onChanged(); return this; } // repeated string user_id = 3; private com.google.protobuf.LazyStringList userId_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureUserIdIsMutable() { if (!((bitField0_ & 0x00000004) == 0x00000004)) { userId_ = new com.google.protobuf.LazyStringArrayList(userId_); bitField0_ |= 0x00000004; } } /** * repeated string user_id = 3; */ public java.util.List getUserIdList() { return java.util.Collections.unmodifiableList(userId_); } /** * repeated string user_id = 3; */ public int getUserIdCount() { return userId_.size(); } /** * repeated string user_id = 3; */ public java.lang.String getUserId(int index) { return userId_.get(index); } /** * repeated string user_id = 3; */ public com.google.protobuf.ByteString getUserIdBytes(int index) { return userId_.getByteString(index); } /** * repeated string user_id = 3; */ public Builder setUserId( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureUserIdIsMutable(); userId_.set(index, value); onChanged(); return this; } /** * repeated string user_id = 3; */ public Builder addUserId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureUserIdIsMutable(); userId_.add(value); onChanged(); return this; } /** * repeated string user_id = 3; */ public Builder addAllUserId( java.lang.Iterable values) { ensureUserIdIsMutable(); super.addAll(values, userId_); onChanged(); return this; } /** * repeated string user_id = 3; */ public Builder clearUserId() { userId_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } /** * repeated string user_id = 3; */ public Builder addUserIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } ensureUserIdIsMutable(); userId_.add(value); onChanged(); return this; } // repeated int32 to_line = 4; private java.util.List toLine_ = java.util.Collections.emptyList(); private void ensureToLineIsMutable() { if (!((bitField0_ & 0x00000008) == 0x00000008)) { toLine_ = new java.util.ArrayList(toLine_); bitField0_ |= 0x00000008; } } /** * repeated int32 to_line = 4; */ public java.util.List getToLineList() { return java.util.Collections.unmodifiableList(toLine_); } /** * repeated int32 to_line = 4; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 4; */ public int getToLine(int index) { return toLine_.get(index); } /** * repeated int32 to_line = 4; */ public Builder setToLine( int index, int value) { ensureToLineIsMutable(); toLine_.set(index, value); onChanged(); return this; } /** * repeated int32 to_line = 4; */ public Builder addToLine(int value) { ensureToLineIsMutable(); toLine_.add(value); onChanged(); return this; } /** * repeated int32 to_line = 4; */ public Builder addAllToLine( java.lang.Iterable values) { ensureToLineIsMutable(); super.addAll(values, toLine_); onChanged(); return this; } /** * repeated int32 to_line = 4; */ public Builder clearToLine() { toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000008); onChanged(); return this; } // optional .MessageContent notify_content = 5; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> notifyContentBuilder_; /** * optional .MessageContent notify_content = 5; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional .MessageContent notify_content = 5; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { if (notifyContentBuilder_ == null) { return notifyContent_; } else { return notifyContentBuilder_.getMessage(); } } /** * optional .MessageContent notify_content = 5; */ public Builder setNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } notifyContent_ = value; onChanged(); } else { notifyContentBuilder_.setMessage(value); } bitField0_ |= 0x00000010; return this; } /** * optional .MessageContent notify_content = 5; */ public Builder setNotifyContent( cn.wildfirechat.proto.WFCMessage.MessageContent.Builder builderForValue) { if (notifyContentBuilder_ == null) { notifyContent_ = builderForValue.build(); onChanged(); } else { notifyContentBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000010; return this; } /** * optional .MessageContent notify_content = 5; */ public Builder mergeNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (((bitField0_ & 0x00000010) == 0x00000010) && notifyContent_ != cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder(notifyContent_).mergeFrom(value).buildPartial(); } else { notifyContent_ = value; } onChanged(); } else { notifyContentBuilder_.mergeFrom(value); } bitField0_ |= 0x00000010; return this; } /** * optional .MessageContent notify_content = 5; */ public Builder clearNotifyContent() { if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); onChanged(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000010); return this; } /** * optional .MessageContent notify_content = 5; */ public cn.wildfirechat.proto.WFCMessage.MessageContent.Builder getNotifyContentBuilder() { bitField0_ |= 0x00000010; onChanged(); return getNotifyContentFieldBuilder().getBuilder(); } /** * optional .MessageContent notify_content = 5; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { if (notifyContentBuilder_ != null) { return notifyContentBuilder_.getMessageOrBuilder(); } else { return notifyContent_; } } /** * optional .MessageContent notify_content = 5; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> getNotifyContentFieldBuilder() { if (notifyContentBuilder_ == null) { notifyContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder>( notifyContent_, getParentForChildren(), isClean()); notifyContent_ = null; } return notifyContentBuilder_; } // @@protoc_insertion_point(builder_scope:SetGroupManagerRequest) } static { defaultInstance = new SetGroupManagerRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:SetGroupManagerRequest) } public interface InfoEntryOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int32 type = 1; /** * required int32 type = 1; */ boolean hasType(); /** * required int32 type = 1; */ int getType(); // required string value = 2; /** * required string value = 2; */ boolean hasValue(); /** * required string value = 2; */ java.lang.String getValue(); /** * required string value = 2; */ com.google.protobuf.ByteString getValueBytes(); } /** * Protobuf type {@code InfoEntry} */ public static final class InfoEntry extends com.google.protobuf.GeneratedMessage implements InfoEntryOrBuilder { // Use InfoEntry.newBuilder() to construct. private InfoEntry(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private InfoEntry(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final InfoEntry defaultInstance; public static InfoEntry getDefaultInstance() { return defaultInstance; } public InfoEntry getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private InfoEntry( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; type_ = input.readInt32(); break; } case 18: { bitField0_ |= 0x00000002; value_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_InfoEntry_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_InfoEntry_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.InfoEntry.class, cn.wildfirechat.proto.WFCMessage.InfoEntry.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public InfoEntry parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new InfoEntry(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int32 type = 1; public static final int TYPE_FIELD_NUMBER = 1; private int type_; /** * required int32 type = 1; */ public boolean hasType() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 type = 1; */ public int getType() { return type_; } // required string value = 2; public static final int VALUE_FIELD_NUMBER = 2; private java.lang.Object value_; /** * required string value = 2; */ public boolean hasValue() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string value = 2; */ public java.lang.String getValue() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { value_ = s; } return s; } } /** * required string value = 2; */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { type_ = 0; value_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasType()) { memoizedIsInitialized = 0; return false; } if (!hasValue()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, type_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getValueBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, type_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getValueBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.InfoEntry parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.InfoEntry parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.InfoEntry parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.InfoEntry parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.InfoEntry parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.InfoEntry parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.InfoEntry parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.InfoEntry parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.InfoEntry parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.InfoEntry parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.InfoEntry prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code InfoEntry} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.InfoEntryOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_InfoEntry_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_InfoEntry_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.InfoEntry.class, cn.wildfirechat.proto.WFCMessage.InfoEntry.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.InfoEntry.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); type_ = 0; bitField0_ = (bitField0_ & ~0x00000001); value_ = ""; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_InfoEntry_descriptor; } public cn.wildfirechat.proto.WFCMessage.InfoEntry getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.InfoEntry.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.InfoEntry build() { cn.wildfirechat.proto.WFCMessage.InfoEntry result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.InfoEntry buildPartial() { cn.wildfirechat.proto.WFCMessage.InfoEntry result = new cn.wildfirechat.proto.WFCMessage.InfoEntry(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.type_ = type_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.value_ = value_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.InfoEntry) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.InfoEntry)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.InfoEntry other) { if (other == cn.wildfirechat.proto.WFCMessage.InfoEntry.getDefaultInstance()) return this; if (other.hasType()) { setType(other.getType()); } if (other.hasValue()) { bitField0_ |= 0x00000002; value_ = other.value_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasType()) { return false; } if (!hasValue()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.InfoEntry parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.InfoEntry) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int32 type = 1; private int type_ ; /** * required int32 type = 1; */ public boolean hasType() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 type = 1; */ public int getType() { return type_; } /** * required int32 type = 1; */ public Builder setType(int value) { bitField0_ |= 0x00000001; type_ = value; onChanged(); return this; } /** * required int32 type = 1; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000001); type_ = 0; onChanged(); return this; } // required string value = 2; private java.lang.Object value_ = ""; /** * required string value = 2; */ public boolean hasValue() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string value = 2; */ public java.lang.String getValue() { java.lang.Object ref = value_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); value_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string value = 2; */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string value = 2; */ public Builder setValue( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; value_ = value; onChanged(); return this; } /** * required string value = 2; */ public Builder clearValue() { bitField0_ = (bitField0_ & ~0x00000002); value_ = getDefaultInstance().getValue(); onChanged(); return this; } /** * required string value = 2; */ public Builder setValueBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; value_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:InfoEntry) } static { defaultInstance = new InfoEntry(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:InfoEntry) } public interface ModifyMyInfoRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .InfoEntry entry = 1; /** * repeated .InfoEntry entry = 1; */ java.util.List getEntryList(); /** * repeated .InfoEntry entry = 1; */ cn.wildfirechat.proto.WFCMessage.InfoEntry getEntry(int index); /** * repeated .InfoEntry entry = 1; */ int getEntryCount(); /** * repeated .InfoEntry entry = 1; */ java.util.List getEntryOrBuilderList(); /** * repeated .InfoEntry entry = 1; */ cn.wildfirechat.proto.WFCMessage.InfoEntryOrBuilder getEntryOrBuilder( int index); } /** * Protobuf type {@code ModifyMyInfoRequest} */ public static final class ModifyMyInfoRequest extends com.google.protobuf.GeneratedMessage implements ModifyMyInfoRequestOrBuilder { // Use ModifyMyInfoRequest.newBuilder() to construct. private ModifyMyInfoRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ModifyMyInfoRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ModifyMyInfoRequest defaultInstance; public static ModifyMyInfoRequest getDefaultInstance() { return defaultInstance; } public ModifyMyInfoRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ModifyMyInfoRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { entry_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } entry_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.InfoEntry.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { entry_ = java.util.Collections.unmodifiableList(entry_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyMyInfoRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyMyInfoRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest.class, cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ModifyMyInfoRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ModifyMyInfoRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } // repeated .InfoEntry entry = 1; public static final int ENTRY_FIELD_NUMBER = 1; private java.util.List entry_; /** * repeated .InfoEntry entry = 1; */ public java.util.List getEntryList() { return entry_; } /** * repeated .InfoEntry entry = 1; */ public java.util.List getEntryOrBuilderList() { return entry_; } /** * repeated .InfoEntry entry = 1; */ public int getEntryCount() { return entry_.size(); } /** * repeated .InfoEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.InfoEntry getEntry(int index) { return entry_.get(index); } /** * repeated .InfoEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.InfoEntryOrBuilder getEntryOrBuilder( int index) { return entry_.get(index); } private void initFields() { entry_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getEntryCount(); i++) { if (!getEntry(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < entry_.size(); i++) { output.writeMessage(1, entry_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < entry_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, entry_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ModifyMyInfoRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyMyInfoRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyMyInfoRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest.class, cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getEntryFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (entryBuilder_ == null) { entry_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { entryBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyMyInfoRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest build() { cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest result = new cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest(this); int from_bitField0_ = bitField0_; if (entryBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { entry_ = java.util.Collections.unmodifiableList(entry_); bitField0_ = (bitField0_ & ~0x00000001); } result.entry_ = entry_; } else { result.entry_ = entryBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest.getDefaultInstance()) return this; if (entryBuilder_ == null) { if (!other.entry_.isEmpty()) { if (entry_.isEmpty()) { entry_ = other.entry_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureEntryIsMutable(); entry_.addAll(other.entry_); } onChanged(); } } else { if (!other.entry_.isEmpty()) { if (entryBuilder_.isEmpty()) { entryBuilder_.dispose(); entryBuilder_ = null; entry_ = other.entry_; bitField0_ = (bitField0_ & ~0x00000001); entryBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getEntryFieldBuilder() : null; } else { entryBuilder_.addAllMessages(other.entry_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { for (int i = 0; i < getEntryCount(); i++) { if (!getEntry(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ModifyMyInfoRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .InfoEntry entry = 1; private java.util.List entry_ = java.util.Collections.emptyList(); private void ensureEntryIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { entry_ = new java.util.ArrayList(entry_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.InfoEntry, cn.wildfirechat.proto.WFCMessage.InfoEntry.Builder, cn.wildfirechat.proto.WFCMessage.InfoEntryOrBuilder> entryBuilder_; /** * repeated .InfoEntry entry = 1; */ public java.util.List getEntryList() { if (entryBuilder_ == null) { return java.util.Collections.unmodifiableList(entry_); } else { return entryBuilder_.getMessageList(); } } /** * repeated .InfoEntry entry = 1; */ public int getEntryCount() { if (entryBuilder_ == null) { return entry_.size(); } else { return entryBuilder_.getCount(); } } /** * repeated .InfoEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.InfoEntry getEntry(int index) { if (entryBuilder_ == null) { return entry_.get(index); } else { return entryBuilder_.getMessage(index); } } /** * repeated .InfoEntry entry = 1; */ public Builder setEntry( int index, cn.wildfirechat.proto.WFCMessage.InfoEntry value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.set(index, value); onChanged(); } else { entryBuilder_.setMessage(index, value); } return this; } /** * repeated .InfoEntry entry = 1; */ public Builder setEntry( int index, cn.wildfirechat.proto.WFCMessage.InfoEntry.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.set(index, builderForValue.build()); onChanged(); } else { entryBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .InfoEntry entry = 1; */ public Builder addEntry(cn.wildfirechat.proto.WFCMessage.InfoEntry value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.add(value); onChanged(); } else { entryBuilder_.addMessage(value); } return this; } /** * repeated .InfoEntry entry = 1; */ public Builder addEntry( int index, cn.wildfirechat.proto.WFCMessage.InfoEntry value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.add(index, value); onChanged(); } else { entryBuilder_.addMessage(index, value); } return this; } /** * repeated .InfoEntry entry = 1; */ public Builder addEntry( cn.wildfirechat.proto.WFCMessage.InfoEntry.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.add(builderForValue.build()); onChanged(); } else { entryBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .InfoEntry entry = 1; */ public Builder addEntry( int index, cn.wildfirechat.proto.WFCMessage.InfoEntry.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.add(index, builderForValue.build()); onChanged(); } else { entryBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .InfoEntry entry = 1; */ public Builder addAllEntry( java.lang.Iterable values) { if (entryBuilder_ == null) { ensureEntryIsMutable(); super.addAll(values, entry_); onChanged(); } else { entryBuilder_.addAllMessages(values); } return this; } /** * repeated .InfoEntry entry = 1; */ public Builder clearEntry() { if (entryBuilder_ == null) { entry_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { entryBuilder_.clear(); } return this; } /** * repeated .InfoEntry entry = 1; */ public Builder removeEntry(int index) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.remove(index); onChanged(); } else { entryBuilder_.remove(index); } return this; } /** * repeated .InfoEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.InfoEntry.Builder getEntryBuilder( int index) { return getEntryFieldBuilder().getBuilder(index); } /** * repeated .InfoEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.InfoEntryOrBuilder getEntryOrBuilder( int index) { if (entryBuilder_ == null) { return entry_.get(index); } else { return entryBuilder_.getMessageOrBuilder(index); } } /** * repeated .InfoEntry entry = 1; */ public java.util.List getEntryOrBuilderList() { if (entryBuilder_ != null) { return entryBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(entry_); } } /** * repeated .InfoEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.InfoEntry.Builder addEntryBuilder() { return getEntryFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.InfoEntry.getDefaultInstance()); } /** * repeated .InfoEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.InfoEntry.Builder addEntryBuilder( int index) { return getEntryFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.InfoEntry.getDefaultInstance()); } /** * repeated .InfoEntry entry = 1; */ public java.util.List getEntryBuilderList() { return getEntryFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.InfoEntry, cn.wildfirechat.proto.WFCMessage.InfoEntry.Builder, cn.wildfirechat.proto.WFCMessage.InfoEntryOrBuilder> getEntryFieldBuilder() { if (entryBuilder_ == null) { entryBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.InfoEntry, cn.wildfirechat.proto.WFCMessage.InfoEntry.Builder, cn.wildfirechat.proto.WFCMessage.InfoEntryOrBuilder>( entry_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); entry_ = null; } return entryBuilder_; } // @@protoc_insertion_point(builder_scope:ModifyMyInfoRequest) } static { defaultInstance = new ModifyMyInfoRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ModifyMyInfoRequest) } public interface NotifyMessageOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int32 type = 1; /** * required int32 type = 1; */ boolean hasType(); /** * required int32 type = 1; */ int getType(); // required int64 head = 2; /** * required int64 head = 2; */ boolean hasHead(); /** * required int64 head = 2; */ long getHead(); // optional string target = 3; /** * optional string target = 3; */ boolean hasTarget(); /** * optional string target = 3; */ java.lang.String getTarget(); /** * optional string target = 3; */ com.google.protobuf.ByteString getTargetBytes(); } /** * Protobuf type {@code NotifyMessage} */ public static final class NotifyMessage extends com.google.protobuf.GeneratedMessage implements NotifyMessageOrBuilder { // Use NotifyMessage.newBuilder() to construct. private NotifyMessage(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private NotifyMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final NotifyMessage defaultInstance; public static NotifyMessage getDefaultInstance() { return defaultInstance; } public NotifyMessage getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private NotifyMessage( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; type_ = input.readInt32(); break; } case 16: { bitField0_ |= 0x00000002; head_ = input.readInt64(); break; } case 26: { bitField0_ |= 0x00000004; target_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_NotifyMessage_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_NotifyMessage_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.NotifyMessage.class, cn.wildfirechat.proto.WFCMessage.NotifyMessage.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public NotifyMessage parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new NotifyMessage(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int32 type = 1; public static final int TYPE_FIELD_NUMBER = 1; private int type_; /** * required int32 type = 1; */ public boolean hasType() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 type = 1; */ public int getType() { return type_; } // required int64 head = 2; public static final int HEAD_FIELD_NUMBER = 2; private long head_; /** * required int64 head = 2; */ public boolean hasHead() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int64 head = 2; */ public long getHead() { return head_; } // optional string target = 3; public static final int TARGET_FIELD_NUMBER = 3; private java.lang.Object target_; /** * optional string target = 3; */ public boolean hasTarget() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string target = 3; */ public java.lang.String getTarget() { java.lang.Object ref = target_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { target_ = s; } return s; } } /** * optional string target = 3; */ public com.google.protobuf.ByteString getTargetBytes() { java.lang.Object ref = target_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); target_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { type_ = 0; head_ = 0L; target_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasType()) { memoizedIsInitialized = 0; return false; } if (!hasHead()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, type_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt64(2, head_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getTargetBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, type_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(2, head_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getTargetBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.NotifyMessage parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.NotifyMessage parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.NotifyMessage parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.NotifyMessage parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.NotifyMessage parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.NotifyMessage parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.NotifyMessage parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.NotifyMessage parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.NotifyMessage parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.NotifyMessage parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.NotifyMessage prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code NotifyMessage} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.NotifyMessageOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_NotifyMessage_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_NotifyMessage_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.NotifyMessage.class, cn.wildfirechat.proto.WFCMessage.NotifyMessage.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.NotifyMessage.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); type_ = 0; bitField0_ = (bitField0_ & ~0x00000001); head_ = 0L; bitField0_ = (bitField0_ & ~0x00000002); target_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_NotifyMessage_descriptor; } public cn.wildfirechat.proto.WFCMessage.NotifyMessage getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.NotifyMessage.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.NotifyMessage build() { cn.wildfirechat.proto.WFCMessage.NotifyMessage result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.NotifyMessage buildPartial() { cn.wildfirechat.proto.WFCMessage.NotifyMessage result = new cn.wildfirechat.proto.WFCMessage.NotifyMessage(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.type_ = type_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.head_ = head_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.target_ = target_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.NotifyMessage) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.NotifyMessage)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.NotifyMessage other) { if (other == cn.wildfirechat.proto.WFCMessage.NotifyMessage.getDefaultInstance()) return this; if (other.hasType()) { setType(other.getType()); } if (other.hasHead()) { setHead(other.getHead()); } if (other.hasTarget()) { bitField0_ |= 0x00000004; target_ = other.target_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasType()) { return false; } if (!hasHead()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.NotifyMessage parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.NotifyMessage) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int32 type = 1; private int type_ ; /** * required int32 type = 1; */ public boolean hasType() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 type = 1; */ public int getType() { return type_; } /** * required int32 type = 1; */ public Builder setType(int value) { bitField0_ |= 0x00000001; type_ = value; onChanged(); return this; } /** * required int32 type = 1; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000001); type_ = 0; onChanged(); return this; } // required int64 head = 2; private long head_ ; /** * required int64 head = 2; */ public boolean hasHead() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int64 head = 2; */ public long getHead() { return head_; } /** * required int64 head = 2; */ public Builder setHead(long value) { bitField0_ |= 0x00000002; head_ = value; onChanged(); return this; } /** * required int64 head = 2; */ public Builder clearHead() { bitField0_ = (bitField0_ & ~0x00000002); head_ = 0L; onChanged(); return this; } // optional string target = 3; private java.lang.Object target_ = ""; /** * optional string target = 3; */ public boolean hasTarget() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string target = 3; */ public java.lang.String getTarget() { java.lang.Object ref = target_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); target_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string target = 3; */ public com.google.protobuf.ByteString getTargetBytes() { java.lang.Object ref = target_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); target_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string target = 3; */ public Builder setTarget( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; target_ = value; onChanged(); return this; } /** * optional string target = 3; */ public Builder clearTarget() { bitField0_ = (bitField0_ & ~0x00000004); target_ = getDefaultInstance().getTarget(); onChanged(); return this; } /** * optional string target = 3; */ public Builder setTargetBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; target_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:NotifyMessage) } static { defaultInstance = new NotifyMessage(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:NotifyMessage) } public interface PullMessageRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int64 id = 1; /** * required int64 id = 1; */ boolean hasId(); /** * required int64 id = 1; */ long getId(); // required int32 type = 2; /** * required int32 type = 2; */ boolean hasType(); /** * required int32 type = 2; */ int getType(); // optional int64 delay = 3; /** * optional int64 delay = 3; */ boolean hasDelay(); /** * optional int64 delay = 3; */ long getDelay(); } /** * Protobuf type {@code PullMessageRequest} */ public static final class PullMessageRequest extends com.google.protobuf.GeneratedMessage implements PullMessageRequestOrBuilder { // Use PullMessageRequest.newBuilder() to construct. private PullMessageRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private PullMessageRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final PullMessageRequest defaultInstance; public static PullMessageRequest getDefaultInstance() { return defaultInstance; } public PullMessageRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private PullMessageRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; id_ = input.readInt64(); break; } case 16: { bitField0_ |= 0x00000002; type_ = input.readInt32(); break; } case 24: { bitField0_ |= 0x00000004; delay_ = input.readInt64(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullMessageRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullMessageRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullMessageRequest.class, cn.wildfirechat.proto.WFCMessage.PullMessageRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public PullMessageRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new PullMessageRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int64 id = 1; public static final int ID_FIELD_NUMBER = 1; private long id_; /** * required int64 id = 1; */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int64 id = 1; */ public long getId() { return id_; } // required int32 type = 2; public static final int TYPE_FIELD_NUMBER = 2; private int type_; /** * required int32 type = 2; */ public boolean hasType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 type = 2; */ public int getType() { return type_; } // optional int64 delay = 3; public static final int DELAY_FIELD_NUMBER = 3; private long delay_; /** * optional int64 delay = 3; */ public boolean hasDelay() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int64 delay = 3; */ public long getDelay() { return delay_; } private void initFields() { id_ = 0L; type_ = 0; delay_ = 0L; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasId()) { memoizedIsInitialized = 0; return false; } if (!hasType()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt64(1, id_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, type_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt64(3, delay_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(1, id_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, type_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(3, delay_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.PullMessageRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullMessageRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullMessageRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullMessageRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullMessageRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullMessageRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullMessageRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullMessageRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullMessageRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullMessageRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.PullMessageRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code PullMessageRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.PullMessageRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullMessageRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullMessageRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullMessageRequest.class, cn.wildfirechat.proto.WFCMessage.PullMessageRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.PullMessageRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); id_ = 0L; bitField0_ = (bitField0_ & ~0x00000001); type_ = 0; bitField0_ = (bitField0_ & ~0x00000002); delay_ = 0L; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullMessageRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.PullMessageRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.PullMessageRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.PullMessageRequest build() { cn.wildfirechat.proto.WFCMessage.PullMessageRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.PullMessageRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.PullMessageRequest result = new cn.wildfirechat.proto.WFCMessage.PullMessageRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.id_ = id_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.type_ = type_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.delay_ = delay_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.PullMessageRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.PullMessageRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.PullMessageRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.PullMessageRequest.getDefaultInstance()) return this; if (other.hasId()) { setId(other.getId()); } if (other.hasType()) { setType(other.getType()); } if (other.hasDelay()) { setDelay(other.getDelay()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasId()) { return false; } if (!hasType()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.PullMessageRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.PullMessageRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int64 id = 1; private long id_ ; /** * required int64 id = 1; */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int64 id = 1; */ public long getId() { return id_; } /** * required int64 id = 1; */ public Builder setId(long value) { bitField0_ |= 0x00000001; id_ = value; onChanged(); return this; } /** * required int64 id = 1; */ public Builder clearId() { bitField0_ = (bitField0_ & ~0x00000001); id_ = 0L; onChanged(); return this; } // required int32 type = 2; private int type_ ; /** * required int32 type = 2; */ public boolean hasType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 type = 2; */ public int getType() { return type_; } /** * required int32 type = 2; */ public Builder setType(int value) { bitField0_ |= 0x00000002; type_ = value; onChanged(); return this; } /** * required int32 type = 2; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000002); type_ = 0; onChanged(); return this; } // optional int64 delay = 3; private long delay_ ; /** * optional int64 delay = 3; */ public boolean hasDelay() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int64 delay = 3; */ public long getDelay() { return delay_; } /** * optional int64 delay = 3; */ public Builder setDelay(long value) { bitField0_ |= 0x00000004; delay_ = value; onChanged(); return this; } /** * optional int64 delay = 3; */ public Builder clearDelay() { bitField0_ = (bitField0_ & ~0x00000004); delay_ = 0L; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:PullMessageRequest) } static { defaultInstance = new PullMessageRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:PullMessageRequest) } public interface PullMessageResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .Message message = 1; /** * repeated .Message message = 1; */ java.util.List getMessageList(); /** * repeated .Message message = 1; */ cn.wildfirechat.proto.WFCMessage.Message getMessage(int index); /** * repeated .Message message = 1; */ int getMessageCount(); /** * repeated .Message message = 1; */ java.util.List getMessageOrBuilderList(); /** * repeated .Message message = 1; */ cn.wildfirechat.proto.WFCMessage.MessageOrBuilder getMessageOrBuilder( int index); // required int64 current = 2; /** * required int64 current = 2; */ boolean hasCurrent(); /** * required int64 current = 2; */ long getCurrent(); // required int64 head = 3; /** * required int64 head = 3; */ boolean hasHead(); /** * required int64 head = 3; */ long getHead(); } /** * Protobuf type {@code PullMessageResult} */ public static final class PullMessageResult extends com.google.protobuf.GeneratedMessage implements PullMessageResultOrBuilder { // Use PullMessageResult.newBuilder() to construct. private PullMessageResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private PullMessageResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final PullMessageResult defaultInstance; public static PullMessageResult getDefaultInstance() { return defaultInstance; } public PullMessageResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private PullMessageResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { message_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } message_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.Message.PARSER, extensionRegistry)); break; } case 16: { bitField0_ |= 0x00000001; current_ = input.readInt64(); break; } case 24: { bitField0_ |= 0x00000002; head_ = input.readInt64(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { message_ = java.util.Collections.unmodifiableList(message_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullMessageResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullMessageResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullMessageResult.class, cn.wildfirechat.proto.WFCMessage.PullMessageResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public PullMessageResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new PullMessageResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // repeated .Message message = 1; public static final int MESSAGE_FIELD_NUMBER = 1; private java.util.List message_; /** * repeated .Message message = 1; */ public java.util.List getMessageList() { return message_; } /** * repeated .Message message = 1; */ public java.util.List getMessageOrBuilderList() { return message_; } /** * repeated .Message message = 1; */ public int getMessageCount() { return message_.size(); } /** * repeated .Message message = 1; */ public cn.wildfirechat.proto.WFCMessage.Message getMessage(int index) { return message_.get(index); } /** * repeated .Message message = 1; */ public cn.wildfirechat.proto.WFCMessage.MessageOrBuilder getMessageOrBuilder( int index) { return message_.get(index); } // required int64 current = 2; public static final int CURRENT_FIELD_NUMBER = 2; private long current_; /** * required int64 current = 2; */ public boolean hasCurrent() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int64 current = 2; */ public long getCurrent() { return current_; } // required int64 head = 3; public static final int HEAD_FIELD_NUMBER = 3; private long head_; /** * required int64 head = 3; */ public boolean hasHead() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int64 head = 3; */ public long getHead() { return head_; } private void initFields() { message_ = java.util.Collections.emptyList(); current_ = 0L; head_ = 0L; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasCurrent()) { memoizedIsInitialized = 0; return false; } if (!hasHead()) { memoizedIsInitialized = 0; return false; } for (int i = 0; i < getMessageCount(); i++) { if (!getMessage(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < message_.size(); i++) { output.writeMessage(1, message_.get(i)); } if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt64(2, current_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt64(3, head_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < message_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, message_.get(i)); } if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(2, current_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(3, head_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.PullMessageResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullMessageResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullMessageResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullMessageResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullMessageResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullMessageResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullMessageResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullMessageResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullMessageResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullMessageResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.PullMessageResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code PullMessageResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.PullMessageResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullMessageResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullMessageResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullMessageResult.class, cn.wildfirechat.proto.WFCMessage.PullMessageResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.PullMessageResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getMessageFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (messageBuilder_ == null) { message_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { messageBuilder_.clear(); } current_ = 0L; bitField0_ = (bitField0_ & ~0x00000002); head_ = 0L; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullMessageResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.PullMessageResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.PullMessageResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.PullMessageResult build() { cn.wildfirechat.proto.WFCMessage.PullMessageResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.PullMessageResult buildPartial() { cn.wildfirechat.proto.WFCMessage.PullMessageResult result = new cn.wildfirechat.proto.WFCMessage.PullMessageResult(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (messageBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { message_ = java.util.Collections.unmodifiableList(message_); bitField0_ = (bitField0_ & ~0x00000001); } result.message_ = message_; } else { result.message_ = messageBuilder_.build(); } if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000001; } result.current_ = current_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000002; } result.head_ = head_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.PullMessageResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.PullMessageResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.PullMessageResult other) { if (other == cn.wildfirechat.proto.WFCMessage.PullMessageResult.getDefaultInstance()) return this; if (messageBuilder_ == null) { if (!other.message_.isEmpty()) { if (message_.isEmpty()) { message_ = other.message_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureMessageIsMutable(); message_.addAll(other.message_); } onChanged(); } } else { if (!other.message_.isEmpty()) { if (messageBuilder_.isEmpty()) { messageBuilder_.dispose(); messageBuilder_ = null; message_ = other.message_; bitField0_ = (bitField0_ & ~0x00000001); messageBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getMessageFieldBuilder() : null; } else { messageBuilder_.addAllMessages(other.message_); } } } if (other.hasCurrent()) { setCurrent(other.getCurrent()); } if (other.hasHead()) { setHead(other.getHead()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasCurrent()) { return false; } if (!hasHead()) { return false; } for (int i = 0; i < getMessageCount(); i++) { if (!getMessage(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.PullMessageResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.PullMessageResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .Message message = 1; private java.util.List message_ = java.util.Collections.emptyList(); private void ensureMessageIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { message_ = new java.util.ArrayList(message_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.Message, cn.wildfirechat.proto.WFCMessage.Message.Builder, cn.wildfirechat.proto.WFCMessage.MessageOrBuilder> messageBuilder_; /** * repeated .Message message = 1; */ public java.util.List getMessageList() { if (messageBuilder_ == null) { return java.util.Collections.unmodifiableList(message_); } else { return messageBuilder_.getMessageList(); } } /** * repeated .Message message = 1; */ public int getMessageCount() { if (messageBuilder_ == null) { return message_.size(); } else { return messageBuilder_.getCount(); } } /** * repeated .Message message = 1; */ public cn.wildfirechat.proto.WFCMessage.Message getMessage(int index) { if (messageBuilder_ == null) { return message_.get(index); } else { return messageBuilder_.getMessage(index); } } /** * repeated .Message message = 1; */ public Builder setMessage( int index, cn.wildfirechat.proto.WFCMessage.Message value) { if (messageBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMessageIsMutable(); message_.set(index, value); onChanged(); } else { messageBuilder_.setMessage(index, value); } return this; } /** * repeated .Message message = 1; */ public Builder setMessage( int index, cn.wildfirechat.proto.WFCMessage.Message.Builder builderForValue) { if (messageBuilder_ == null) { ensureMessageIsMutable(); message_.set(index, builderForValue.build()); onChanged(); } else { messageBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .Message message = 1; */ public Builder addMessage(cn.wildfirechat.proto.WFCMessage.Message value) { if (messageBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMessageIsMutable(); message_.add(value); onChanged(); } else { messageBuilder_.addMessage(value); } return this; } /** * repeated .Message message = 1; */ public Builder addMessage( int index, cn.wildfirechat.proto.WFCMessage.Message value) { if (messageBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMessageIsMutable(); message_.add(index, value); onChanged(); } else { messageBuilder_.addMessage(index, value); } return this; } /** * repeated .Message message = 1; */ public Builder addMessage( cn.wildfirechat.proto.WFCMessage.Message.Builder builderForValue) { if (messageBuilder_ == null) { ensureMessageIsMutable(); message_.add(builderForValue.build()); onChanged(); } else { messageBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .Message message = 1; */ public Builder addMessage( int index, cn.wildfirechat.proto.WFCMessage.Message.Builder builderForValue) { if (messageBuilder_ == null) { ensureMessageIsMutable(); message_.add(index, builderForValue.build()); onChanged(); } else { messageBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .Message message = 1; */ public Builder addAllMessage( java.lang.Iterable values) { if (messageBuilder_ == null) { ensureMessageIsMutable(); super.addAll(values, message_); onChanged(); } else { messageBuilder_.addAllMessages(values); } return this; } /** * repeated .Message message = 1; */ public Builder clearMessage() { if (messageBuilder_ == null) { message_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { messageBuilder_.clear(); } return this; } /** * repeated .Message message = 1; */ public Builder removeMessage(int index) { if (messageBuilder_ == null) { ensureMessageIsMutable(); message_.remove(index); onChanged(); } else { messageBuilder_.remove(index); } return this; } /** * repeated .Message message = 1; */ public cn.wildfirechat.proto.WFCMessage.Message.Builder getMessageBuilder( int index) { return getMessageFieldBuilder().getBuilder(index); } /** * repeated .Message message = 1; */ public cn.wildfirechat.proto.WFCMessage.MessageOrBuilder getMessageOrBuilder( int index) { if (messageBuilder_ == null) { return message_.get(index); } else { return messageBuilder_.getMessageOrBuilder(index); } } /** * repeated .Message message = 1; */ public java.util.List getMessageOrBuilderList() { if (messageBuilder_ != null) { return messageBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(message_); } } /** * repeated .Message message = 1; */ public cn.wildfirechat.proto.WFCMessage.Message.Builder addMessageBuilder() { return getMessageFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.Message.getDefaultInstance()); } /** * repeated .Message message = 1; */ public cn.wildfirechat.proto.WFCMessage.Message.Builder addMessageBuilder( int index) { return getMessageFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.Message.getDefaultInstance()); } /** * repeated .Message message = 1; */ public java.util.List getMessageBuilderList() { return getMessageFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.Message, cn.wildfirechat.proto.WFCMessage.Message.Builder, cn.wildfirechat.proto.WFCMessage.MessageOrBuilder> getMessageFieldBuilder() { if (messageBuilder_ == null) { messageBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.Message, cn.wildfirechat.proto.WFCMessage.Message.Builder, cn.wildfirechat.proto.WFCMessage.MessageOrBuilder>( message_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); message_ = null; } return messageBuilder_; } // required int64 current = 2; private long current_ ; /** * required int64 current = 2; */ public boolean hasCurrent() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int64 current = 2; */ public long getCurrent() { return current_; } /** * required int64 current = 2; */ public Builder setCurrent(long value) { bitField0_ |= 0x00000002; current_ = value; onChanged(); return this; } /** * required int64 current = 2; */ public Builder clearCurrent() { bitField0_ = (bitField0_ & ~0x00000002); current_ = 0L; onChanged(); return this; } // required int64 head = 3; private long head_ ; /** * required int64 head = 3; */ public boolean hasHead() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int64 head = 3; */ public long getHead() { return head_; } /** * required int64 head = 3; */ public Builder setHead(long value) { bitField0_ |= 0x00000004; head_ = value; onChanged(); return this; } /** * required int64 head = 3; */ public Builder clearHead() { bitField0_ = (bitField0_ & ~0x00000004); head_ = 0L; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:PullMessageResult) } static { defaultInstance = new PullMessageResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:PullMessageResult) } public interface PullGroupInfoResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .GroupInfo info = 1; /** * repeated .GroupInfo info = 1; */ java.util.List getInfoList(); /** * repeated .GroupInfo info = 1; */ cn.wildfirechat.proto.WFCMessage.GroupInfo getInfo(int index); /** * repeated .GroupInfo info = 1; */ int getInfoCount(); /** * repeated .GroupInfo info = 1; */ java.util.List getInfoOrBuilderList(); /** * repeated .GroupInfo info = 1; */ cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder getInfoOrBuilder( int index); } /** * Protobuf type {@code PullGroupInfoResult} */ public static final class PullGroupInfoResult extends com.google.protobuf.GeneratedMessage implements PullGroupInfoResultOrBuilder { // Use PullGroupInfoResult.newBuilder() to construct. private PullGroupInfoResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private PullGroupInfoResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final PullGroupInfoResult defaultInstance; public static PullGroupInfoResult getDefaultInstance() { return defaultInstance; } public PullGroupInfoResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private PullGroupInfoResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { info_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } info_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.GroupInfo.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { info_ = java.util.Collections.unmodifiableList(info_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupInfoResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupInfoResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult.class, cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public PullGroupInfoResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new PullGroupInfoResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } // repeated .GroupInfo info = 1; public static final int INFO_FIELD_NUMBER = 1; private java.util.List info_; /** * repeated .GroupInfo info = 1; */ public java.util.List getInfoList() { return info_; } /** * repeated .GroupInfo info = 1; */ public java.util.List getInfoOrBuilderList() { return info_; } /** * repeated .GroupInfo info = 1; */ public int getInfoCount() { return info_.size(); } /** * repeated .GroupInfo info = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupInfo getInfo(int index) { return info_.get(index); } /** * repeated .GroupInfo info = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder getInfoOrBuilder( int index) { return info_.get(index); } private void initFields() { info_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getInfoCount(); i++) { if (!getInfo(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < info_.size(); i++) { output.writeMessage(1, info_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < info_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, info_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code PullGroupInfoResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.PullGroupInfoResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupInfoResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupInfoResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult.class, cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getInfoFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (infoBuilder_ == null) { info_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { infoBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupInfoResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult build() { cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult buildPartial() { cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult result = new cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult(this); int from_bitField0_ = bitField0_; if (infoBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { info_ = java.util.Collections.unmodifiableList(info_); bitField0_ = (bitField0_ & ~0x00000001); } result.info_ = info_; } else { result.info_ = infoBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult other) { if (other == cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult.getDefaultInstance()) return this; if (infoBuilder_ == null) { if (!other.info_.isEmpty()) { if (info_.isEmpty()) { info_ = other.info_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureInfoIsMutable(); info_.addAll(other.info_); } onChanged(); } } else { if (!other.info_.isEmpty()) { if (infoBuilder_.isEmpty()) { infoBuilder_.dispose(); infoBuilder_ = null; info_ = other.info_; bitField0_ = (bitField0_ & ~0x00000001); infoBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getInfoFieldBuilder() : null; } else { infoBuilder_.addAllMessages(other.info_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { for (int i = 0; i < getInfoCount(); i++) { if (!getInfo(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.PullGroupInfoResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .GroupInfo info = 1; private java.util.List info_ = java.util.Collections.emptyList(); private void ensureInfoIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { info_ = new java.util.ArrayList(info_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupInfo, cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder, cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder> infoBuilder_; /** * repeated .GroupInfo info = 1; */ public java.util.List getInfoList() { if (infoBuilder_ == null) { return java.util.Collections.unmodifiableList(info_); } else { return infoBuilder_.getMessageList(); } } /** * repeated .GroupInfo info = 1; */ public int getInfoCount() { if (infoBuilder_ == null) { return info_.size(); } else { return infoBuilder_.getCount(); } } /** * repeated .GroupInfo info = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupInfo getInfo(int index) { if (infoBuilder_ == null) { return info_.get(index); } else { return infoBuilder_.getMessage(index); } } /** * repeated .GroupInfo info = 1; */ public Builder setInfo( int index, cn.wildfirechat.proto.WFCMessage.GroupInfo value) { if (infoBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureInfoIsMutable(); info_.set(index, value); onChanged(); } else { infoBuilder_.setMessage(index, value); } return this; } /** * repeated .GroupInfo info = 1; */ public Builder setInfo( int index, cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder builderForValue) { if (infoBuilder_ == null) { ensureInfoIsMutable(); info_.set(index, builderForValue.build()); onChanged(); } else { infoBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .GroupInfo info = 1; */ public Builder addInfo(cn.wildfirechat.proto.WFCMessage.GroupInfo value) { if (infoBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureInfoIsMutable(); info_.add(value); onChanged(); } else { infoBuilder_.addMessage(value); } return this; } /** * repeated .GroupInfo info = 1; */ public Builder addInfo( int index, cn.wildfirechat.proto.WFCMessage.GroupInfo value) { if (infoBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureInfoIsMutable(); info_.add(index, value); onChanged(); } else { infoBuilder_.addMessage(index, value); } return this; } /** * repeated .GroupInfo info = 1; */ public Builder addInfo( cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder builderForValue) { if (infoBuilder_ == null) { ensureInfoIsMutable(); info_.add(builderForValue.build()); onChanged(); } else { infoBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .GroupInfo info = 1; */ public Builder addInfo( int index, cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder builderForValue) { if (infoBuilder_ == null) { ensureInfoIsMutable(); info_.add(index, builderForValue.build()); onChanged(); } else { infoBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .GroupInfo info = 1; */ public Builder addAllInfo( java.lang.Iterable values) { if (infoBuilder_ == null) { ensureInfoIsMutable(); super.addAll(values, info_); onChanged(); } else { infoBuilder_.addAllMessages(values); } return this; } /** * repeated .GroupInfo info = 1; */ public Builder clearInfo() { if (infoBuilder_ == null) { info_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { infoBuilder_.clear(); } return this; } /** * repeated .GroupInfo info = 1; */ public Builder removeInfo(int index) { if (infoBuilder_ == null) { ensureInfoIsMutable(); info_.remove(index); onChanged(); } else { infoBuilder_.remove(index); } return this; } /** * repeated .GroupInfo info = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder getInfoBuilder( int index) { return getInfoFieldBuilder().getBuilder(index); } /** * repeated .GroupInfo info = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder getInfoOrBuilder( int index) { if (infoBuilder_ == null) { return info_.get(index); } else { return infoBuilder_.getMessageOrBuilder(index); } } /** * repeated .GroupInfo info = 1; */ public java.util.List getInfoOrBuilderList() { if (infoBuilder_ != null) { return infoBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(info_); } } /** * repeated .GroupInfo info = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder addInfoBuilder() { return getInfoFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.GroupInfo.getDefaultInstance()); } /** * repeated .GroupInfo info = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder addInfoBuilder( int index) { return getInfoFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.GroupInfo.getDefaultInstance()); } /** * repeated .GroupInfo info = 1; */ public java.util.List getInfoBuilderList() { return getInfoFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupInfo, cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder, cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder> getInfoFieldBuilder() { if (infoBuilder_ == null) { infoBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupInfo, cn.wildfirechat.proto.WFCMessage.GroupInfo.Builder, cn.wildfirechat.proto.WFCMessage.GroupInfoOrBuilder>( info_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); info_ = null; } return infoBuilder_; } // @@protoc_insertion_point(builder_scope:PullGroupInfoResult) } static { defaultInstance = new PullGroupInfoResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:PullGroupInfoResult) } public interface PullGroupMemberRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string target = 1; /** * required string target = 1; */ boolean hasTarget(); /** * required string target = 1; */ java.lang.String getTarget(); /** * required string target = 1; */ com.google.protobuf.ByteString getTargetBytes(); // required int64 head = 2; /** * required int64 head = 2; */ boolean hasHead(); /** * required int64 head = 2; */ long getHead(); } /** * Protobuf type {@code PullGroupMemberRequest} */ public static final class PullGroupMemberRequest extends com.google.protobuf.GeneratedMessage implements PullGroupMemberRequestOrBuilder { // Use PullGroupMemberRequest.newBuilder() to construct. private PullGroupMemberRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private PullGroupMemberRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final PullGroupMemberRequest defaultInstance; public static PullGroupMemberRequest getDefaultInstance() { return defaultInstance; } public PullGroupMemberRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private PullGroupMemberRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; target_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; head_ = input.readInt64(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupMemberRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupMemberRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest.class, cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public PullGroupMemberRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new PullGroupMemberRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string target = 1; public static final int TARGET_FIELD_NUMBER = 1; private java.lang.Object target_; /** * required string target = 1; */ public boolean hasTarget() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string target = 1; */ public java.lang.String getTarget() { java.lang.Object ref = target_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { target_ = s; } return s; } } /** * required string target = 1; */ public com.google.protobuf.ByteString getTargetBytes() { java.lang.Object ref = target_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); target_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int64 head = 2; public static final int HEAD_FIELD_NUMBER = 2; private long head_; /** * required int64 head = 2; */ public boolean hasHead() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int64 head = 2; */ public long getHead() { return head_; } private void initFields() { target_ = ""; head_ = 0L; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTarget()) { memoizedIsInitialized = 0; return false; } if (!hasHead()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTargetBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt64(2, head_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTargetBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(2, head_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code PullGroupMemberRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupMemberRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupMemberRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest.class, cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); target_ = ""; bitField0_ = (bitField0_ & ~0x00000001); head_ = 0L; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupMemberRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest build() { cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest result = new cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.target_ = target_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.head_ = head_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest.getDefaultInstance()) return this; if (other.hasTarget()) { bitField0_ |= 0x00000001; target_ = other.target_; onChanged(); } if (other.hasHead()) { setHead(other.getHead()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTarget()) { return false; } if (!hasHead()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.PullGroupMemberRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string target = 1; private java.lang.Object target_ = ""; /** * required string target = 1; */ public boolean hasTarget() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string target = 1; */ public java.lang.String getTarget() { java.lang.Object ref = target_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); target_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string target = 1; */ public com.google.protobuf.ByteString getTargetBytes() { java.lang.Object ref = target_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); target_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string target = 1; */ public Builder setTarget( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; target_ = value; onChanged(); return this; } /** * required string target = 1; */ public Builder clearTarget() { bitField0_ = (bitField0_ & ~0x00000001); target_ = getDefaultInstance().getTarget(); onChanged(); return this; } /** * required string target = 1; */ public Builder setTargetBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; target_ = value; onChanged(); return this; } // required int64 head = 2; private long head_ ; /** * required int64 head = 2; */ public boolean hasHead() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int64 head = 2; */ public long getHead() { return head_; } /** * required int64 head = 2; */ public Builder setHead(long value) { bitField0_ |= 0x00000002; head_ = value; onChanged(); return this; } /** * required int64 head = 2; */ public Builder clearHead() { bitField0_ = (bitField0_ & ~0x00000002); head_ = 0L; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:PullGroupMemberRequest) } static { defaultInstance = new PullGroupMemberRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:PullGroupMemberRequest) } public interface PullGroupMemberResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .GroupMember member = 1; /** * repeated .GroupMember member = 1; */ java.util.List getMemberList(); /** * repeated .GroupMember member = 1; */ cn.wildfirechat.proto.WFCMessage.GroupMember getMember(int index); /** * repeated .GroupMember member = 1; */ int getMemberCount(); /** * repeated .GroupMember member = 1; */ java.util.List getMemberOrBuilderList(); /** * repeated .GroupMember member = 1; */ cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder getMemberOrBuilder( int index); } /** * Protobuf type {@code PullGroupMemberResult} */ public static final class PullGroupMemberResult extends com.google.protobuf.GeneratedMessage implements PullGroupMemberResultOrBuilder { // Use PullGroupMemberResult.newBuilder() to construct. private PullGroupMemberResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private PullGroupMemberResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final PullGroupMemberResult defaultInstance; public static PullGroupMemberResult getDefaultInstance() { return defaultInstance; } public PullGroupMemberResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private PullGroupMemberResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { member_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } member_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.GroupMember.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { member_ = java.util.Collections.unmodifiableList(member_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupMemberResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupMemberResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult.class, cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public PullGroupMemberResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new PullGroupMemberResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } // repeated .GroupMember member = 1; public static final int MEMBER_FIELD_NUMBER = 1; private java.util.List member_; /** * repeated .GroupMember member = 1; */ public java.util.List getMemberList() { return member_; } /** * repeated .GroupMember member = 1; */ public java.util.List getMemberOrBuilderList() { return member_; } /** * repeated .GroupMember member = 1; */ public int getMemberCount() { return member_.size(); } /** * repeated .GroupMember member = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupMember getMember(int index) { return member_.get(index); } /** * repeated .GroupMember member = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder getMemberOrBuilder( int index) { return member_.get(index); } private void initFields() { member_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getMemberCount(); i++) { if (!getMember(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < member_.size(); i++) { output.writeMessage(1, member_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < member_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, member_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code PullGroupMemberResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.PullGroupMemberResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupMemberResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupMemberResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult.class, cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getMemberFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (memberBuilder_ == null) { member_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { memberBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullGroupMemberResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult build() { cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult buildPartial() { cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult result = new cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult(this); int from_bitField0_ = bitField0_; if (memberBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { member_ = java.util.Collections.unmodifiableList(member_); bitField0_ = (bitField0_ & ~0x00000001); } result.member_ = member_; } else { result.member_ = memberBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult other) { if (other == cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult.getDefaultInstance()) return this; if (memberBuilder_ == null) { if (!other.member_.isEmpty()) { if (member_.isEmpty()) { member_ = other.member_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureMemberIsMutable(); member_.addAll(other.member_); } onChanged(); } } else { if (!other.member_.isEmpty()) { if (memberBuilder_.isEmpty()) { memberBuilder_.dispose(); memberBuilder_ = null; member_ = other.member_; bitField0_ = (bitField0_ & ~0x00000001); memberBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getMemberFieldBuilder() : null; } else { memberBuilder_.addAllMessages(other.member_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { for (int i = 0; i < getMemberCount(); i++) { if (!getMember(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.PullGroupMemberResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .GroupMember member = 1; private java.util.List member_ = java.util.Collections.emptyList(); private void ensureMemberIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { member_ = new java.util.ArrayList(member_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupMember, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder, cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder> memberBuilder_; /** * repeated .GroupMember member = 1; */ public java.util.List getMemberList() { if (memberBuilder_ == null) { return java.util.Collections.unmodifiableList(member_); } else { return memberBuilder_.getMessageList(); } } /** * repeated .GroupMember member = 1; */ public int getMemberCount() { if (memberBuilder_ == null) { return member_.size(); } else { return memberBuilder_.getCount(); } } /** * repeated .GroupMember member = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupMember getMember(int index) { if (memberBuilder_ == null) { return member_.get(index); } else { return memberBuilder_.getMessage(index); } } /** * repeated .GroupMember member = 1; */ public Builder setMember( int index, cn.wildfirechat.proto.WFCMessage.GroupMember value) { if (memberBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMemberIsMutable(); member_.set(index, value); onChanged(); } else { memberBuilder_.setMessage(index, value); } return this; } /** * repeated .GroupMember member = 1; */ public Builder setMember( int index, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder builderForValue) { if (memberBuilder_ == null) { ensureMemberIsMutable(); member_.set(index, builderForValue.build()); onChanged(); } else { memberBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .GroupMember member = 1; */ public Builder addMember(cn.wildfirechat.proto.WFCMessage.GroupMember value) { if (memberBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMemberIsMutable(); member_.add(value); onChanged(); } else { memberBuilder_.addMessage(value); } return this; } /** * repeated .GroupMember member = 1; */ public Builder addMember( int index, cn.wildfirechat.proto.WFCMessage.GroupMember value) { if (memberBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureMemberIsMutable(); member_.add(index, value); onChanged(); } else { memberBuilder_.addMessage(index, value); } return this; } /** * repeated .GroupMember member = 1; */ public Builder addMember( cn.wildfirechat.proto.WFCMessage.GroupMember.Builder builderForValue) { if (memberBuilder_ == null) { ensureMemberIsMutable(); member_.add(builderForValue.build()); onChanged(); } else { memberBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .GroupMember member = 1; */ public Builder addMember( int index, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder builderForValue) { if (memberBuilder_ == null) { ensureMemberIsMutable(); member_.add(index, builderForValue.build()); onChanged(); } else { memberBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .GroupMember member = 1; */ public Builder addAllMember( java.lang.Iterable values) { if (memberBuilder_ == null) { ensureMemberIsMutable(); super.addAll(values, member_); onChanged(); } else { memberBuilder_.addAllMessages(values); } return this; } /** * repeated .GroupMember member = 1; */ public Builder clearMember() { if (memberBuilder_ == null) { member_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { memberBuilder_.clear(); } return this; } /** * repeated .GroupMember member = 1; */ public Builder removeMember(int index) { if (memberBuilder_ == null) { ensureMemberIsMutable(); member_.remove(index); onChanged(); } else { memberBuilder_.remove(index); } return this; } /** * repeated .GroupMember member = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupMember.Builder getMemberBuilder( int index) { return getMemberFieldBuilder().getBuilder(index); } /** * repeated .GroupMember member = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder getMemberOrBuilder( int index) { if (memberBuilder_ == null) { return member_.get(index); } else { return memberBuilder_.getMessageOrBuilder(index); } } /** * repeated .GroupMember member = 1; */ public java.util.List getMemberOrBuilderList() { if (memberBuilder_ != null) { return memberBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(member_); } } /** * repeated .GroupMember member = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupMember.Builder addMemberBuilder() { return getMemberFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.GroupMember.getDefaultInstance()); } /** * repeated .GroupMember member = 1; */ public cn.wildfirechat.proto.WFCMessage.GroupMember.Builder addMemberBuilder( int index) { return getMemberFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.GroupMember.getDefaultInstance()); } /** * repeated .GroupMember member = 1; */ public java.util.List getMemberBuilderList() { return getMemberFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupMember, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder, cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder> getMemberFieldBuilder() { if (memberBuilder_ == null) { memberBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.GroupMember, cn.wildfirechat.proto.WFCMessage.GroupMember.Builder, cn.wildfirechat.proto.WFCMessage.GroupMemberOrBuilder>( member_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); member_ = null; } return memberBuilder_; } // @@protoc_insertion_point(builder_scope:PullGroupMemberResult) } static { defaultInstance = new PullGroupMemberResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:PullGroupMemberResult) } public interface UserRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string uid = 1; /** * required string uid = 1; */ boolean hasUid(); /** * required string uid = 1; */ java.lang.String getUid(); /** * required string uid = 1; */ com.google.protobuf.ByteString getUidBytes(); // optional int64 update_dt = 2; /** * optional int64 update_dt = 2; */ boolean hasUpdateDt(); /** * optional int64 update_dt = 2; */ long getUpdateDt(); } /** * Protobuf type {@code UserRequest} */ public static final class UserRequest extends com.google.protobuf.GeneratedMessage implements UserRequestOrBuilder { // Use UserRequest.newBuilder() to construct. private UserRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private UserRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final UserRequest defaultInstance; public static UserRequest getDefaultInstance() { return defaultInstance; } public UserRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private UserRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; uid_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; updateDt_ = input.readInt64(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.UserRequest.class, cn.wildfirechat.proto.WFCMessage.UserRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public UserRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new UserRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string uid = 1; public static final int UID_FIELD_NUMBER = 1; private java.lang.Object uid_; /** * required string uid = 1; */ public boolean hasUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string uid = 1; */ public java.lang.String getUid() { java.lang.Object ref = uid_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { uid_ = s; } return s; } } /** * required string uid = 1; */ public com.google.protobuf.ByteString getUidBytes() { java.lang.Object ref = uid_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); uid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int64 update_dt = 2; public static final int UPDATE_DT_FIELD_NUMBER = 2; private long updateDt_; /** * optional int64 update_dt = 2; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional int64 update_dt = 2; */ public long getUpdateDt() { return updateDt_; } private void initFields() { uid_ = ""; updateDt_ = 0L; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasUid()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt64(2, updateDt_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(2, updateDt_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.UserRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.UserRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UserRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.UserRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UserRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.UserRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UserRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.UserRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UserRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.UserRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.UserRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code UserRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.UserRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.UserRequest.class, cn.wildfirechat.proto.WFCMessage.UserRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.UserRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); uid_ = ""; bitField0_ = (bitField0_ & ~0x00000001); updateDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.UserRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.UserRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.UserRequest build() { cn.wildfirechat.proto.WFCMessage.UserRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.UserRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.UserRequest result = new cn.wildfirechat.proto.WFCMessage.UserRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.uid_ = uid_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.updateDt_ = updateDt_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.UserRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.UserRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.UserRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.UserRequest.getDefaultInstance()) return this; if (other.hasUid()) { bitField0_ |= 0x00000001; uid_ = other.uid_; onChanged(); } if (other.hasUpdateDt()) { setUpdateDt(other.getUpdateDt()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasUid()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.UserRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.UserRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string uid = 1; private java.lang.Object uid_ = ""; /** * required string uid = 1; */ public boolean hasUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string uid = 1; */ public java.lang.String getUid() { java.lang.Object ref = uid_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); uid_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string uid = 1; */ public com.google.protobuf.ByteString getUidBytes() { java.lang.Object ref = uid_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); uid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string uid = 1; */ public Builder setUid( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; uid_ = value; onChanged(); return this; } /** * required string uid = 1; */ public Builder clearUid() { bitField0_ = (bitField0_ & ~0x00000001); uid_ = getDefaultInstance().getUid(); onChanged(); return this; } /** * required string uid = 1; */ public Builder setUidBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; uid_ = value; onChanged(); return this; } // optional int64 update_dt = 2; private long updateDt_ ; /** * optional int64 update_dt = 2; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional int64 update_dt = 2; */ public long getUpdateDt() { return updateDt_; } /** * optional int64 update_dt = 2; */ public Builder setUpdateDt(long value) { bitField0_ |= 0x00000002; updateDt_ = value; onChanged(); return this; } /** * optional int64 update_dt = 2; */ public Builder clearUpdateDt() { bitField0_ = (bitField0_ & ~0x00000002); updateDt_ = 0L; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:UserRequest) } static { defaultInstance = new UserRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:UserRequest) } public interface PullUserRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .UserRequest request = 1; /** * repeated .UserRequest request = 1; */ java.util.List getRequestList(); /** * repeated .UserRequest request = 1; */ cn.wildfirechat.proto.WFCMessage.UserRequest getRequest(int index); /** * repeated .UserRequest request = 1; */ int getRequestCount(); /** * repeated .UserRequest request = 1; */ java.util.List getRequestOrBuilderList(); /** * repeated .UserRequest request = 1; */ cn.wildfirechat.proto.WFCMessage.UserRequestOrBuilder getRequestOrBuilder( int index); } /** * Protobuf type {@code PullUserRequest} */ public static final class PullUserRequest extends com.google.protobuf.GeneratedMessage implements PullUserRequestOrBuilder { // Use PullUserRequest.newBuilder() to construct. private PullUserRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private PullUserRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final PullUserRequest defaultInstance; public static PullUserRequest getDefaultInstance() { return defaultInstance; } public PullUserRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private PullUserRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { request_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } request_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.UserRequest.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { request_ = java.util.Collections.unmodifiableList(request_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullUserRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullUserRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullUserRequest.class, cn.wildfirechat.proto.WFCMessage.PullUserRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public PullUserRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new PullUserRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } // repeated .UserRequest request = 1; public static final int REQUEST_FIELD_NUMBER = 1; private java.util.List request_; /** * repeated .UserRequest request = 1; */ public java.util.List getRequestList() { return request_; } /** * repeated .UserRequest request = 1; */ public java.util.List getRequestOrBuilderList() { return request_; } /** * repeated .UserRequest request = 1; */ public int getRequestCount() { return request_.size(); } /** * repeated .UserRequest request = 1; */ public cn.wildfirechat.proto.WFCMessage.UserRequest getRequest(int index) { return request_.get(index); } /** * repeated .UserRequest request = 1; */ public cn.wildfirechat.proto.WFCMessage.UserRequestOrBuilder getRequestOrBuilder( int index) { return request_.get(index); } private void initFields() { request_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getRequestCount(); i++) { if (!getRequest(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < request_.size(); i++) { output.writeMessage(1, request_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < request_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, request_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.PullUserRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullUserRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullUserRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullUserRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullUserRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullUserRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullUserRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullUserRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullUserRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullUserRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.PullUserRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code PullUserRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.PullUserRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullUserRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullUserRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullUserRequest.class, cn.wildfirechat.proto.WFCMessage.PullUserRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.PullUserRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getRequestFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (requestBuilder_ == null) { request_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { requestBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullUserRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.PullUserRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.PullUserRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.PullUserRequest build() { cn.wildfirechat.proto.WFCMessage.PullUserRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.PullUserRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.PullUserRequest result = new cn.wildfirechat.proto.WFCMessage.PullUserRequest(this); int from_bitField0_ = bitField0_; if (requestBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { request_ = java.util.Collections.unmodifiableList(request_); bitField0_ = (bitField0_ & ~0x00000001); } result.request_ = request_; } else { result.request_ = requestBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.PullUserRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.PullUserRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.PullUserRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.PullUserRequest.getDefaultInstance()) return this; if (requestBuilder_ == null) { if (!other.request_.isEmpty()) { if (request_.isEmpty()) { request_ = other.request_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureRequestIsMutable(); request_.addAll(other.request_); } onChanged(); } } else { if (!other.request_.isEmpty()) { if (requestBuilder_.isEmpty()) { requestBuilder_.dispose(); requestBuilder_ = null; request_ = other.request_; bitField0_ = (bitField0_ & ~0x00000001); requestBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getRequestFieldBuilder() : null; } else { requestBuilder_.addAllMessages(other.request_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { for (int i = 0; i < getRequestCount(); i++) { if (!getRequest(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.PullUserRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.PullUserRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .UserRequest request = 1; private java.util.List request_ = java.util.Collections.emptyList(); private void ensureRequestIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { request_ = new java.util.ArrayList(request_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.UserRequest, cn.wildfirechat.proto.WFCMessage.UserRequest.Builder, cn.wildfirechat.proto.WFCMessage.UserRequestOrBuilder> requestBuilder_; /** * repeated .UserRequest request = 1; */ public java.util.List getRequestList() { if (requestBuilder_ == null) { return java.util.Collections.unmodifiableList(request_); } else { return requestBuilder_.getMessageList(); } } /** * repeated .UserRequest request = 1; */ public int getRequestCount() { if (requestBuilder_ == null) { return request_.size(); } else { return requestBuilder_.getCount(); } } /** * repeated .UserRequest request = 1; */ public cn.wildfirechat.proto.WFCMessage.UserRequest getRequest(int index) { if (requestBuilder_ == null) { return request_.get(index); } else { return requestBuilder_.getMessage(index); } } /** * repeated .UserRequest request = 1; */ public Builder setRequest( int index, cn.wildfirechat.proto.WFCMessage.UserRequest value) { if (requestBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureRequestIsMutable(); request_.set(index, value); onChanged(); } else { requestBuilder_.setMessage(index, value); } return this; } /** * repeated .UserRequest request = 1; */ public Builder setRequest( int index, cn.wildfirechat.proto.WFCMessage.UserRequest.Builder builderForValue) { if (requestBuilder_ == null) { ensureRequestIsMutable(); request_.set(index, builderForValue.build()); onChanged(); } else { requestBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .UserRequest request = 1; */ public Builder addRequest(cn.wildfirechat.proto.WFCMessage.UserRequest value) { if (requestBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureRequestIsMutable(); request_.add(value); onChanged(); } else { requestBuilder_.addMessage(value); } return this; } /** * repeated .UserRequest request = 1; */ public Builder addRequest( int index, cn.wildfirechat.proto.WFCMessage.UserRequest value) { if (requestBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureRequestIsMutable(); request_.add(index, value); onChanged(); } else { requestBuilder_.addMessage(index, value); } return this; } /** * repeated .UserRequest request = 1; */ public Builder addRequest( cn.wildfirechat.proto.WFCMessage.UserRequest.Builder builderForValue) { if (requestBuilder_ == null) { ensureRequestIsMutable(); request_.add(builderForValue.build()); onChanged(); } else { requestBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .UserRequest request = 1; */ public Builder addRequest( int index, cn.wildfirechat.proto.WFCMessage.UserRequest.Builder builderForValue) { if (requestBuilder_ == null) { ensureRequestIsMutable(); request_.add(index, builderForValue.build()); onChanged(); } else { requestBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .UserRequest request = 1; */ public Builder addAllRequest( java.lang.Iterable values) { if (requestBuilder_ == null) { ensureRequestIsMutable(); super.addAll(values, request_); onChanged(); } else { requestBuilder_.addAllMessages(values); } return this; } /** * repeated .UserRequest request = 1; */ public Builder clearRequest() { if (requestBuilder_ == null) { request_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { requestBuilder_.clear(); } return this; } /** * repeated .UserRequest request = 1; */ public Builder removeRequest(int index) { if (requestBuilder_ == null) { ensureRequestIsMutable(); request_.remove(index); onChanged(); } else { requestBuilder_.remove(index); } return this; } /** * repeated .UserRequest request = 1; */ public cn.wildfirechat.proto.WFCMessage.UserRequest.Builder getRequestBuilder( int index) { return getRequestFieldBuilder().getBuilder(index); } /** * repeated .UserRequest request = 1; */ public cn.wildfirechat.proto.WFCMessage.UserRequestOrBuilder getRequestOrBuilder( int index) { if (requestBuilder_ == null) { return request_.get(index); } else { return requestBuilder_.getMessageOrBuilder(index); } } /** * repeated .UserRequest request = 1; */ public java.util.List getRequestOrBuilderList() { if (requestBuilder_ != null) { return requestBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(request_); } } /** * repeated .UserRequest request = 1; */ public cn.wildfirechat.proto.WFCMessage.UserRequest.Builder addRequestBuilder() { return getRequestFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.UserRequest.getDefaultInstance()); } /** * repeated .UserRequest request = 1; */ public cn.wildfirechat.proto.WFCMessage.UserRequest.Builder addRequestBuilder( int index) { return getRequestFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.UserRequest.getDefaultInstance()); } /** * repeated .UserRequest request = 1; */ public java.util.List getRequestBuilderList() { return getRequestFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.UserRequest, cn.wildfirechat.proto.WFCMessage.UserRequest.Builder, cn.wildfirechat.proto.WFCMessage.UserRequestOrBuilder> getRequestFieldBuilder() { if (requestBuilder_ == null) { requestBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.UserRequest, cn.wildfirechat.proto.WFCMessage.UserRequest.Builder, cn.wildfirechat.proto.WFCMessage.UserRequestOrBuilder>( request_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); request_ = null; } return requestBuilder_; } // @@protoc_insertion_point(builder_scope:PullUserRequest) } static { defaultInstance = new PullUserRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:PullUserRequest) } public interface UserResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // required .User user = 1; /** * required .User user = 1; */ boolean hasUser(); /** * required .User user = 1; */ cn.wildfirechat.proto.WFCMessage.User getUser(); /** * required .User user = 1; */ cn.wildfirechat.proto.WFCMessage.UserOrBuilder getUserOrBuilder(); // required int32 code = 2; /** * required int32 code = 2; */ boolean hasCode(); /** * required int32 code = 2; */ int getCode(); } /** * Protobuf type {@code UserResult} */ public static final class UserResult extends com.google.protobuf.GeneratedMessage implements UserResultOrBuilder { // Use UserResult.newBuilder() to construct. private UserResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private UserResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final UserResult defaultInstance; public static UserResult getDefaultInstance() { return defaultInstance; } public UserResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private UserResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { cn.wildfirechat.proto.WFCMessage.User.Builder subBuilder = null; if (((bitField0_ & 0x00000001) == 0x00000001)) { subBuilder = user_.toBuilder(); } user_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.User.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(user_); user_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000001; break; } case 16: { bitField0_ |= 0x00000002; code_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.UserResult.class, cn.wildfirechat.proto.WFCMessage.UserResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public UserResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new UserResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required .User user = 1; public static final int USER_FIELD_NUMBER = 1; private cn.wildfirechat.proto.WFCMessage.User user_; /** * required .User user = 1; */ public boolean hasUser() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required .User user = 1; */ public cn.wildfirechat.proto.WFCMessage.User getUser() { return user_; } /** * required .User user = 1; */ public cn.wildfirechat.proto.WFCMessage.UserOrBuilder getUserOrBuilder() { return user_; } // required int32 code = 2; public static final int CODE_FIELD_NUMBER = 2; private int code_; /** * required int32 code = 2; */ public boolean hasCode() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 code = 2; */ public int getCode() { return code_; } private void initFields() { user_ = cn.wildfirechat.proto.WFCMessage.User.getDefaultInstance(); code_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasUser()) { memoizedIsInitialized = 0; return false; } if (!hasCode()) { memoizedIsInitialized = 0; return false; } if (!getUser().isInitialized()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeMessage(1, user_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, code_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, user_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, code_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.UserResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.UserResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UserResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.UserResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UserResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.UserResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UserResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.UserResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UserResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.UserResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.UserResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code UserResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.UserResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.UserResult.class, cn.wildfirechat.proto.WFCMessage.UserResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.UserResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getUserFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (userBuilder_ == null) { user_ = cn.wildfirechat.proto.WFCMessage.User.getDefaultInstance(); } else { userBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); code_ = 0; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.UserResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.UserResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.UserResult build() { cn.wildfirechat.proto.WFCMessage.UserResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.UserResult buildPartial() { cn.wildfirechat.proto.WFCMessage.UserResult result = new cn.wildfirechat.proto.WFCMessage.UserResult(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } if (userBuilder_ == null) { result.user_ = user_; } else { result.user_ = userBuilder_.build(); } if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.code_ = code_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.UserResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.UserResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.UserResult other) { if (other == cn.wildfirechat.proto.WFCMessage.UserResult.getDefaultInstance()) return this; if (other.hasUser()) { mergeUser(other.getUser()); } if (other.hasCode()) { setCode(other.getCode()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasUser()) { return false; } if (!hasCode()) { return false; } if (!getUser().isInitialized()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.UserResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.UserResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required .User user = 1; private cn.wildfirechat.proto.WFCMessage.User user_ = cn.wildfirechat.proto.WFCMessage.User.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.User, cn.wildfirechat.proto.WFCMessage.User.Builder, cn.wildfirechat.proto.WFCMessage.UserOrBuilder> userBuilder_; /** * required .User user = 1; */ public boolean hasUser() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required .User user = 1; */ public cn.wildfirechat.proto.WFCMessage.User getUser() { if (userBuilder_ == null) { return user_; } else { return userBuilder_.getMessage(); } } /** * required .User user = 1; */ public Builder setUser(cn.wildfirechat.proto.WFCMessage.User value) { if (userBuilder_ == null) { if (value == null) { throw new NullPointerException(); } user_ = value; onChanged(); } else { userBuilder_.setMessage(value); } bitField0_ |= 0x00000001; return this; } /** * required .User user = 1; */ public Builder setUser( cn.wildfirechat.proto.WFCMessage.User.Builder builderForValue) { if (userBuilder_ == null) { user_ = builderForValue.build(); onChanged(); } else { userBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000001; return this; } /** * required .User user = 1; */ public Builder mergeUser(cn.wildfirechat.proto.WFCMessage.User value) { if (userBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && user_ != cn.wildfirechat.proto.WFCMessage.User.getDefaultInstance()) { user_ = cn.wildfirechat.proto.WFCMessage.User.newBuilder(user_).mergeFrom(value).buildPartial(); } else { user_ = value; } onChanged(); } else { userBuilder_.mergeFrom(value); } bitField0_ |= 0x00000001; return this; } /** * required .User user = 1; */ public Builder clearUser() { if (userBuilder_ == null) { user_ = cn.wildfirechat.proto.WFCMessage.User.getDefaultInstance(); onChanged(); } else { userBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); return this; } /** * required .User user = 1; */ public cn.wildfirechat.proto.WFCMessage.User.Builder getUserBuilder() { bitField0_ |= 0x00000001; onChanged(); return getUserFieldBuilder().getBuilder(); } /** * required .User user = 1; */ public cn.wildfirechat.proto.WFCMessage.UserOrBuilder getUserOrBuilder() { if (userBuilder_ != null) { return userBuilder_.getMessageOrBuilder(); } else { return user_; } } /** * required .User user = 1; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.User, cn.wildfirechat.proto.WFCMessage.User.Builder, cn.wildfirechat.proto.WFCMessage.UserOrBuilder> getUserFieldBuilder() { if (userBuilder_ == null) { userBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.User, cn.wildfirechat.proto.WFCMessage.User.Builder, cn.wildfirechat.proto.WFCMessage.UserOrBuilder>( user_, getParentForChildren(), isClean()); user_ = null; } return userBuilder_; } // required int32 code = 2; private int code_ ; /** * required int32 code = 2; */ public boolean hasCode() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 code = 2; */ public int getCode() { return code_; } /** * required int32 code = 2; */ public Builder setCode(int value) { bitField0_ |= 0x00000002; code_ = value; onChanged(); return this; } /** * required int32 code = 2; */ public Builder clearCode() { bitField0_ = (bitField0_ & ~0x00000002); code_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:UserResult) } static { defaultInstance = new UserResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:UserResult) } public interface PullUserResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .UserResult result = 1; /** * repeated .UserResult result = 1; */ java.util.List getResultList(); /** * repeated .UserResult result = 1; */ cn.wildfirechat.proto.WFCMessage.UserResult getResult(int index); /** * repeated .UserResult result = 1; */ int getResultCount(); /** * repeated .UserResult result = 1; */ java.util.List getResultOrBuilderList(); /** * repeated .UserResult result = 1; */ cn.wildfirechat.proto.WFCMessage.UserResultOrBuilder getResultOrBuilder( int index); } /** * Protobuf type {@code PullUserResult} */ public static final class PullUserResult extends com.google.protobuf.GeneratedMessage implements PullUserResultOrBuilder { // Use PullUserResult.newBuilder() to construct. private PullUserResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private PullUserResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final PullUserResult defaultInstance; public static PullUserResult getDefaultInstance() { return defaultInstance; } public PullUserResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private PullUserResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { result_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } result_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.UserResult.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { result_ = java.util.Collections.unmodifiableList(result_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullUserResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullUserResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullUserResult.class, cn.wildfirechat.proto.WFCMessage.PullUserResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public PullUserResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new PullUserResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } // repeated .UserResult result = 1; public static final int RESULT_FIELD_NUMBER = 1; private java.util.List result_; /** * repeated .UserResult result = 1; */ public java.util.List getResultList() { return result_; } /** * repeated .UserResult result = 1; */ public java.util.List getResultOrBuilderList() { return result_; } /** * repeated .UserResult result = 1; */ public int getResultCount() { return result_.size(); } /** * repeated .UserResult result = 1; */ public cn.wildfirechat.proto.WFCMessage.UserResult getResult(int index) { return result_.get(index); } /** * repeated .UserResult result = 1; */ public cn.wildfirechat.proto.WFCMessage.UserResultOrBuilder getResultOrBuilder( int index) { return result_.get(index); } private void initFields() { result_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getResultCount(); i++) { if (!getResult(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < result_.size(); i++) { output.writeMessage(1, result_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < result_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, result_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.PullUserResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullUserResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullUserResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.PullUserResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullUserResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullUserResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullUserResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullUserResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.PullUserResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.PullUserResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.PullUserResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code PullUserResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.PullUserResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullUserResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullUserResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.PullUserResult.class, cn.wildfirechat.proto.WFCMessage.PullUserResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.PullUserResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getResultFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (resultBuilder_ == null) { result_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { resultBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_PullUserResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.PullUserResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.PullUserResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.PullUserResult build() { cn.wildfirechat.proto.WFCMessage.PullUserResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.PullUserResult buildPartial() { cn.wildfirechat.proto.WFCMessage.PullUserResult result = new cn.wildfirechat.proto.WFCMessage.PullUserResult(this); int from_bitField0_ = bitField0_; if (resultBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { result_ = java.util.Collections.unmodifiableList(result_); bitField0_ = (bitField0_ & ~0x00000001); } result.result_ = result_; } else { result.result_ = resultBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.PullUserResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.PullUserResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.PullUserResult other) { if (other == cn.wildfirechat.proto.WFCMessage.PullUserResult.getDefaultInstance()) return this; if (resultBuilder_ == null) { if (!other.result_.isEmpty()) { if (result_.isEmpty()) { result_ = other.result_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureResultIsMutable(); result_.addAll(other.result_); } onChanged(); } } else { if (!other.result_.isEmpty()) { if (resultBuilder_.isEmpty()) { resultBuilder_.dispose(); resultBuilder_ = null; result_ = other.result_; bitField0_ = (bitField0_ & ~0x00000001); resultBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getResultFieldBuilder() : null; } else { resultBuilder_.addAllMessages(other.result_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { for (int i = 0; i < getResultCount(); i++) { if (!getResult(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.PullUserResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.PullUserResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .UserResult result = 1; private java.util.List result_ = java.util.Collections.emptyList(); private void ensureResultIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { result_ = new java.util.ArrayList(result_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.UserResult, cn.wildfirechat.proto.WFCMessage.UserResult.Builder, cn.wildfirechat.proto.WFCMessage.UserResultOrBuilder> resultBuilder_; /** * repeated .UserResult result = 1; */ public java.util.List getResultList() { if (resultBuilder_ == null) { return java.util.Collections.unmodifiableList(result_); } else { return resultBuilder_.getMessageList(); } } /** * repeated .UserResult result = 1; */ public int getResultCount() { if (resultBuilder_ == null) { return result_.size(); } else { return resultBuilder_.getCount(); } } /** * repeated .UserResult result = 1; */ public cn.wildfirechat.proto.WFCMessage.UserResult getResult(int index) { if (resultBuilder_ == null) { return result_.get(index); } else { return resultBuilder_.getMessage(index); } } /** * repeated .UserResult result = 1; */ public Builder setResult( int index, cn.wildfirechat.proto.WFCMessage.UserResult value) { if (resultBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureResultIsMutable(); result_.set(index, value); onChanged(); } else { resultBuilder_.setMessage(index, value); } return this; } /** * repeated .UserResult result = 1; */ public Builder setResult( int index, cn.wildfirechat.proto.WFCMessage.UserResult.Builder builderForValue) { if (resultBuilder_ == null) { ensureResultIsMutable(); result_.set(index, builderForValue.build()); onChanged(); } else { resultBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .UserResult result = 1; */ public Builder addResult(cn.wildfirechat.proto.WFCMessage.UserResult value) { if (resultBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureResultIsMutable(); result_.add(value); onChanged(); } else { resultBuilder_.addMessage(value); } return this; } /** * repeated .UserResult result = 1; */ public Builder addResult( int index, cn.wildfirechat.proto.WFCMessage.UserResult value) { if (resultBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureResultIsMutable(); result_.add(index, value); onChanged(); } else { resultBuilder_.addMessage(index, value); } return this; } /** * repeated .UserResult result = 1; */ public Builder addResult( cn.wildfirechat.proto.WFCMessage.UserResult.Builder builderForValue) { if (resultBuilder_ == null) { ensureResultIsMutable(); result_.add(builderForValue.build()); onChanged(); } else { resultBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .UserResult result = 1; */ public Builder addResult( int index, cn.wildfirechat.proto.WFCMessage.UserResult.Builder builderForValue) { if (resultBuilder_ == null) { ensureResultIsMutable(); result_.add(index, builderForValue.build()); onChanged(); } else { resultBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .UserResult result = 1; */ public Builder addAllResult( java.lang.Iterable values) { if (resultBuilder_ == null) { ensureResultIsMutable(); super.addAll(values, result_); onChanged(); } else { resultBuilder_.addAllMessages(values); } return this; } /** * repeated .UserResult result = 1; */ public Builder clearResult() { if (resultBuilder_ == null) { result_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { resultBuilder_.clear(); } return this; } /** * repeated .UserResult result = 1; */ public Builder removeResult(int index) { if (resultBuilder_ == null) { ensureResultIsMutable(); result_.remove(index); onChanged(); } else { resultBuilder_.remove(index); } return this; } /** * repeated .UserResult result = 1; */ public cn.wildfirechat.proto.WFCMessage.UserResult.Builder getResultBuilder( int index) { return getResultFieldBuilder().getBuilder(index); } /** * repeated .UserResult result = 1; */ public cn.wildfirechat.proto.WFCMessage.UserResultOrBuilder getResultOrBuilder( int index) { if (resultBuilder_ == null) { return result_.get(index); } else { return resultBuilder_.getMessageOrBuilder(index); } } /** * repeated .UserResult result = 1; */ public java.util.List getResultOrBuilderList() { if (resultBuilder_ != null) { return resultBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(result_); } } /** * repeated .UserResult result = 1; */ public cn.wildfirechat.proto.WFCMessage.UserResult.Builder addResultBuilder() { return getResultFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.UserResult.getDefaultInstance()); } /** * repeated .UserResult result = 1; */ public cn.wildfirechat.proto.WFCMessage.UserResult.Builder addResultBuilder( int index) { return getResultFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.UserResult.getDefaultInstance()); } /** * repeated .UserResult result = 1; */ public java.util.List getResultBuilderList() { return getResultFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.UserResult, cn.wildfirechat.proto.WFCMessage.UserResult.Builder, cn.wildfirechat.proto.WFCMessage.UserResultOrBuilder> getResultFieldBuilder() { if (resultBuilder_ == null) { resultBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.UserResult, cn.wildfirechat.proto.WFCMessage.UserResult.Builder, cn.wildfirechat.proto.WFCMessage.UserResultOrBuilder>( result_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); result_ = null; } return resultBuilder_; } // @@protoc_insertion_point(builder_scope:PullUserResult) } static { defaultInstance = new PullUserResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:PullUserResult) } public interface QuitGroupRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string group_id = 1; /** * required string group_id = 1; */ boolean hasGroupId(); /** * required string group_id = 1; */ java.lang.String getGroupId(); /** * required string group_id = 1; */ com.google.protobuf.ByteString getGroupIdBytes(); // repeated int32 to_line = 2; /** * repeated int32 to_line = 2; */ java.util.List getToLineList(); /** * repeated int32 to_line = 2; */ int getToLineCount(); /** * repeated int32 to_line = 2; */ int getToLine(int index); // optional .MessageContent notify_content = 3; /** * optional .MessageContent notify_content = 3; */ boolean hasNotifyContent(); /** * optional .MessageContent notify_content = 3; */ cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent(); /** * optional .MessageContent notify_content = 3; */ cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder(); // optional int32 keep_msg = 4; /** * optional int32 keep_msg = 4; */ boolean hasKeepMsg(); /** * optional int32 keep_msg = 4; */ int getKeepMsg(); } /** * Protobuf type {@code QuitGroupRequest} */ public static final class QuitGroupRequest extends com.google.protobuf.GeneratedMessage implements QuitGroupRequestOrBuilder { // Use QuitGroupRequest.newBuilder() to construct. private QuitGroupRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private QuitGroupRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final QuitGroupRequest defaultInstance; public static QuitGroupRequest getDefaultInstance() { return defaultInstance; } public QuitGroupRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private QuitGroupRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; groupId_ = input.readBytes(); break; } case 16: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; } toLine_.add(input.readInt32()); break; } case 18: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000002) == 0x00000002) && input.getBytesUntilLimit() > 0) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; } while (input.getBytesUntilLimit() > 0) { toLine_.add(input.readInt32()); } input.popLimit(limit); break; } case 26: { cn.wildfirechat.proto.WFCMessage.MessageContent.Builder subBuilder = null; if (((bitField0_ & 0x00000002) == 0x00000002)) { subBuilder = notifyContent_.toBuilder(); } notifyContent_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.MessageContent.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(notifyContent_); notifyContent_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000002; break; } case 32: { bitField0_ |= 0x00000004; keepMsg_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_QuitGroupRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_QuitGroupRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.QuitGroupRequest.class, cn.wildfirechat.proto.WFCMessage.QuitGroupRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public QuitGroupRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new QuitGroupRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string group_id = 1; public static final int GROUP_ID_FIELD_NUMBER = 1; private java.lang.Object groupId_; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { groupId_ = s; } return s; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // repeated int32 to_line = 2; public static final int TO_LINE_FIELD_NUMBER = 2; private java.util.List toLine_; /** * repeated int32 to_line = 2; */ public java.util.List getToLineList() { return toLine_; } /** * repeated int32 to_line = 2; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 2; */ public int getToLine(int index) { return toLine_.get(index); } // optional .MessageContent notify_content = 3; public static final int NOTIFY_CONTENT_FIELD_NUMBER = 3; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_; /** * optional .MessageContent notify_content = 3; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { return notifyContent_; } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { return notifyContent_; } // optional int32 keep_msg = 4; public static final int KEEP_MSG_FIELD_NUMBER = 4; private int keepMsg_; /** * optional int32 keep_msg = 4; */ public boolean hasKeepMsg() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int32 keep_msg = 4; */ public int getKeepMsg() { return keepMsg_; } private void initFields() { groupId_ = ""; toLine_ = java.util.Collections.emptyList(); notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); keepMsg_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasGroupId()) { memoizedIsInitialized = 0; return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getGroupIdBytes()); } for (int i = 0; i < toLine_.size(); i++) { output.writeInt32(2, toLine_.get(i)); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(3, notifyContent_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(4, keepMsg_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getGroupIdBytes()); } { int dataSize = 0; for (int i = 0; i < toLine_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(toLine_.get(i)); } size += dataSize; size += 1 * getToLineList().size(); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(3, notifyContent_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(4, keepMsg_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.QuitGroupRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.QuitGroupRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.QuitGroupRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.QuitGroupRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.QuitGroupRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.QuitGroupRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.QuitGroupRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.QuitGroupRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.QuitGroupRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.QuitGroupRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.QuitGroupRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code QuitGroupRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.QuitGroupRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_QuitGroupRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_QuitGroupRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.QuitGroupRequest.class, cn.wildfirechat.proto.WFCMessage.QuitGroupRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.QuitGroupRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getNotifyContentFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); groupId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000004); keepMsg_ = 0; bitField0_ = (bitField0_ & ~0x00000008); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_QuitGroupRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.QuitGroupRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.QuitGroupRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.QuitGroupRequest build() { cn.wildfirechat.proto.WFCMessage.QuitGroupRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.QuitGroupRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.QuitGroupRequest result = new cn.wildfirechat.proto.WFCMessage.QuitGroupRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.groupId_ = groupId_; if (((bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); bitField0_ = (bitField0_ & ~0x00000002); } result.toLine_ = toLine_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000002; } if (notifyContentBuilder_ == null) { result.notifyContent_ = notifyContent_; } else { result.notifyContent_ = notifyContentBuilder_.build(); } if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000004; } result.keepMsg_ = keepMsg_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.QuitGroupRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.QuitGroupRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.QuitGroupRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.QuitGroupRequest.getDefaultInstance()) return this; if (other.hasGroupId()) { bitField0_ |= 0x00000001; groupId_ = other.groupId_; onChanged(); } if (!other.toLine_.isEmpty()) { if (toLine_.isEmpty()) { toLine_ = other.toLine_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureToLineIsMutable(); toLine_.addAll(other.toLine_); } onChanged(); } if (other.hasNotifyContent()) { mergeNotifyContent(other.getNotifyContent()); } if (other.hasKeepMsg()) { setKeepMsg(other.getKeepMsg()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasGroupId()) { return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.QuitGroupRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.QuitGroupRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string group_id = 1; private java.lang.Object groupId_ = ""; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); groupId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string group_id = 1; */ public Builder setGroupId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } /** * required string group_id = 1; */ public Builder clearGroupId() { bitField0_ = (bitField0_ & ~0x00000001); groupId_ = getDefaultInstance().getGroupId(); onChanged(); return this; } /** * required string group_id = 1; */ public Builder setGroupIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } // repeated int32 to_line = 2; private java.util.List toLine_ = java.util.Collections.emptyList(); private void ensureToLineIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = new java.util.ArrayList(toLine_); bitField0_ |= 0x00000002; } } /** * repeated int32 to_line = 2; */ public java.util.List getToLineList() { return java.util.Collections.unmodifiableList(toLine_); } /** * repeated int32 to_line = 2; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 2; */ public int getToLine(int index) { return toLine_.get(index); } /** * repeated int32 to_line = 2; */ public Builder setToLine( int index, int value) { ensureToLineIsMutable(); toLine_.set(index, value); onChanged(); return this; } /** * repeated int32 to_line = 2; */ public Builder addToLine(int value) { ensureToLineIsMutable(); toLine_.add(value); onChanged(); return this; } /** * repeated int32 to_line = 2; */ public Builder addAllToLine( java.lang.Iterable values) { ensureToLineIsMutable(); super.addAll(values, toLine_); onChanged(); return this; } /** * repeated int32 to_line = 2; */ public Builder clearToLine() { toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } // optional .MessageContent notify_content = 3; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> notifyContentBuilder_; /** * optional .MessageContent notify_content = 3; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { if (notifyContentBuilder_ == null) { return notifyContent_; } else { return notifyContentBuilder_.getMessage(); } } /** * optional .MessageContent notify_content = 3; */ public Builder setNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } notifyContent_ = value; onChanged(); } else { notifyContentBuilder_.setMessage(value); } bitField0_ |= 0x00000004; return this; } /** * optional .MessageContent notify_content = 3; */ public Builder setNotifyContent( cn.wildfirechat.proto.WFCMessage.MessageContent.Builder builderForValue) { if (notifyContentBuilder_ == null) { notifyContent_ = builderForValue.build(); onChanged(); } else { notifyContentBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000004; return this; } /** * optional .MessageContent notify_content = 3; */ public Builder mergeNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004) && notifyContent_ != cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder(notifyContent_).mergeFrom(value).buildPartial(); } else { notifyContent_ = value; } onChanged(); } else { notifyContentBuilder_.mergeFrom(value); } bitField0_ |= 0x00000004; return this; } /** * optional .MessageContent notify_content = 3; */ public Builder clearNotifyContent() { if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); onChanged(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000004); return this; } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent.Builder getNotifyContentBuilder() { bitField0_ |= 0x00000004; onChanged(); return getNotifyContentFieldBuilder().getBuilder(); } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { if (notifyContentBuilder_ != null) { return notifyContentBuilder_.getMessageOrBuilder(); } else { return notifyContent_; } } /** * optional .MessageContent notify_content = 3; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> getNotifyContentFieldBuilder() { if (notifyContentBuilder_ == null) { notifyContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder>( notifyContent_, getParentForChildren(), isClean()); notifyContent_ = null; } return notifyContentBuilder_; } // optional int32 keep_msg = 4; private int keepMsg_ ; /** * optional int32 keep_msg = 4; */ public boolean hasKeepMsg() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int32 keep_msg = 4; */ public int getKeepMsg() { return keepMsg_; } /** * optional int32 keep_msg = 4; */ public Builder setKeepMsg(int value) { bitField0_ |= 0x00000008; keepMsg_ = value; onChanged(); return this; } /** * optional int32 keep_msg = 4; */ public Builder clearKeepMsg() { bitField0_ = (bitField0_ & ~0x00000008); keepMsg_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:QuitGroupRequest) } static { defaultInstance = new QuitGroupRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:QuitGroupRequest) } public interface RemoveGroupMemberRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string group_id = 1; /** * required string group_id = 1; */ boolean hasGroupId(); /** * required string group_id = 1; */ java.lang.String getGroupId(); /** * required string group_id = 1; */ com.google.protobuf.ByteString getGroupIdBytes(); // repeated string removed_member = 2; /** * repeated string removed_member = 2; */ java.util.List getRemovedMemberList(); /** * repeated string removed_member = 2; */ int getRemovedMemberCount(); /** * repeated string removed_member = 2; */ java.lang.String getRemovedMember(int index); /** * repeated string removed_member = 2; */ com.google.protobuf.ByteString getRemovedMemberBytes(int index); // repeated int32 to_line = 3; /** * repeated int32 to_line = 3; */ java.util.List getToLineList(); /** * repeated int32 to_line = 3; */ int getToLineCount(); /** * repeated int32 to_line = 3; */ int getToLine(int index); // optional .MessageContent notify_content = 4; /** * optional .MessageContent notify_content = 4; */ boolean hasNotifyContent(); /** * optional .MessageContent notify_content = 4; */ cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent(); /** * optional .MessageContent notify_content = 4; */ cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder(); } /** * Protobuf type {@code RemoveGroupMemberRequest} */ public static final class RemoveGroupMemberRequest extends com.google.protobuf.GeneratedMessage implements RemoveGroupMemberRequestOrBuilder { // Use RemoveGroupMemberRequest.newBuilder() to construct. private RemoveGroupMemberRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private RemoveGroupMemberRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final RemoveGroupMemberRequest defaultInstance; public static RemoveGroupMemberRequest getDefaultInstance() { return defaultInstance; } public RemoveGroupMemberRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private RemoveGroupMemberRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; groupId_ = input.readBytes(); break; } case 18: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { removedMember_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000002; } removedMember_.add(input.readBytes()); break; } case 24: { if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } toLine_.add(input.readInt32()); break; } case 26: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000004) == 0x00000004) && input.getBytesUntilLimit() > 0) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } while (input.getBytesUntilLimit() > 0) { toLine_.add(input.readInt32()); } input.popLimit(limit); break; } case 34: { cn.wildfirechat.proto.WFCMessage.MessageContent.Builder subBuilder = null; if (((bitField0_ & 0x00000002) == 0x00000002)) { subBuilder = notifyContent_.toBuilder(); } notifyContent_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.MessageContent.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(notifyContent_); notifyContent_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000002; break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { removedMember_ = new com.google.protobuf.UnmodifiableLazyStringList(removedMember_); } if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_RemoveGroupMemberRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_RemoveGroupMemberRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest.class, cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public RemoveGroupMemberRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new RemoveGroupMemberRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string group_id = 1; public static final int GROUP_ID_FIELD_NUMBER = 1; private java.lang.Object groupId_; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { groupId_ = s; } return s; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // repeated string removed_member = 2; public static final int REMOVED_MEMBER_FIELD_NUMBER = 2; private com.google.protobuf.LazyStringList removedMember_; /** * repeated string removed_member = 2; */ public java.util.List getRemovedMemberList() { return removedMember_; } /** * repeated string removed_member = 2; */ public int getRemovedMemberCount() { return removedMember_.size(); } /** * repeated string removed_member = 2; */ public java.lang.String getRemovedMember(int index) { return removedMember_.get(index); } /** * repeated string removed_member = 2; */ public com.google.protobuf.ByteString getRemovedMemberBytes(int index) { return removedMember_.getByteString(index); } // repeated int32 to_line = 3; public static final int TO_LINE_FIELD_NUMBER = 3; private java.util.List toLine_; /** * repeated int32 to_line = 3; */ public java.util.List getToLineList() { return toLine_; } /** * repeated int32 to_line = 3; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 3; */ public int getToLine(int index) { return toLine_.get(index); } // optional .MessageContent notify_content = 4; public static final int NOTIFY_CONTENT_FIELD_NUMBER = 4; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_; /** * optional .MessageContent notify_content = 4; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { return notifyContent_; } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { return notifyContent_; } private void initFields() { groupId_ = ""; removedMember_ = com.google.protobuf.LazyStringArrayList.EMPTY; toLine_ = java.util.Collections.emptyList(); notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasGroupId()) { memoizedIsInitialized = 0; return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getGroupIdBytes()); } for (int i = 0; i < removedMember_.size(); i++) { output.writeBytes(2, removedMember_.getByteString(i)); } for (int i = 0; i < toLine_.size(); i++) { output.writeInt32(3, toLine_.get(i)); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(4, notifyContent_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getGroupIdBytes()); } { int dataSize = 0; for (int i = 0; i < removedMember_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeBytesSizeNoTag(removedMember_.getByteString(i)); } size += dataSize; size += 1 * getRemovedMemberList().size(); } { int dataSize = 0; for (int i = 0; i < toLine_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(toLine_.get(i)); } size += dataSize; size += 1 * getToLineList().size(); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, notifyContent_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code RemoveGroupMemberRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_RemoveGroupMemberRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_RemoveGroupMemberRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest.class, cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getNotifyContentFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); groupId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); removedMember_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000002); toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000008); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_RemoveGroupMemberRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest build() { cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest result = new cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.groupId_ = groupId_; if (((bitField0_ & 0x00000002) == 0x00000002)) { removedMember_ = new com.google.protobuf.UnmodifiableLazyStringList( removedMember_); bitField0_ = (bitField0_ & ~0x00000002); } result.removedMember_ = removedMember_; if (((bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); bitField0_ = (bitField0_ & ~0x00000004); } result.toLine_ = toLine_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000002; } if (notifyContentBuilder_ == null) { result.notifyContent_ = notifyContent_; } else { result.notifyContent_ = notifyContentBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest.getDefaultInstance()) return this; if (other.hasGroupId()) { bitField0_ |= 0x00000001; groupId_ = other.groupId_; onChanged(); } if (!other.removedMember_.isEmpty()) { if (removedMember_.isEmpty()) { removedMember_ = other.removedMember_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureRemovedMemberIsMutable(); removedMember_.addAll(other.removedMember_); } onChanged(); } if (!other.toLine_.isEmpty()) { if (toLine_.isEmpty()) { toLine_ = other.toLine_; bitField0_ = (bitField0_ & ~0x00000004); } else { ensureToLineIsMutable(); toLine_.addAll(other.toLine_); } onChanged(); } if (other.hasNotifyContent()) { mergeNotifyContent(other.getNotifyContent()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasGroupId()) { return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.RemoveGroupMemberRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string group_id = 1; private java.lang.Object groupId_ = ""; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); groupId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string group_id = 1; */ public Builder setGroupId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } /** * required string group_id = 1; */ public Builder clearGroupId() { bitField0_ = (bitField0_ & ~0x00000001); groupId_ = getDefaultInstance().getGroupId(); onChanged(); return this; } /** * required string group_id = 1; */ public Builder setGroupIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } // repeated string removed_member = 2; private com.google.protobuf.LazyStringList removedMember_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureRemovedMemberIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { removedMember_ = new com.google.protobuf.LazyStringArrayList(removedMember_); bitField0_ |= 0x00000002; } } /** * repeated string removed_member = 2; */ public java.util.List getRemovedMemberList() { return java.util.Collections.unmodifiableList(removedMember_); } /** * repeated string removed_member = 2; */ public int getRemovedMemberCount() { return removedMember_.size(); } /** * repeated string removed_member = 2; */ public java.lang.String getRemovedMember(int index) { return removedMember_.get(index); } /** * repeated string removed_member = 2; */ public com.google.protobuf.ByteString getRemovedMemberBytes(int index) { return removedMember_.getByteString(index); } /** * repeated string removed_member = 2; */ public Builder setRemovedMember( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureRemovedMemberIsMutable(); removedMember_.set(index, value); onChanged(); return this; } /** * repeated string removed_member = 2; */ public Builder addRemovedMember( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureRemovedMemberIsMutable(); removedMember_.add(value); onChanged(); return this; } /** * repeated string removed_member = 2; */ public Builder addAllRemovedMember( java.lang.Iterable values) { ensureRemovedMemberIsMutable(); super.addAll(values, removedMember_); onChanged(); return this; } /** * repeated string removed_member = 2; */ public Builder clearRemovedMember() { removedMember_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } /** * repeated string removed_member = 2; */ public Builder addRemovedMemberBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } ensureRemovedMemberIsMutable(); removedMember_.add(value); onChanged(); return this; } // repeated int32 to_line = 3; private java.util.List toLine_ = java.util.Collections.emptyList(); private void ensureToLineIsMutable() { if (!((bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = new java.util.ArrayList(toLine_); bitField0_ |= 0x00000004; } } /** * repeated int32 to_line = 3; */ public java.util.List getToLineList() { return java.util.Collections.unmodifiableList(toLine_); } /** * repeated int32 to_line = 3; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 3; */ public int getToLine(int index) { return toLine_.get(index); } /** * repeated int32 to_line = 3; */ public Builder setToLine( int index, int value) { ensureToLineIsMutable(); toLine_.set(index, value); onChanged(); return this; } /** * repeated int32 to_line = 3; */ public Builder addToLine(int value) { ensureToLineIsMutable(); toLine_.add(value); onChanged(); return this; } /** * repeated int32 to_line = 3; */ public Builder addAllToLine( java.lang.Iterable values) { ensureToLineIsMutable(); super.addAll(values, toLine_); onChanged(); return this; } /** * repeated int32 to_line = 3; */ public Builder clearToLine() { toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } // optional .MessageContent notify_content = 4; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> notifyContentBuilder_; /** * optional .MessageContent notify_content = 4; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { if (notifyContentBuilder_ == null) { return notifyContent_; } else { return notifyContentBuilder_.getMessage(); } } /** * optional .MessageContent notify_content = 4; */ public Builder setNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } notifyContent_ = value; onChanged(); } else { notifyContentBuilder_.setMessage(value); } bitField0_ |= 0x00000008; return this; } /** * optional .MessageContent notify_content = 4; */ public Builder setNotifyContent( cn.wildfirechat.proto.WFCMessage.MessageContent.Builder builderForValue) { if (notifyContentBuilder_ == null) { notifyContent_ = builderForValue.build(); onChanged(); } else { notifyContentBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000008; return this; } /** * optional .MessageContent notify_content = 4; */ public Builder mergeNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (((bitField0_ & 0x00000008) == 0x00000008) && notifyContent_ != cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder(notifyContent_).mergeFrom(value).buildPartial(); } else { notifyContent_ = value; } onChanged(); } else { notifyContentBuilder_.mergeFrom(value); } bitField0_ |= 0x00000008; return this; } /** * optional .MessageContent notify_content = 4; */ public Builder clearNotifyContent() { if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); onChanged(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000008); return this; } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContent.Builder getNotifyContentBuilder() { bitField0_ |= 0x00000008; onChanged(); return getNotifyContentFieldBuilder().getBuilder(); } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { if (notifyContentBuilder_ != null) { return notifyContentBuilder_.getMessageOrBuilder(); } else { return notifyContent_; } } /** * optional .MessageContent notify_content = 4; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> getNotifyContentFieldBuilder() { if (notifyContentBuilder_ == null) { notifyContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder>( notifyContent_, getParentForChildren(), isClean()); notifyContent_ = null; } return notifyContentBuilder_; } // @@protoc_insertion_point(builder_scope:RemoveGroupMemberRequest) } static { defaultInstance = new RemoveGroupMemberRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:RemoveGroupMemberRequest) } public interface TransferGroupRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string group_id = 1; /** * required string group_id = 1; */ boolean hasGroupId(); /** * required string group_id = 1; */ java.lang.String getGroupId(); /** * required string group_id = 1; */ com.google.protobuf.ByteString getGroupIdBytes(); // required string new_owner = 2; /** * required string new_owner = 2; */ boolean hasNewOwner(); /** * required string new_owner = 2; */ java.lang.String getNewOwner(); /** * required string new_owner = 2; */ com.google.protobuf.ByteString getNewOwnerBytes(); // repeated int32 to_line = 3; /** * repeated int32 to_line = 3; */ java.util.List getToLineList(); /** * repeated int32 to_line = 3; */ int getToLineCount(); /** * repeated int32 to_line = 3; */ int getToLine(int index); // optional .MessageContent notify_content = 4; /** * optional .MessageContent notify_content = 4; */ boolean hasNotifyContent(); /** * optional .MessageContent notify_content = 4; */ cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent(); /** * optional .MessageContent notify_content = 4; */ cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder(); } /** * Protobuf type {@code TransferGroupRequest} */ public static final class TransferGroupRequest extends com.google.protobuf.GeneratedMessage implements TransferGroupRequestOrBuilder { // Use TransferGroupRequest.newBuilder() to construct. private TransferGroupRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private TransferGroupRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final TransferGroupRequest defaultInstance; public static TransferGroupRequest getDefaultInstance() { return defaultInstance; } public TransferGroupRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private TransferGroupRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; groupId_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; newOwner_ = input.readBytes(); break; } case 24: { if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } toLine_.add(input.readInt32()); break; } case 26: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000004) == 0x00000004) && input.getBytesUntilLimit() > 0) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } while (input.getBytesUntilLimit() > 0) { toLine_.add(input.readInt32()); } input.popLimit(limit); break; } case 34: { cn.wildfirechat.proto.WFCMessage.MessageContent.Builder subBuilder = null; if (((bitField0_ & 0x00000004) == 0x00000004)) { subBuilder = notifyContent_.toBuilder(); } notifyContent_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.MessageContent.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(notifyContent_); notifyContent_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000004; break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_TransferGroupRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_TransferGroupRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.TransferGroupRequest.class, cn.wildfirechat.proto.WFCMessage.TransferGroupRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public TransferGroupRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new TransferGroupRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string group_id = 1; public static final int GROUP_ID_FIELD_NUMBER = 1; private java.lang.Object groupId_; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { groupId_ = s; } return s; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string new_owner = 2; public static final int NEW_OWNER_FIELD_NUMBER = 2; private java.lang.Object newOwner_; /** * required string new_owner = 2; */ public boolean hasNewOwner() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string new_owner = 2; */ public java.lang.String getNewOwner() { java.lang.Object ref = newOwner_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { newOwner_ = s; } return s; } } /** * required string new_owner = 2; */ public com.google.protobuf.ByteString getNewOwnerBytes() { java.lang.Object ref = newOwner_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); newOwner_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // repeated int32 to_line = 3; public static final int TO_LINE_FIELD_NUMBER = 3; private java.util.List toLine_; /** * repeated int32 to_line = 3; */ public java.util.List getToLineList() { return toLine_; } /** * repeated int32 to_line = 3; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 3; */ public int getToLine(int index) { return toLine_.get(index); } // optional .MessageContent notify_content = 4; public static final int NOTIFY_CONTENT_FIELD_NUMBER = 4; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_; /** * optional .MessageContent notify_content = 4; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { return notifyContent_; } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { return notifyContent_; } private void initFields() { groupId_ = ""; newOwner_ = ""; toLine_ = java.util.Collections.emptyList(); notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasGroupId()) { memoizedIsInitialized = 0; return false; } if (!hasNewOwner()) { memoizedIsInitialized = 0; return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getGroupIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getNewOwnerBytes()); } for (int i = 0; i < toLine_.size(); i++) { output.writeInt32(3, toLine_.get(i)); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeMessage(4, notifyContent_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getGroupIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getNewOwnerBytes()); } { int dataSize = 0; for (int i = 0; i < toLine_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(toLine_.get(i)); } size += dataSize; size += 1 * getToLineList().size(); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, notifyContent_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.TransferGroupRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.TransferGroupRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.TransferGroupRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.TransferGroupRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.TransferGroupRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.TransferGroupRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.TransferGroupRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.TransferGroupRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.TransferGroupRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.TransferGroupRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.TransferGroupRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code TransferGroupRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.TransferGroupRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_TransferGroupRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_TransferGroupRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.TransferGroupRequest.class, cn.wildfirechat.proto.WFCMessage.TransferGroupRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.TransferGroupRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getNotifyContentFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); groupId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); newOwner_ = ""; bitField0_ = (bitField0_ & ~0x00000002); toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000008); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_TransferGroupRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.TransferGroupRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.TransferGroupRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.TransferGroupRequest build() { cn.wildfirechat.proto.WFCMessage.TransferGroupRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.TransferGroupRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.TransferGroupRequest result = new cn.wildfirechat.proto.WFCMessage.TransferGroupRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.groupId_ = groupId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.newOwner_ = newOwner_; if (((bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); bitField0_ = (bitField0_ & ~0x00000004); } result.toLine_ = toLine_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000004; } if (notifyContentBuilder_ == null) { result.notifyContent_ = notifyContent_; } else { result.notifyContent_ = notifyContentBuilder_.build(); } result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.TransferGroupRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.TransferGroupRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.TransferGroupRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.TransferGroupRequest.getDefaultInstance()) return this; if (other.hasGroupId()) { bitField0_ |= 0x00000001; groupId_ = other.groupId_; onChanged(); } if (other.hasNewOwner()) { bitField0_ |= 0x00000002; newOwner_ = other.newOwner_; onChanged(); } if (!other.toLine_.isEmpty()) { if (toLine_.isEmpty()) { toLine_ = other.toLine_; bitField0_ = (bitField0_ & ~0x00000004); } else { ensureToLineIsMutable(); toLine_.addAll(other.toLine_); } onChanged(); } if (other.hasNotifyContent()) { mergeNotifyContent(other.getNotifyContent()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasGroupId()) { return false; } if (!hasNewOwner()) { return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.TransferGroupRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.TransferGroupRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string group_id = 1; private java.lang.Object groupId_ = ""; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); groupId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string group_id = 1; */ public Builder setGroupId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } /** * required string group_id = 1; */ public Builder clearGroupId() { bitField0_ = (bitField0_ & ~0x00000001); groupId_ = getDefaultInstance().getGroupId(); onChanged(); return this; } /** * required string group_id = 1; */ public Builder setGroupIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } // required string new_owner = 2; private java.lang.Object newOwner_ = ""; /** * required string new_owner = 2; */ public boolean hasNewOwner() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string new_owner = 2; */ public java.lang.String getNewOwner() { java.lang.Object ref = newOwner_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); newOwner_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string new_owner = 2; */ public com.google.protobuf.ByteString getNewOwnerBytes() { java.lang.Object ref = newOwner_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); newOwner_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string new_owner = 2; */ public Builder setNewOwner( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; newOwner_ = value; onChanged(); return this; } /** * required string new_owner = 2; */ public Builder clearNewOwner() { bitField0_ = (bitField0_ & ~0x00000002); newOwner_ = getDefaultInstance().getNewOwner(); onChanged(); return this; } /** * required string new_owner = 2; */ public Builder setNewOwnerBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; newOwner_ = value; onChanged(); return this; } // repeated int32 to_line = 3; private java.util.List toLine_ = java.util.Collections.emptyList(); private void ensureToLineIsMutable() { if (!((bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = new java.util.ArrayList(toLine_); bitField0_ |= 0x00000004; } } /** * repeated int32 to_line = 3; */ public java.util.List getToLineList() { return java.util.Collections.unmodifiableList(toLine_); } /** * repeated int32 to_line = 3; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 3; */ public int getToLine(int index) { return toLine_.get(index); } /** * repeated int32 to_line = 3; */ public Builder setToLine( int index, int value) { ensureToLineIsMutable(); toLine_.set(index, value); onChanged(); return this; } /** * repeated int32 to_line = 3; */ public Builder addToLine(int value) { ensureToLineIsMutable(); toLine_.add(value); onChanged(); return this; } /** * repeated int32 to_line = 3; */ public Builder addAllToLine( java.lang.Iterable values) { ensureToLineIsMutable(); super.addAll(values, toLine_); onChanged(); return this; } /** * repeated int32 to_line = 3; */ public Builder clearToLine() { toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } // optional .MessageContent notify_content = 4; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> notifyContentBuilder_; /** * optional .MessageContent notify_content = 4; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { if (notifyContentBuilder_ == null) { return notifyContent_; } else { return notifyContentBuilder_.getMessage(); } } /** * optional .MessageContent notify_content = 4; */ public Builder setNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } notifyContent_ = value; onChanged(); } else { notifyContentBuilder_.setMessage(value); } bitField0_ |= 0x00000008; return this; } /** * optional .MessageContent notify_content = 4; */ public Builder setNotifyContent( cn.wildfirechat.proto.WFCMessage.MessageContent.Builder builderForValue) { if (notifyContentBuilder_ == null) { notifyContent_ = builderForValue.build(); onChanged(); } else { notifyContentBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000008; return this; } /** * optional .MessageContent notify_content = 4; */ public Builder mergeNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (((bitField0_ & 0x00000008) == 0x00000008) && notifyContent_ != cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder(notifyContent_).mergeFrom(value).buildPartial(); } else { notifyContent_ = value; } onChanged(); } else { notifyContentBuilder_.mergeFrom(value); } bitField0_ |= 0x00000008; return this; } /** * optional .MessageContent notify_content = 4; */ public Builder clearNotifyContent() { if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); onChanged(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000008); return this; } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContent.Builder getNotifyContentBuilder() { bitField0_ |= 0x00000008; onChanged(); return getNotifyContentFieldBuilder().getBuilder(); } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { if (notifyContentBuilder_ != null) { return notifyContentBuilder_.getMessageOrBuilder(); } else { return notifyContent_; } } /** * optional .MessageContent notify_content = 4; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> getNotifyContentFieldBuilder() { if (notifyContentBuilder_ == null) { notifyContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder>( notifyContent_, getParentForChildren(), isClean()); notifyContent_ = null; } return notifyContentBuilder_; } // @@protoc_insertion_point(builder_scope:TransferGroupRequest) } static { defaultInstance = new TransferGroupRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:TransferGroupRequest) } public interface ModifyGroupMemberAliasOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string group_id = 1; /** * required string group_id = 1; */ boolean hasGroupId(); /** * required string group_id = 1; */ java.lang.String getGroupId(); /** * required string group_id = 1; */ com.google.protobuf.ByteString getGroupIdBytes(); // required string alias = 2; /** * required string alias = 2; */ boolean hasAlias(); /** * required string alias = 2; */ java.lang.String getAlias(); /** * required string alias = 2; */ com.google.protobuf.ByteString getAliasBytes(); // repeated int32 to_line = 3; /** * repeated int32 to_line = 3; */ java.util.List getToLineList(); /** * repeated int32 to_line = 3; */ int getToLineCount(); /** * repeated int32 to_line = 3; */ int getToLine(int index); // optional .MessageContent notify_content = 4; /** * optional .MessageContent notify_content = 4; */ boolean hasNotifyContent(); /** * optional .MessageContent notify_content = 4; */ cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent(); /** * optional .MessageContent notify_content = 4; */ cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder(); // optional string member_id = 5; /** * optional string member_id = 5; */ boolean hasMemberId(); /** * optional string member_id = 5; */ java.lang.String getMemberId(); /** * optional string member_id = 5; */ com.google.protobuf.ByteString getMemberIdBytes(); } /** * Protobuf type {@code ModifyGroupMemberAlias} */ public static final class ModifyGroupMemberAlias extends com.google.protobuf.GeneratedMessage implements ModifyGroupMemberAliasOrBuilder { // Use ModifyGroupMemberAlias.newBuilder() to construct. private ModifyGroupMemberAlias(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ModifyGroupMemberAlias(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ModifyGroupMemberAlias defaultInstance; public static ModifyGroupMemberAlias getDefaultInstance() { return defaultInstance; } public ModifyGroupMemberAlias getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ModifyGroupMemberAlias( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; groupId_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; alias_ = input.readBytes(); break; } case 24: { if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } toLine_.add(input.readInt32()); break; } case 26: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000004) == 0x00000004) && input.getBytesUntilLimit() > 0) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000004; } while (input.getBytesUntilLimit() > 0) { toLine_.add(input.readInt32()); } input.popLimit(limit); break; } case 34: { cn.wildfirechat.proto.WFCMessage.MessageContent.Builder subBuilder = null; if (((bitField0_ & 0x00000004) == 0x00000004)) { subBuilder = notifyContent_.toBuilder(); } notifyContent_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.MessageContent.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(notifyContent_); notifyContent_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000004; break; } case 42: { bitField0_ |= 0x00000008; memberId_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupMemberAlias_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupMemberAlias_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias.class, cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ModifyGroupMemberAlias parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ModifyGroupMemberAlias(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string group_id = 1; public static final int GROUP_ID_FIELD_NUMBER = 1; private java.lang.Object groupId_; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { groupId_ = s; } return s; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string alias = 2; public static final int ALIAS_FIELD_NUMBER = 2; private java.lang.Object alias_; /** * required string alias = 2; */ public boolean hasAlias() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string alias = 2; */ public java.lang.String getAlias() { java.lang.Object ref = alias_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { alias_ = s; } return s; } } /** * required string alias = 2; */ public com.google.protobuf.ByteString getAliasBytes() { java.lang.Object ref = alias_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); alias_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // repeated int32 to_line = 3; public static final int TO_LINE_FIELD_NUMBER = 3; private java.util.List toLine_; /** * repeated int32 to_line = 3; */ public java.util.List getToLineList() { return toLine_; } /** * repeated int32 to_line = 3; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 3; */ public int getToLine(int index) { return toLine_.get(index); } // optional .MessageContent notify_content = 4; public static final int NOTIFY_CONTENT_FIELD_NUMBER = 4; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_; /** * optional .MessageContent notify_content = 4; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { return notifyContent_; } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { return notifyContent_; } // optional string member_id = 5; public static final int MEMBER_ID_FIELD_NUMBER = 5; private java.lang.Object memberId_; /** * optional string member_id = 5; */ public boolean hasMemberId() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string member_id = 5; */ public java.lang.String getMemberId() { java.lang.Object ref = memberId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { memberId_ = s; } return s; } } /** * optional string member_id = 5; */ public com.google.protobuf.ByteString getMemberIdBytes() { java.lang.Object ref = memberId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); memberId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { groupId_ = ""; alias_ = ""; toLine_ = java.util.Collections.emptyList(); notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); memberId_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasGroupId()) { memoizedIsInitialized = 0; return false; } if (!hasAlias()) { memoizedIsInitialized = 0; return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getGroupIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getAliasBytes()); } for (int i = 0; i < toLine_.size(); i++) { output.writeInt32(3, toLine_.get(i)); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeMessage(4, notifyContent_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(5, getMemberIdBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getGroupIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getAliasBytes()); } { int dataSize = 0; for (int i = 0; i < toLine_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(toLine_.get(i)); } size += dataSize; size += 1 * getToLineList().size(); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, notifyContent_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(5, getMemberIdBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ModifyGroupMemberAlias} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAliasOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupMemberAlias_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupMemberAlias_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias.class, cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getNotifyContentFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); groupId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); alias_ = ""; bitField0_ = (bitField0_ & ~0x00000002); toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000008); memberId_ = ""; bitField0_ = (bitField0_ & ~0x00000010); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupMemberAlias_descriptor; } public cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias build() { cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias buildPartial() { cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias result = new cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.groupId_ = groupId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.alias_ = alias_; if (((bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); bitField0_ = (bitField0_ & ~0x00000004); } result.toLine_ = toLine_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000004; } if (notifyContentBuilder_ == null) { result.notifyContent_ = notifyContent_; } else { result.notifyContent_ = notifyContentBuilder_.build(); } if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000008; } result.memberId_ = memberId_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias other) { if (other == cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias.getDefaultInstance()) return this; if (other.hasGroupId()) { bitField0_ |= 0x00000001; groupId_ = other.groupId_; onChanged(); } if (other.hasAlias()) { bitField0_ |= 0x00000002; alias_ = other.alias_; onChanged(); } if (!other.toLine_.isEmpty()) { if (toLine_.isEmpty()) { toLine_ = other.toLine_; bitField0_ = (bitField0_ & ~0x00000004); } else { ensureToLineIsMutable(); toLine_.addAll(other.toLine_); } onChanged(); } if (other.hasNotifyContent()) { mergeNotifyContent(other.getNotifyContent()); } if (other.hasMemberId()) { bitField0_ |= 0x00000010; memberId_ = other.memberId_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasGroupId()) { return false; } if (!hasAlias()) { return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberAlias) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string group_id = 1; private java.lang.Object groupId_ = ""; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); groupId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string group_id = 1; */ public Builder setGroupId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } /** * required string group_id = 1; */ public Builder clearGroupId() { bitField0_ = (bitField0_ & ~0x00000001); groupId_ = getDefaultInstance().getGroupId(); onChanged(); return this; } /** * required string group_id = 1; */ public Builder setGroupIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } // required string alias = 2; private java.lang.Object alias_ = ""; /** * required string alias = 2; */ public boolean hasAlias() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string alias = 2; */ public java.lang.String getAlias() { java.lang.Object ref = alias_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); alias_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string alias = 2; */ public com.google.protobuf.ByteString getAliasBytes() { java.lang.Object ref = alias_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); alias_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string alias = 2; */ public Builder setAlias( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; alias_ = value; onChanged(); return this; } /** * required string alias = 2; */ public Builder clearAlias() { bitField0_ = (bitField0_ & ~0x00000002); alias_ = getDefaultInstance().getAlias(); onChanged(); return this; } /** * required string alias = 2; */ public Builder setAliasBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; alias_ = value; onChanged(); return this; } // repeated int32 to_line = 3; private java.util.List toLine_ = java.util.Collections.emptyList(); private void ensureToLineIsMutable() { if (!((bitField0_ & 0x00000004) == 0x00000004)) { toLine_ = new java.util.ArrayList(toLine_); bitField0_ |= 0x00000004; } } /** * repeated int32 to_line = 3; */ public java.util.List getToLineList() { return java.util.Collections.unmodifiableList(toLine_); } /** * repeated int32 to_line = 3; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 3; */ public int getToLine(int index) { return toLine_.get(index); } /** * repeated int32 to_line = 3; */ public Builder setToLine( int index, int value) { ensureToLineIsMutable(); toLine_.set(index, value); onChanged(); return this; } /** * repeated int32 to_line = 3; */ public Builder addToLine(int value) { ensureToLineIsMutable(); toLine_.add(value); onChanged(); return this; } /** * repeated int32 to_line = 3; */ public Builder addAllToLine( java.lang.Iterable values) { ensureToLineIsMutable(); super.addAll(values, toLine_); onChanged(); return this; } /** * repeated int32 to_line = 3; */ public Builder clearToLine() { toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } // optional .MessageContent notify_content = 4; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> notifyContentBuilder_; /** * optional .MessageContent notify_content = 4; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { if (notifyContentBuilder_ == null) { return notifyContent_; } else { return notifyContentBuilder_.getMessage(); } } /** * optional .MessageContent notify_content = 4; */ public Builder setNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } notifyContent_ = value; onChanged(); } else { notifyContentBuilder_.setMessage(value); } bitField0_ |= 0x00000008; return this; } /** * optional .MessageContent notify_content = 4; */ public Builder setNotifyContent( cn.wildfirechat.proto.WFCMessage.MessageContent.Builder builderForValue) { if (notifyContentBuilder_ == null) { notifyContent_ = builderForValue.build(); onChanged(); } else { notifyContentBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000008; return this; } /** * optional .MessageContent notify_content = 4; */ public Builder mergeNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (((bitField0_ & 0x00000008) == 0x00000008) && notifyContent_ != cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder(notifyContent_).mergeFrom(value).buildPartial(); } else { notifyContent_ = value; } onChanged(); } else { notifyContentBuilder_.mergeFrom(value); } bitField0_ |= 0x00000008; return this; } /** * optional .MessageContent notify_content = 4; */ public Builder clearNotifyContent() { if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); onChanged(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000008); return this; } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContent.Builder getNotifyContentBuilder() { bitField0_ |= 0x00000008; onChanged(); return getNotifyContentFieldBuilder().getBuilder(); } /** * optional .MessageContent notify_content = 4; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { if (notifyContentBuilder_ != null) { return notifyContentBuilder_.getMessageOrBuilder(); } else { return notifyContent_; } } /** * optional .MessageContent notify_content = 4; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> getNotifyContentFieldBuilder() { if (notifyContentBuilder_ == null) { notifyContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder>( notifyContent_, getParentForChildren(), isClean()); notifyContent_ = null; } return notifyContentBuilder_; } // optional string member_id = 5; private java.lang.Object memberId_ = ""; /** * optional string member_id = 5; */ public boolean hasMemberId() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string member_id = 5; */ public java.lang.String getMemberId() { java.lang.Object ref = memberId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); memberId_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string member_id = 5; */ public com.google.protobuf.ByteString getMemberIdBytes() { java.lang.Object ref = memberId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); memberId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string member_id = 5; */ public Builder setMemberId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; memberId_ = value; onChanged(); return this; } /** * optional string member_id = 5; */ public Builder clearMemberId() { bitField0_ = (bitField0_ & ~0x00000010); memberId_ = getDefaultInstance().getMemberId(); onChanged(); return this; } /** * optional string member_id = 5; */ public Builder setMemberIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; memberId_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:ModifyGroupMemberAlias) } static { defaultInstance = new ModifyGroupMemberAlias(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ModifyGroupMemberAlias) } public interface ModifyGroupMemberExtraOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string group_id = 1; /** * required string group_id = 1; */ boolean hasGroupId(); /** * required string group_id = 1; */ java.lang.String getGroupId(); /** * required string group_id = 1; */ com.google.protobuf.ByteString getGroupIdBytes(); // repeated int32 to_line = 2; /** * repeated int32 to_line = 2; */ java.util.List getToLineList(); /** * repeated int32 to_line = 2; */ int getToLineCount(); /** * repeated int32 to_line = 2; */ int getToLine(int index); // optional .MessageContent notify_content = 3; /** * optional .MessageContent notify_content = 3; */ boolean hasNotifyContent(); /** * optional .MessageContent notify_content = 3; */ cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent(); /** * optional .MessageContent notify_content = 3; */ cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder(); // optional string extra = 4; /** * optional string extra = 4; */ boolean hasExtra(); /** * optional string extra = 4; */ java.lang.String getExtra(); /** * optional string extra = 4; */ com.google.protobuf.ByteString getExtraBytes(); // optional string member_id = 5; /** * optional string member_id = 5; */ boolean hasMemberId(); /** * optional string member_id = 5; */ java.lang.String getMemberId(); /** * optional string member_id = 5; */ com.google.protobuf.ByteString getMemberIdBytes(); } /** * Protobuf type {@code ModifyGroupMemberExtra} */ public static final class ModifyGroupMemberExtra extends com.google.protobuf.GeneratedMessage implements ModifyGroupMemberExtraOrBuilder { // Use ModifyGroupMemberExtra.newBuilder() to construct. private ModifyGroupMemberExtra(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ModifyGroupMemberExtra(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ModifyGroupMemberExtra defaultInstance; public static ModifyGroupMemberExtra getDefaultInstance() { return defaultInstance; } public ModifyGroupMemberExtra getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ModifyGroupMemberExtra( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; groupId_ = input.readBytes(); break; } case 16: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; } toLine_.add(input.readInt32()); break; } case 18: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000002) == 0x00000002) && input.getBytesUntilLimit() > 0) { toLine_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000002; } while (input.getBytesUntilLimit() > 0) { toLine_.add(input.readInt32()); } input.popLimit(limit); break; } case 26: { cn.wildfirechat.proto.WFCMessage.MessageContent.Builder subBuilder = null; if (((bitField0_ & 0x00000002) == 0x00000002)) { subBuilder = notifyContent_.toBuilder(); } notifyContent_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.MessageContent.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(notifyContent_); notifyContent_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000002; break; } case 34: { bitField0_ |= 0x00000004; extra_ = input.readBytes(); break; } case 42: { bitField0_ |= 0x00000008; memberId_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupMemberExtra_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupMemberExtra_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra.class, cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ModifyGroupMemberExtra parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ModifyGroupMemberExtra(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string group_id = 1; public static final int GROUP_ID_FIELD_NUMBER = 1; private java.lang.Object groupId_; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { groupId_ = s; } return s; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // repeated int32 to_line = 2; public static final int TO_LINE_FIELD_NUMBER = 2; private java.util.List toLine_; /** * repeated int32 to_line = 2; */ public java.util.List getToLineList() { return toLine_; } /** * repeated int32 to_line = 2; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 2; */ public int getToLine(int index) { return toLine_.get(index); } // optional .MessageContent notify_content = 3; public static final int NOTIFY_CONTENT_FIELD_NUMBER = 3; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_; /** * optional .MessageContent notify_content = 3; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { return notifyContent_; } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { return notifyContent_; } // optional string extra = 4; public static final int EXTRA_FIELD_NUMBER = 4; private java.lang.Object extra_; /** * optional string extra = 4; */ public boolean hasExtra() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string extra = 4; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 4; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string member_id = 5; public static final int MEMBER_ID_FIELD_NUMBER = 5; private java.lang.Object memberId_; /** * optional string member_id = 5; */ public boolean hasMemberId() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string member_id = 5; */ public java.lang.String getMemberId() { java.lang.Object ref = memberId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { memberId_ = s; } return s; } } /** * optional string member_id = 5; */ public com.google.protobuf.ByteString getMemberIdBytes() { java.lang.Object ref = memberId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); memberId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { groupId_ = ""; toLine_ = java.util.Collections.emptyList(); notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); extra_ = ""; memberId_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasGroupId()) { memoizedIsInitialized = 0; return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getGroupIdBytes()); } for (int i = 0; i < toLine_.size(); i++) { output.writeInt32(2, toLine_.get(i)); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(3, notifyContent_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(4, getExtraBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(5, getMemberIdBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getGroupIdBytes()); } { int dataSize = 0; for (int i = 0; i < toLine_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(toLine_.get(i)); } size += dataSize; size += 1 * getToLineList().size(); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(3, notifyContent_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getExtraBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(5, getMemberIdBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ModifyGroupMemberExtra} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtraOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupMemberExtra_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupMemberExtra_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra.class, cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getNotifyContentFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); groupId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000004); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000008); memberId_ = ""; bitField0_ = (bitField0_ & ~0x00000010); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyGroupMemberExtra_descriptor; } public cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra build() { cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra buildPartial() { cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra result = new cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.groupId_ = groupId_; if (((bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = java.util.Collections.unmodifiableList(toLine_); bitField0_ = (bitField0_ & ~0x00000002); } result.toLine_ = toLine_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000002; } if (notifyContentBuilder_ == null) { result.notifyContent_ = notifyContent_; } else { result.notifyContent_ = notifyContentBuilder_.build(); } if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000004; } result.extra_ = extra_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000008; } result.memberId_ = memberId_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra other) { if (other == cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra.getDefaultInstance()) return this; if (other.hasGroupId()) { bitField0_ |= 0x00000001; groupId_ = other.groupId_; onChanged(); } if (!other.toLine_.isEmpty()) { if (toLine_.isEmpty()) { toLine_ = other.toLine_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureToLineIsMutable(); toLine_.addAll(other.toLine_); } onChanged(); } if (other.hasNotifyContent()) { mergeNotifyContent(other.getNotifyContent()); } if (other.hasExtra()) { bitField0_ |= 0x00000008; extra_ = other.extra_; onChanged(); } if (other.hasMemberId()) { bitField0_ |= 0x00000010; memberId_ = other.memberId_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasGroupId()) { return false; } if (hasNotifyContent()) { if (!getNotifyContent().isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ModifyGroupMemberExtra) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string group_id = 1; private java.lang.Object groupId_ = ""; /** * required string group_id = 1; */ public boolean hasGroupId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string group_id = 1; */ public java.lang.String getGroupId() { java.lang.Object ref = groupId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); groupId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string group_id = 1; */ public com.google.protobuf.ByteString getGroupIdBytes() { java.lang.Object ref = groupId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); groupId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string group_id = 1; */ public Builder setGroupId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } /** * required string group_id = 1; */ public Builder clearGroupId() { bitField0_ = (bitField0_ & ~0x00000001); groupId_ = getDefaultInstance().getGroupId(); onChanged(); return this; } /** * required string group_id = 1; */ public Builder setGroupIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; groupId_ = value; onChanged(); return this; } // repeated int32 to_line = 2; private java.util.List toLine_ = java.util.Collections.emptyList(); private void ensureToLineIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { toLine_ = new java.util.ArrayList(toLine_); bitField0_ |= 0x00000002; } } /** * repeated int32 to_line = 2; */ public java.util.List getToLineList() { return java.util.Collections.unmodifiableList(toLine_); } /** * repeated int32 to_line = 2; */ public int getToLineCount() { return toLine_.size(); } /** * repeated int32 to_line = 2; */ public int getToLine(int index) { return toLine_.get(index); } /** * repeated int32 to_line = 2; */ public Builder setToLine( int index, int value) { ensureToLineIsMutable(); toLine_.set(index, value); onChanged(); return this; } /** * repeated int32 to_line = 2; */ public Builder addToLine(int value) { ensureToLineIsMutable(); toLine_.add(value); onChanged(); return this; } /** * repeated int32 to_line = 2; */ public Builder addAllToLine( java.lang.Iterable values) { ensureToLineIsMutable(); super.addAll(values, toLine_); onChanged(); return this; } /** * repeated int32 to_line = 2; */ public Builder clearToLine() { toLine_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } // optional .MessageContent notify_content = 3; private cn.wildfirechat.proto.WFCMessage.MessageContent notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> notifyContentBuilder_; /** * optional .MessageContent notify_content = 3; */ public boolean hasNotifyContent() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getNotifyContent() { if (notifyContentBuilder_ == null) { return notifyContent_; } else { return notifyContentBuilder_.getMessage(); } } /** * optional .MessageContent notify_content = 3; */ public Builder setNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } notifyContent_ = value; onChanged(); } else { notifyContentBuilder_.setMessage(value); } bitField0_ |= 0x00000004; return this; } /** * optional .MessageContent notify_content = 3; */ public Builder setNotifyContent( cn.wildfirechat.proto.WFCMessage.MessageContent.Builder builderForValue) { if (notifyContentBuilder_ == null) { notifyContent_ = builderForValue.build(); onChanged(); } else { notifyContentBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000004; return this; } /** * optional .MessageContent notify_content = 3; */ public Builder mergeNotifyContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (notifyContentBuilder_ == null) { if (((bitField0_ & 0x00000004) == 0x00000004) && notifyContent_ != cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder(notifyContent_).mergeFrom(value).buildPartial(); } else { notifyContent_ = value; } onChanged(); } else { notifyContentBuilder_.mergeFrom(value); } bitField0_ |= 0x00000004; return this; } /** * optional .MessageContent notify_content = 3; */ public Builder clearNotifyContent() { if (notifyContentBuilder_ == null) { notifyContent_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); onChanged(); } else { notifyContentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000004); return this; } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContent.Builder getNotifyContentBuilder() { bitField0_ |= 0x00000004; onChanged(); return getNotifyContentFieldBuilder().getBuilder(); } /** * optional .MessageContent notify_content = 3; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getNotifyContentOrBuilder() { if (notifyContentBuilder_ != null) { return notifyContentBuilder_.getMessageOrBuilder(); } else { return notifyContent_; } } /** * optional .MessageContent notify_content = 3; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> getNotifyContentFieldBuilder() { if (notifyContentBuilder_ == null) { notifyContentBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder>( notifyContent_, getParentForChildren(), isClean()); notifyContent_ = null; } return notifyContentBuilder_; } // optional string extra = 4; private java.lang.Object extra_ = ""; /** * optional string extra = 4; */ public boolean hasExtra() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string extra = 4; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 4; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 4; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; extra_ = value; onChanged(); return this; } /** * optional string extra = 4; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000008); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 4; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; extra_ = value; onChanged(); return this; } // optional string member_id = 5; private java.lang.Object memberId_ = ""; /** * optional string member_id = 5; */ public boolean hasMemberId() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string member_id = 5; */ public java.lang.String getMemberId() { java.lang.Object ref = memberId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); memberId_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string member_id = 5; */ public com.google.protobuf.ByteString getMemberIdBytes() { java.lang.Object ref = memberId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); memberId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string member_id = 5; */ public Builder setMemberId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; memberId_ = value; onChanged(); return this; } /** * optional string member_id = 5; */ public Builder clearMemberId() { bitField0_ = (bitField0_ & ~0x00000010); memberId_ = getDefaultInstance().getMemberId(); onChanged(); return this; } /** * optional string member_id = 5; */ public Builder setMemberIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; memberId_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:ModifyGroupMemberExtra) } static { defaultInstance = new ModifyGroupMemberExtra(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ModifyGroupMemberExtra) } public interface UserSettingEntryOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int32 scope = 1; /** * required int32 scope = 1; */ boolean hasScope(); /** * required int32 scope = 1; */ int getScope(); // required string key = 2; /** * required string key = 2; */ boolean hasKey(); /** * required string key = 2; */ java.lang.String getKey(); /** * required string key = 2; */ com.google.protobuf.ByteString getKeyBytes(); // required string value = 3; /** * required string value = 3; */ boolean hasValue(); /** * required string value = 3; */ java.lang.String getValue(); /** * required string value = 3; */ com.google.protobuf.ByteString getValueBytes(); // required int64 update_dt = 4; /** * required int64 update_dt = 4; */ boolean hasUpdateDt(); /** * required int64 update_dt = 4; */ long getUpdateDt(); } /** * Protobuf type {@code UserSettingEntry} */ public static final class UserSettingEntry extends com.google.protobuf.GeneratedMessage implements UserSettingEntryOrBuilder { // Use UserSettingEntry.newBuilder() to construct. private UserSettingEntry(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private UserSettingEntry(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final UserSettingEntry defaultInstance; public static UserSettingEntry getDefaultInstance() { return defaultInstance; } public UserSettingEntry getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private UserSettingEntry( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; scope_ = input.readInt32(); break; } case 18: { bitField0_ |= 0x00000002; key_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; value_ = input.readBytes(); break; } case 32: { bitField0_ |= 0x00000008; updateDt_ = input.readInt64(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserSettingEntry_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserSettingEntry_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.UserSettingEntry.class, cn.wildfirechat.proto.WFCMessage.UserSettingEntry.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public UserSettingEntry parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new UserSettingEntry(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int32 scope = 1; public static final int SCOPE_FIELD_NUMBER = 1; private int scope_; /** * required int32 scope = 1; */ public boolean hasScope() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 scope = 1; */ public int getScope() { return scope_; } // required string key = 2; public static final int KEY_FIELD_NUMBER = 2; private java.lang.Object key_; /** * required string key = 2; */ public boolean hasKey() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string key = 2; */ public java.lang.String getKey() { java.lang.Object ref = key_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { key_ = s; } return s; } } /** * required string key = 2; */ public com.google.protobuf.ByteString getKeyBytes() { java.lang.Object ref = key_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); key_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string value = 3; public static final int VALUE_FIELD_NUMBER = 3; private java.lang.Object value_; /** * required string value = 3; */ public boolean hasValue() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string value = 3; */ public java.lang.String getValue() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { value_ = s; } return s; } } /** * required string value = 3; */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int64 update_dt = 4; public static final int UPDATE_DT_FIELD_NUMBER = 4; private long updateDt_; /** * required int64 update_dt = 4; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * required int64 update_dt = 4; */ public long getUpdateDt() { return updateDt_; } private void initFields() { scope_ = 0; key_ = ""; value_ = ""; updateDt_ = 0L; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasScope()) { memoizedIsInitialized = 0; return false; } if (!hasKey()) { memoizedIsInitialized = 0; return false; } if (!hasValue()) { memoizedIsInitialized = 0; return false; } if (!hasUpdateDt()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, scope_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getKeyBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getValueBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeInt64(4, updateDt_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, scope_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getKeyBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getValueBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(4, updateDt_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.UserSettingEntry parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.UserSettingEntry parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UserSettingEntry parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.UserSettingEntry parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UserSettingEntry parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.UserSettingEntry parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UserSettingEntry parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.UserSettingEntry parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.UserSettingEntry parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.UserSettingEntry parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.UserSettingEntry prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code UserSettingEntry} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.UserSettingEntryOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserSettingEntry_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserSettingEntry_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.UserSettingEntry.class, cn.wildfirechat.proto.WFCMessage.UserSettingEntry.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.UserSettingEntry.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); scope_ = 0; bitField0_ = (bitField0_ & ~0x00000001); key_ = ""; bitField0_ = (bitField0_ & ~0x00000002); value_ = ""; bitField0_ = (bitField0_ & ~0x00000004); updateDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000008); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_UserSettingEntry_descriptor; } public cn.wildfirechat.proto.WFCMessage.UserSettingEntry getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.UserSettingEntry.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.UserSettingEntry build() { cn.wildfirechat.proto.WFCMessage.UserSettingEntry result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.UserSettingEntry buildPartial() { cn.wildfirechat.proto.WFCMessage.UserSettingEntry result = new cn.wildfirechat.proto.WFCMessage.UserSettingEntry(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.scope_ = scope_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.key_ = key_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.value_ = value_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.updateDt_ = updateDt_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.UserSettingEntry) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.UserSettingEntry)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.UserSettingEntry other) { if (other == cn.wildfirechat.proto.WFCMessage.UserSettingEntry.getDefaultInstance()) return this; if (other.hasScope()) { setScope(other.getScope()); } if (other.hasKey()) { bitField0_ |= 0x00000002; key_ = other.key_; onChanged(); } if (other.hasValue()) { bitField0_ |= 0x00000004; value_ = other.value_; onChanged(); } if (other.hasUpdateDt()) { setUpdateDt(other.getUpdateDt()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasScope()) { return false; } if (!hasKey()) { return false; } if (!hasValue()) { return false; } if (!hasUpdateDt()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.UserSettingEntry parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.UserSettingEntry) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int32 scope = 1; private int scope_ ; /** * required int32 scope = 1; */ public boolean hasScope() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 scope = 1; */ public int getScope() { return scope_; } /** * required int32 scope = 1; */ public Builder setScope(int value) { bitField0_ |= 0x00000001; scope_ = value; onChanged(); return this; } /** * required int32 scope = 1; */ public Builder clearScope() { bitField0_ = (bitField0_ & ~0x00000001); scope_ = 0; onChanged(); return this; } // required string key = 2; private java.lang.Object key_ = ""; /** * required string key = 2; */ public boolean hasKey() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string key = 2; */ public java.lang.String getKey() { java.lang.Object ref = key_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); key_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string key = 2; */ public com.google.protobuf.ByteString getKeyBytes() { java.lang.Object ref = key_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); key_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string key = 2; */ public Builder setKey( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; key_ = value; onChanged(); return this; } /** * required string key = 2; */ public Builder clearKey() { bitField0_ = (bitField0_ & ~0x00000002); key_ = getDefaultInstance().getKey(); onChanged(); return this; } /** * required string key = 2; */ public Builder setKeyBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; key_ = value; onChanged(); return this; } // required string value = 3; private java.lang.Object value_ = ""; /** * required string value = 3; */ public boolean hasValue() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string value = 3; */ public java.lang.String getValue() { java.lang.Object ref = value_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); value_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string value = 3; */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string value = 3; */ public Builder setValue( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; value_ = value; onChanged(); return this; } /** * required string value = 3; */ public Builder clearValue() { bitField0_ = (bitField0_ & ~0x00000004); value_ = getDefaultInstance().getValue(); onChanged(); return this; } /** * required string value = 3; */ public Builder setValueBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; value_ = value; onChanged(); return this; } // required int64 update_dt = 4; private long updateDt_ ; /** * required int64 update_dt = 4; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * required int64 update_dt = 4; */ public long getUpdateDt() { return updateDt_; } /** * required int64 update_dt = 4; */ public Builder setUpdateDt(long value) { bitField0_ |= 0x00000008; updateDt_ = value; onChanged(); return this; } /** * required int64 update_dt = 4; */ public Builder clearUpdateDt() { bitField0_ = (bitField0_ & ~0x00000008); updateDt_ = 0L; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:UserSettingEntry) } static { defaultInstance = new UserSettingEntry(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:UserSettingEntry) } public interface ModifyUserSettingReqOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int32 scope = 1; /** * required int32 scope = 1; */ boolean hasScope(); /** * required int32 scope = 1; */ int getScope(); // required string key = 2; /** * required string key = 2; */ boolean hasKey(); /** * required string key = 2; */ java.lang.String getKey(); /** * required string key = 2; */ com.google.protobuf.ByteString getKeyBytes(); // required string value = 3; /** * required string value = 3; */ boolean hasValue(); /** * required string value = 3; */ java.lang.String getValue(); /** * required string value = 3; */ com.google.protobuf.ByteString getValueBytes(); } /** * Protobuf type {@code ModifyUserSettingReq} */ public static final class ModifyUserSettingReq extends com.google.protobuf.GeneratedMessage implements ModifyUserSettingReqOrBuilder { // Use ModifyUserSettingReq.newBuilder() to construct. private ModifyUserSettingReq(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ModifyUserSettingReq(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ModifyUserSettingReq defaultInstance; public static ModifyUserSettingReq getDefaultInstance() { return defaultInstance; } public ModifyUserSettingReq getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ModifyUserSettingReq( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; scope_ = input.readInt32(); break; } case 18: { bitField0_ |= 0x00000002; key_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; value_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyUserSettingReq_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyUserSettingReq_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq.class, cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ModifyUserSettingReq parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ModifyUserSettingReq(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int32 scope = 1; public static final int SCOPE_FIELD_NUMBER = 1; private int scope_; /** * required int32 scope = 1; */ public boolean hasScope() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 scope = 1; */ public int getScope() { return scope_; } // required string key = 2; public static final int KEY_FIELD_NUMBER = 2; private java.lang.Object key_; /** * required string key = 2; */ public boolean hasKey() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string key = 2; */ public java.lang.String getKey() { java.lang.Object ref = key_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { key_ = s; } return s; } } /** * required string key = 2; */ public com.google.protobuf.ByteString getKeyBytes() { java.lang.Object ref = key_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); key_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string value = 3; public static final int VALUE_FIELD_NUMBER = 3; private java.lang.Object value_; /** * required string value = 3; */ public boolean hasValue() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string value = 3; */ public java.lang.String getValue() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { value_ = s; } return s; } } /** * required string value = 3; */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { scope_ = 0; key_ = ""; value_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasScope()) { memoizedIsInitialized = 0; return false; } if (!hasKey()) { memoizedIsInitialized = 0; return false; } if (!hasValue()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, scope_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getKeyBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getValueBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, scope_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getKeyBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getValueBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ModifyUserSettingReq} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReqOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyUserSettingReq_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyUserSettingReq_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq.class, cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); scope_ = 0; bitField0_ = (bitField0_ & ~0x00000001); key_ = ""; bitField0_ = (bitField0_ & ~0x00000002); value_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ModifyUserSettingReq_descriptor; } public cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq build() { cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq buildPartial() { cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq result = new cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.scope_ = scope_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.key_ = key_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.value_ = value_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq other) { if (other == cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq.getDefaultInstance()) return this; if (other.hasScope()) { setScope(other.getScope()); } if (other.hasKey()) { bitField0_ |= 0x00000002; key_ = other.key_; onChanged(); } if (other.hasValue()) { bitField0_ |= 0x00000004; value_ = other.value_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasScope()) { return false; } if (!hasKey()) { return false; } if (!hasValue()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ModifyUserSettingReq) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int32 scope = 1; private int scope_ ; /** * required int32 scope = 1; */ public boolean hasScope() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int32 scope = 1; */ public int getScope() { return scope_; } /** * required int32 scope = 1; */ public Builder setScope(int value) { bitField0_ |= 0x00000001; scope_ = value; onChanged(); return this; } /** * required int32 scope = 1; */ public Builder clearScope() { bitField0_ = (bitField0_ & ~0x00000001); scope_ = 0; onChanged(); return this; } // required string key = 2; private java.lang.Object key_ = ""; /** * required string key = 2; */ public boolean hasKey() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string key = 2; */ public java.lang.String getKey() { java.lang.Object ref = key_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); key_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string key = 2; */ public com.google.protobuf.ByteString getKeyBytes() { java.lang.Object ref = key_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); key_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string key = 2; */ public Builder setKey( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; key_ = value; onChanged(); return this; } /** * required string key = 2; */ public Builder clearKey() { bitField0_ = (bitField0_ & ~0x00000002); key_ = getDefaultInstance().getKey(); onChanged(); return this; } /** * required string key = 2; */ public Builder setKeyBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; key_ = value; onChanged(); return this; } // required string value = 3; private java.lang.Object value_ = ""; /** * required string value = 3; */ public boolean hasValue() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string value = 3; */ public java.lang.String getValue() { java.lang.Object ref = value_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); value_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string value = 3; */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string value = 3; */ public Builder setValue( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; value_ = value; onChanged(); return this; } /** * required string value = 3; */ public Builder clearValue() { bitField0_ = (bitField0_ & ~0x00000004); value_ = getDefaultInstance().getValue(); onChanged(); return this; } /** * required string value = 3; */ public Builder setValueBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; value_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:ModifyUserSettingReq) } static { defaultInstance = new ModifyUserSettingReq(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ModifyUserSettingReq) } public interface VersionOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int64 version = 1; /** * required int64 version = 1; */ boolean hasVersion(); /** * required int64 version = 1; */ long getVersion(); } /** * Protobuf type {@code Version} */ public static final class Version extends com.google.protobuf.GeneratedMessage implements VersionOrBuilder { // Use Version.newBuilder() to construct. private Version(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private Version(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final Version defaultInstance; public static Version getDefaultInstance() { return defaultInstance; } public Version getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Version( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; version_ = input.readInt64(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_Version_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_Version_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.Version.class, cn.wildfirechat.proto.WFCMessage.Version.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public Version parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Version(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int64 version = 1; public static final int VERSION_FIELD_NUMBER = 1; private long version_; /** * required int64 version = 1; */ public boolean hasVersion() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int64 version = 1; */ public long getVersion() { return version_; } private void initFields() { version_ = 0L; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasVersion()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt64(1, version_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(1, version_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.Version parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.Version parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Version parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.Version parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Version parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Version parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Version parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Version parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Version parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Version parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.Version prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code Version} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.VersionOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_Version_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_Version_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.Version.class, cn.wildfirechat.proto.WFCMessage.Version.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.Version.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); version_ = 0L; bitField0_ = (bitField0_ & ~0x00000001); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_Version_descriptor; } public cn.wildfirechat.proto.WFCMessage.Version getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.Version.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.Version build() { cn.wildfirechat.proto.WFCMessage.Version result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.Version buildPartial() { cn.wildfirechat.proto.WFCMessage.Version result = new cn.wildfirechat.proto.WFCMessage.Version(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.version_ = version_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.Version) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.Version)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.Version other) { if (other == cn.wildfirechat.proto.WFCMessage.Version.getDefaultInstance()) return this; if (other.hasVersion()) { setVersion(other.getVersion()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasVersion()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.Version parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.Version) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int64 version = 1; private long version_ ; /** * required int64 version = 1; */ public boolean hasVersion() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int64 version = 1; */ public long getVersion() { return version_; } /** * required int64 version = 1; */ public Builder setVersion(long value) { bitField0_ |= 0x00000001; version_ = value; onChanged(); return this; } /** * required int64 version = 1; */ public Builder clearVersion() { bitField0_ = (bitField0_ & ~0x00000001); version_ = 0L; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:Version) } static { defaultInstance = new Version(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:Version) } public interface GetUserSettingResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .UserSettingEntry entry = 1; /** * repeated .UserSettingEntry entry = 1; */ java.util.List getEntryList(); /** * repeated .UserSettingEntry entry = 1; */ cn.wildfirechat.proto.WFCMessage.UserSettingEntry getEntry(int index); /** * repeated .UserSettingEntry entry = 1; */ int getEntryCount(); /** * repeated .UserSettingEntry entry = 1; */ java.util.List getEntryOrBuilderList(); /** * repeated .UserSettingEntry entry = 1; */ cn.wildfirechat.proto.WFCMessage.UserSettingEntryOrBuilder getEntryOrBuilder( int index); } /** * Protobuf type {@code GetUserSettingResult} */ public static final class GetUserSettingResult extends com.google.protobuf.GeneratedMessage implements GetUserSettingResultOrBuilder { // Use GetUserSettingResult.newBuilder() to construct. private GetUserSettingResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private GetUserSettingResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final GetUserSettingResult defaultInstance; public static GetUserSettingResult getDefaultInstance() { return defaultInstance; } public GetUserSettingResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GetUserSettingResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { entry_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } entry_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.UserSettingEntry.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { entry_ = java.util.Collections.unmodifiableList(entry_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUserSettingResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUserSettingResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetUserSettingResult.class, cn.wildfirechat.proto.WFCMessage.GetUserSettingResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public GetUserSettingResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GetUserSettingResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } // repeated .UserSettingEntry entry = 1; public static final int ENTRY_FIELD_NUMBER = 1; private java.util.List entry_; /** * repeated .UserSettingEntry entry = 1; */ public java.util.List getEntryList() { return entry_; } /** * repeated .UserSettingEntry entry = 1; */ public java.util.List getEntryOrBuilderList() { return entry_; } /** * repeated .UserSettingEntry entry = 1; */ public int getEntryCount() { return entry_.size(); } /** * repeated .UserSettingEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.UserSettingEntry getEntry(int index) { return entry_.get(index); } /** * repeated .UserSettingEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.UserSettingEntryOrBuilder getEntryOrBuilder( int index) { return entry_.get(index); } private void initFields() { entry_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getEntryCount(); i++) { if (!getEntry(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < entry_.size(); i++) { output.writeMessage(1, entry_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < entry_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, entry_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.GetUserSettingResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetUserSettingResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetUserSettingResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetUserSettingResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetUserSettingResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetUserSettingResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetUserSettingResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetUserSettingResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetUserSettingResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetUserSettingResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.GetUserSettingResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code GetUserSettingResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GetUserSettingResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUserSettingResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUserSettingResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetUserSettingResult.class, cn.wildfirechat.proto.WFCMessage.GetUserSettingResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.GetUserSettingResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getEntryFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (entryBuilder_ == null) { entry_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { entryBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetUserSettingResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.GetUserSettingResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.GetUserSettingResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.GetUserSettingResult build() { cn.wildfirechat.proto.WFCMessage.GetUserSettingResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.GetUserSettingResult buildPartial() { cn.wildfirechat.proto.WFCMessage.GetUserSettingResult result = new cn.wildfirechat.proto.WFCMessage.GetUserSettingResult(this); int from_bitField0_ = bitField0_; if (entryBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { entry_ = java.util.Collections.unmodifiableList(entry_); bitField0_ = (bitField0_ & ~0x00000001); } result.entry_ = entry_; } else { result.entry_ = entryBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.GetUserSettingResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.GetUserSettingResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.GetUserSettingResult other) { if (other == cn.wildfirechat.proto.WFCMessage.GetUserSettingResult.getDefaultInstance()) return this; if (entryBuilder_ == null) { if (!other.entry_.isEmpty()) { if (entry_.isEmpty()) { entry_ = other.entry_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureEntryIsMutable(); entry_.addAll(other.entry_); } onChanged(); } } else { if (!other.entry_.isEmpty()) { if (entryBuilder_.isEmpty()) { entryBuilder_.dispose(); entryBuilder_ = null; entry_ = other.entry_; bitField0_ = (bitField0_ & ~0x00000001); entryBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getEntryFieldBuilder() : null; } else { entryBuilder_.addAllMessages(other.entry_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { for (int i = 0; i < getEntryCount(); i++) { if (!getEntry(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.GetUserSettingResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.GetUserSettingResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .UserSettingEntry entry = 1; private java.util.List entry_ = java.util.Collections.emptyList(); private void ensureEntryIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { entry_ = new java.util.ArrayList(entry_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.UserSettingEntry, cn.wildfirechat.proto.WFCMessage.UserSettingEntry.Builder, cn.wildfirechat.proto.WFCMessage.UserSettingEntryOrBuilder> entryBuilder_; /** * repeated .UserSettingEntry entry = 1; */ public java.util.List getEntryList() { if (entryBuilder_ == null) { return java.util.Collections.unmodifiableList(entry_); } else { return entryBuilder_.getMessageList(); } } /** * repeated .UserSettingEntry entry = 1; */ public int getEntryCount() { if (entryBuilder_ == null) { return entry_.size(); } else { return entryBuilder_.getCount(); } } /** * repeated .UserSettingEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.UserSettingEntry getEntry(int index) { if (entryBuilder_ == null) { return entry_.get(index); } else { return entryBuilder_.getMessage(index); } } /** * repeated .UserSettingEntry entry = 1; */ public Builder setEntry( int index, cn.wildfirechat.proto.WFCMessage.UserSettingEntry value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.set(index, value); onChanged(); } else { entryBuilder_.setMessage(index, value); } return this; } /** * repeated .UserSettingEntry entry = 1; */ public Builder setEntry( int index, cn.wildfirechat.proto.WFCMessage.UserSettingEntry.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.set(index, builderForValue.build()); onChanged(); } else { entryBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .UserSettingEntry entry = 1; */ public Builder addEntry(cn.wildfirechat.proto.WFCMessage.UserSettingEntry value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.add(value); onChanged(); } else { entryBuilder_.addMessage(value); } return this; } /** * repeated .UserSettingEntry entry = 1; */ public Builder addEntry( int index, cn.wildfirechat.proto.WFCMessage.UserSettingEntry value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.add(index, value); onChanged(); } else { entryBuilder_.addMessage(index, value); } return this; } /** * repeated .UserSettingEntry entry = 1; */ public Builder addEntry( cn.wildfirechat.proto.WFCMessage.UserSettingEntry.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.add(builderForValue.build()); onChanged(); } else { entryBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .UserSettingEntry entry = 1; */ public Builder addEntry( int index, cn.wildfirechat.proto.WFCMessage.UserSettingEntry.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.add(index, builderForValue.build()); onChanged(); } else { entryBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .UserSettingEntry entry = 1; */ public Builder addAllEntry( java.lang.Iterable values) { if (entryBuilder_ == null) { ensureEntryIsMutable(); super.addAll(values, entry_); onChanged(); } else { entryBuilder_.addAllMessages(values); } return this; } /** * repeated .UserSettingEntry entry = 1; */ public Builder clearEntry() { if (entryBuilder_ == null) { entry_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { entryBuilder_.clear(); } return this; } /** * repeated .UserSettingEntry entry = 1; */ public Builder removeEntry(int index) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.remove(index); onChanged(); } else { entryBuilder_.remove(index); } return this; } /** * repeated .UserSettingEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.UserSettingEntry.Builder getEntryBuilder( int index) { return getEntryFieldBuilder().getBuilder(index); } /** * repeated .UserSettingEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.UserSettingEntryOrBuilder getEntryOrBuilder( int index) { if (entryBuilder_ == null) { return entry_.get(index); } else { return entryBuilder_.getMessageOrBuilder(index); } } /** * repeated .UserSettingEntry entry = 1; */ public java.util.List getEntryOrBuilderList() { if (entryBuilder_ != null) { return entryBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(entry_); } } /** * repeated .UserSettingEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.UserSettingEntry.Builder addEntryBuilder() { return getEntryFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.UserSettingEntry.getDefaultInstance()); } /** * repeated .UserSettingEntry entry = 1; */ public cn.wildfirechat.proto.WFCMessage.UserSettingEntry.Builder addEntryBuilder( int index) { return getEntryFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.UserSettingEntry.getDefaultInstance()); } /** * repeated .UserSettingEntry entry = 1; */ public java.util.List getEntryBuilderList() { return getEntryFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.UserSettingEntry, cn.wildfirechat.proto.WFCMessage.UserSettingEntry.Builder, cn.wildfirechat.proto.WFCMessage.UserSettingEntryOrBuilder> getEntryFieldBuilder() { if (entryBuilder_ == null) { entryBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.UserSettingEntry, cn.wildfirechat.proto.WFCMessage.UserSettingEntry.Builder, cn.wildfirechat.proto.WFCMessage.UserSettingEntryOrBuilder>( entry_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); entry_ = null; } return entryBuilder_; } // @@protoc_insertion_point(builder_scope:GetUserSettingResult) } static { defaultInstance = new GetUserSettingResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:GetUserSettingResult) } public interface FriendOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string uid = 1; /** * required string uid = 1; */ boolean hasUid(); /** * required string uid = 1; */ java.lang.String getUid(); /** * required string uid = 1; */ com.google.protobuf.ByteString getUidBytes(); // required int32 state = 2; /** * required int32 state = 2; */ boolean hasState(); /** * required int32 state = 2; */ int getState(); // required int64 update_dt = 3; /** * required int64 update_dt = 3; */ boolean hasUpdateDt(); /** * required int64 update_dt = 3; */ long getUpdateDt(); // optional string alias = 4; /** * optional string alias = 4; */ boolean hasAlias(); /** * optional string alias = 4; */ java.lang.String getAlias(); /** * optional string alias = 4; */ com.google.protobuf.ByteString getAliasBytes(); // optional int32 blacked = 5; /** * optional int32 blacked = 5; */ boolean hasBlacked(); /** * optional int32 blacked = 5; */ int getBlacked(); // optional string extra = 6; /** * optional string extra = 6; */ boolean hasExtra(); /** * optional string extra = 6; */ java.lang.String getExtra(); /** * optional string extra = 6; */ com.google.protobuf.ByteString getExtraBytes(); } /** * Protobuf type {@code Friend} */ public static final class Friend extends com.google.protobuf.GeneratedMessage implements FriendOrBuilder { // Use Friend.newBuilder() to construct. private Friend(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private Friend(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final Friend defaultInstance; public static Friend getDefaultInstance() { return defaultInstance; } public Friend getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private Friend( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; uid_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; state_ = input.readInt32(); break; } case 24: { bitField0_ |= 0x00000004; updateDt_ = input.readInt64(); break; } case 34: { bitField0_ |= 0x00000008; alias_ = input.readBytes(); break; } case 40: { bitField0_ |= 0x00000010; blacked_ = input.readInt32(); break; } case 50: { bitField0_ |= 0x00000020; extra_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_Friend_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_Friend_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.Friend.class, cn.wildfirechat.proto.WFCMessage.Friend.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public Friend parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new Friend(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string uid = 1; public static final int UID_FIELD_NUMBER = 1; private java.lang.Object uid_; /** * required string uid = 1; */ public boolean hasUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string uid = 1; */ public java.lang.String getUid() { java.lang.Object ref = uid_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { uid_ = s; } return s; } } /** * required string uid = 1; */ public com.google.protobuf.ByteString getUidBytes() { java.lang.Object ref = uid_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); uid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 state = 2; public static final int STATE_FIELD_NUMBER = 2; private int state_; /** * required int32 state = 2; */ public boolean hasState() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 state = 2; */ public int getState() { return state_; } // required int64 update_dt = 3; public static final int UPDATE_DT_FIELD_NUMBER = 3; private long updateDt_; /** * required int64 update_dt = 3; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int64 update_dt = 3; */ public long getUpdateDt() { return updateDt_; } // optional string alias = 4; public static final int ALIAS_FIELD_NUMBER = 4; private java.lang.Object alias_; /** * optional string alias = 4; */ public boolean hasAlias() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string alias = 4; */ public java.lang.String getAlias() { java.lang.Object ref = alias_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { alias_ = s; } return s; } } /** * optional string alias = 4; */ public com.google.protobuf.ByteString getAliasBytes() { java.lang.Object ref = alias_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); alias_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 blacked = 5; public static final int BLACKED_FIELD_NUMBER = 5; private int blacked_; /** * optional int32 blacked = 5; */ public boolean hasBlacked() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int32 blacked = 5; */ public int getBlacked() { return blacked_; } // optional string extra = 6; public static final int EXTRA_FIELD_NUMBER = 6; private java.lang.Object extra_; /** * optional string extra = 6; */ public boolean hasExtra() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string extra = 6; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 6; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { uid_ = ""; state_ = 0; updateDt_ = 0L; alias_ = ""; blacked_ = 0; extra_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasUid()) { memoizedIsInitialized = 0; return false; } if (!hasState()) { memoizedIsInitialized = 0; return false; } if (!hasUpdateDt()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, state_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt64(3, updateDt_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getAliasBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeInt32(5, blacked_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, getExtraBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, state_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(3, updateDt_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getAliasBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(5, blacked_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(6, getExtraBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.Friend parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.Friend parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Friend parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.Friend parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Friend parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Friend parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Friend parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Friend parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.Friend parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.Friend parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.Friend prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code Friend} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.FriendOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_Friend_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_Friend_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.Friend.class, cn.wildfirechat.proto.WFCMessage.Friend.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.Friend.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); uid_ = ""; bitField0_ = (bitField0_ & ~0x00000001); state_ = 0; bitField0_ = (bitField0_ & ~0x00000002); updateDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000004); alias_ = ""; bitField0_ = (bitField0_ & ~0x00000008); blacked_ = 0; bitField0_ = (bitField0_ & ~0x00000010); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000020); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_Friend_descriptor; } public cn.wildfirechat.proto.WFCMessage.Friend getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.Friend.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.Friend build() { cn.wildfirechat.proto.WFCMessage.Friend result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.Friend buildPartial() { cn.wildfirechat.proto.WFCMessage.Friend result = new cn.wildfirechat.proto.WFCMessage.Friend(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.uid_ = uid_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.state_ = state_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.updateDt_ = updateDt_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.alias_ = alias_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.blacked_ = blacked_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.extra_ = extra_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.Friend) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.Friend)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.Friend other) { if (other == cn.wildfirechat.proto.WFCMessage.Friend.getDefaultInstance()) return this; if (other.hasUid()) { bitField0_ |= 0x00000001; uid_ = other.uid_; onChanged(); } if (other.hasState()) { setState(other.getState()); } if (other.hasUpdateDt()) { setUpdateDt(other.getUpdateDt()); } if (other.hasAlias()) { bitField0_ |= 0x00000008; alias_ = other.alias_; onChanged(); } if (other.hasBlacked()) { setBlacked(other.getBlacked()); } if (other.hasExtra()) { bitField0_ |= 0x00000020; extra_ = other.extra_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasUid()) { return false; } if (!hasState()) { return false; } if (!hasUpdateDt()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.Friend parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.Friend) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string uid = 1; private java.lang.Object uid_ = ""; /** * required string uid = 1; */ public boolean hasUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string uid = 1; */ public java.lang.String getUid() { java.lang.Object ref = uid_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); uid_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string uid = 1; */ public com.google.protobuf.ByteString getUidBytes() { java.lang.Object ref = uid_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); uid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string uid = 1; */ public Builder setUid( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; uid_ = value; onChanged(); return this; } /** * required string uid = 1; */ public Builder clearUid() { bitField0_ = (bitField0_ & ~0x00000001); uid_ = getDefaultInstance().getUid(); onChanged(); return this; } /** * required string uid = 1; */ public Builder setUidBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; uid_ = value; onChanged(); return this; } // required int32 state = 2; private int state_ ; /** * required int32 state = 2; */ public boolean hasState() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 state = 2; */ public int getState() { return state_; } /** * required int32 state = 2; */ public Builder setState(int value) { bitField0_ |= 0x00000002; state_ = value; onChanged(); return this; } /** * required int32 state = 2; */ public Builder clearState() { bitField0_ = (bitField0_ & ~0x00000002); state_ = 0; onChanged(); return this; } // required int64 update_dt = 3; private long updateDt_ ; /** * required int64 update_dt = 3; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int64 update_dt = 3; */ public long getUpdateDt() { return updateDt_; } /** * required int64 update_dt = 3; */ public Builder setUpdateDt(long value) { bitField0_ |= 0x00000004; updateDt_ = value; onChanged(); return this; } /** * required int64 update_dt = 3; */ public Builder clearUpdateDt() { bitField0_ = (bitField0_ & ~0x00000004); updateDt_ = 0L; onChanged(); return this; } // optional string alias = 4; private java.lang.Object alias_ = ""; /** * optional string alias = 4; */ public boolean hasAlias() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string alias = 4; */ public java.lang.String getAlias() { java.lang.Object ref = alias_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); alias_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string alias = 4; */ public com.google.protobuf.ByteString getAliasBytes() { java.lang.Object ref = alias_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); alias_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string alias = 4; */ public Builder setAlias( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; alias_ = value; onChanged(); return this; } /** * optional string alias = 4; */ public Builder clearAlias() { bitField0_ = (bitField0_ & ~0x00000008); alias_ = getDefaultInstance().getAlias(); onChanged(); return this; } /** * optional string alias = 4; */ public Builder setAliasBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; alias_ = value; onChanged(); return this; } // optional int32 blacked = 5; private int blacked_ ; /** * optional int32 blacked = 5; */ public boolean hasBlacked() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int32 blacked = 5; */ public int getBlacked() { return blacked_; } /** * optional int32 blacked = 5; */ public Builder setBlacked(int value) { bitField0_ |= 0x00000010; blacked_ = value; onChanged(); return this; } /** * optional int32 blacked = 5; */ public Builder clearBlacked() { bitField0_ = (bitField0_ & ~0x00000010); blacked_ = 0; onChanged(); return this; } // optional string extra = 6; private java.lang.Object extra_ = ""; /** * optional string extra = 6; */ public boolean hasExtra() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string extra = 6; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 6; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 6; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; extra_ = value; onChanged(); return this; } /** * optional string extra = 6; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000020); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 6; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; extra_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:Friend) } static { defaultInstance = new Friend(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:Friend) } public interface GetFriendsResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .Friend entry = 1; /** * repeated .Friend entry = 1; */ java.util.List getEntryList(); /** * repeated .Friend entry = 1; */ cn.wildfirechat.proto.WFCMessage.Friend getEntry(int index); /** * repeated .Friend entry = 1; */ int getEntryCount(); /** * repeated .Friend entry = 1; */ java.util.List getEntryOrBuilderList(); /** * repeated .Friend entry = 1; */ cn.wildfirechat.proto.WFCMessage.FriendOrBuilder getEntryOrBuilder( int index); } /** * Protobuf type {@code GetFriendsResult} */ public static final class GetFriendsResult extends com.google.protobuf.GeneratedMessage implements GetFriendsResultOrBuilder { // Use GetFriendsResult.newBuilder() to construct. private GetFriendsResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private GetFriendsResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final GetFriendsResult defaultInstance; public static GetFriendsResult getDefaultInstance() { return defaultInstance; } public GetFriendsResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GetFriendsResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { entry_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } entry_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.Friend.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { entry_ = java.util.Collections.unmodifiableList(entry_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetFriendsResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetFriendsResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetFriendsResult.class, cn.wildfirechat.proto.WFCMessage.GetFriendsResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public GetFriendsResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GetFriendsResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } // repeated .Friend entry = 1; public static final int ENTRY_FIELD_NUMBER = 1; private java.util.List entry_; /** * repeated .Friend entry = 1; */ public java.util.List getEntryList() { return entry_; } /** * repeated .Friend entry = 1; */ public java.util.List getEntryOrBuilderList() { return entry_; } /** * repeated .Friend entry = 1; */ public int getEntryCount() { return entry_.size(); } /** * repeated .Friend entry = 1; */ public cn.wildfirechat.proto.WFCMessage.Friend getEntry(int index) { return entry_.get(index); } /** * repeated .Friend entry = 1; */ public cn.wildfirechat.proto.WFCMessage.FriendOrBuilder getEntryOrBuilder( int index) { return entry_.get(index); } private void initFields() { entry_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getEntryCount(); i++) { if (!getEntry(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < entry_.size(); i++) { output.writeMessage(1, entry_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < entry_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, entry_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.GetFriendsResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetFriendsResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetFriendsResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetFriendsResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetFriendsResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetFriendsResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetFriendsResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetFriendsResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetFriendsResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetFriendsResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.GetFriendsResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code GetFriendsResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GetFriendsResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetFriendsResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetFriendsResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetFriendsResult.class, cn.wildfirechat.proto.WFCMessage.GetFriendsResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.GetFriendsResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getEntryFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (entryBuilder_ == null) { entry_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { entryBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetFriendsResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.GetFriendsResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.GetFriendsResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.GetFriendsResult build() { cn.wildfirechat.proto.WFCMessage.GetFriendsResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.GetFriendsResult buildPartial() { cn.wildfirechat.proto.WFCMessage.GetFriendsResult result = new cn.wildfirechat.proto.WFCMessage.GetFriendsResult(this); int from_bitField0_ = bitField0_; if (entryBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { entry_ = java.util.Collections.unmodifiableList(entry_); bitField0_ = (bitField0_ & ~0x00000001); } result.entry_ = entry_; } else { result.entry_ = entryBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.GetFriendsResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.GetFriendsResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.GetFriendsResult other) { if (other == cn.wildfirechat.proto.WFCMessage.GetFriendsResult.getDefaultInstance()) return this; if (entryBuilder_ == null) { if (!other.entry_.isEmpty()) { if (entry_.isEmpty()) { entry_ = other.entry_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureEntryIsMutable(); entry_.addAll(other.entry_); } onChanged(); } } else { if (!other.entry_.isEmpty()) { if (entryBuilder_.isEmpty()) { entryBuilder_.dispose(); entryBuilder_ = null; entry_ = other.entry_; bitField0_ = (bitField0_ & ~0x00000001); entryBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getEntryFieldBuilder() : null; } else { entryBuilder_.addAllMessages(other.entry_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { for (int i = 0; i < getEntryCount(); i++) { if (!getEntry(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.GetFriendsResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.GetFriendsResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .Friend entry = 1; private java.util.List entry_ = java.util.Collections.emptyList(); private void ensureEntryIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { entry_ = new java.util.ArrayList(entry_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.Friend, cn.wildfirechat.proto.WFCMessage.Friend.Builder, cn.wildfirechat.proto.WFCMessage.FriendOrBuilder> entryBuilder_; /** * repeated .Friend entry = 1; */ public java.util.List getEntryList() { if (entryBuilder_ == null) { return java.util.Collections.unmodifiableList(entry_); } else { return entryBuilder_.getMessageList(); } } /** * repeated .Friend entry = 1; */ public int getEntryCount() { if (entryBuilder_ == null) { return entry_.size(); } else { return entryBuilder_.getCount(); } } /** * repeated .Friend entry = 1; */ public cn.wildfirechat.proto.WFCMessage.Friend getEntry(int index) { if (entryBuilder_ == null) { return entry_.get(index); } else { return entryBuilder_.getMessage(index); } } /** * repeated .Friend entry = 1; */ public Builder setEntry( int index, cn.wildfirechat.proto.WFCMessage.Friend value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.set(index, value); onChanged(); } else { entryBuilder_.setMessage(index, value); } return this; } /** * repeated .Friend entry = 1; */ public Builder setEntry( int index, cn.wildfirechat.proto.WFCMessage.Friend.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.set(index, builderForValue.build()); onChanged(); } else { entryBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .Friend entry = 1; */ public Builder addEntry(cn.wildfirechat.proto.WFCMessage.Friend value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.add(value); onChanged(); } else { entryBuilder_.addMessage(value); } return this; } /** * repeated .Friend entry = 1; */ public Builder addEntry( int index, cn.wildfirechat.proto.WFCMessage.Friend value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.add(index, value); onChanged(); } else { entryBuilder_.addMessage(index, value); } return this; } /** * repeated .Friend entry = 1; */ public Builder addEntry( cn.wildfirechat.proto.WFCMessage.Friend.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.add(builderForValue.build()); onChanged(); } else { entryBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .Friend entry = 1; */ public Builder addEntry( int index, cn.wildfirechat.proto.WFCMessage.Friend.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.add(index, builderForValue.build()); onChanged(); } else { entryBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .Friend entry = 1; */ public Builder addAllEntry( java.lang.Iterable values) { if (entryBuilder_ == null) { ensureEntryIsMutable(); super.addAll(values, entry_); onChanged(); } else { entryBuilder_.addAllMessages(values); } return this; } /** * repeated .Friend entry = 1; */ public Builder clearEntry() { if (entryBuilder_ == null) { entry_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { entryBuilder_.clear(); } return this; } /** * repeated .Friend entry = 1; */ public Builder removeEntry(int index) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.remove(index); onChanged(); } else { entryBuilder_.remove(index); } return this; } /** * repeated .Friend entry = 1; */ public cn.wildfirechat.proto.WFCMessage.Friend.Builder getEntryBuilder( int index) { return getEntryFieldBuilder().getBuilder(index); } /** * repeated .Friend entry = 1; */ public cn.wildfirechat.proto.WFCMessage.FriendOrBuilder getEntryOrBuilder( int index) { if (entryBuilder_ == null) { return entry_.get(index); } else { return entryBuilder_.getMessageOrBuilder(index); } } /** * repeated .Friend entry = 1; */ public java.util.List getEntryOrBuilderList() { if (entryBuilder_ != null) { return entryBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(entry_); } } /** * repeated .Friend entry = 1; */ public cn.wildfirechat.proto.WFCMessage.Friend.Builder addEntryBuilder() { return getEntryFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.Friend.getDefaultInstance()); } /** * repeated .Friend entry = 1; */ public cn.wildfirechat.proto.WFCMessage.Friend.Builder addEntryBuilder( int index) { return getEntryFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.Friend.getDefaultInstance()); } /** * repeated .Friend entry = 1; */ public java.util.List getEntryBuilderList() { return getEntryFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.Friend, cn.wildfirechat.proto.WFCMessage.Friend.Builder, cn.wildfirechat.proto.WFCMessage.FriendOrBuilder> getEntryFieldBuilder() { if (entryBuilder_ == null) { entryBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.Friend, cn.wildfirechat.proto.WFCMessage.Friend.Builder, cn.wildfirechat.proto.WFCMessage.FriendOrBuilder>( entry_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); entry_ = null; } return entryBuilder_; } // @@protoc_insertion_point(builder_scope:GetFriendsResult) } static { defaultInstance = new GetFriendsResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:GetFriendsResult) } public interface GetFriendRequestResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .FriendRequest entry = 1; /** * repeated .FriendRequest entry = 1; */ java.util.List getEntryList(); /** * repeated .FriendRequest entry = 1; */ cn.wildfirechat.proto.WFCMessage.FriendRequest getEntry(int index); /** * repeated .FriendRequest entry = 1; */ int getEntryCount(); /** * repeated .FriendRequest entry = 1; */ java.util.List getEntryOrBuilderList(); /** * repeated .FriendRequest entry = 1; */ cn.wildfirechat.proto.WFCMessage.FriendRequestOrBuilder getEntryOrBuilder( int index); } /** * Protobuf type {@code GetFriendRequestResult} */ public static final class GetFriendRequestResult extends com.google.protobuf.GeneratedMessage implements GetFriendRequestResultOrBuilder { // Use GetFriendRequestResult.newBuilder() to construct. private GetFriendRequestResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private GetFriendRequestResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final GetFriendRequestResult defaultInstance; public static GetFriendRequestResult getDefaultInstance() { return defaultInstance; } public GetFriendRequestResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GetFriendRequestResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { entry_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } entry_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.FriendRequest.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { entry_ = java.util.Collections.unmodifiableList(entry_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetFriendRequestResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetFriendRequestResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult.class, cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public GetFriendRequestResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GetFriendRequestResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } // repeated .FriendRequest entry = 1; public static final int ENTRY_FIELD_NUMBER = 1; private java.util.List entry_; /** * repeated .FriendRequest entry = 1; */ public java.util.List getEntryList() { return entry_; } /** * repeated .FriendRequest entry = 1; */ public java.util.List getEntryOrBuilderList() { return entry_; } /** * repeated .FriendRequest entry = 1; */ public int getEntryCount() { return entry_.size(); } /** * repeated .FriendRequest entry = 1; */ public cn.wildfirechat.proto.WFCMessage.FriendRequest getEntry(int index) { return entry_.get(index); } /** * repeated .FriendRequest entry = 1; */ public cn.wildfirechat.proto.WFCMessage.FriendRequestOrBuilder getEntryOrBuilder( int index) { return entry_.get(index); } private void initFields() { entry_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getEntryCount(); i++) { if (!getEntry(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < entry_.size(); i++) { output.writeMessage(1, entry_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < entry_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, entry_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code GetFriendRequestResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GetFriendRequestResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetFriendRequestResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetFriendRequestResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult.class, cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getEntryFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (entryBuilder_ == null) { entry_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { entryBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetFriendRequestResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult build() { cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult buildPartial() { cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult result = new cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult(this); int from_bitField0_ = bitField0_; if (entryBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { entry_ = java.util.Collections.unmodifiableList(entry_); bitField0_ = (bitField0_ & ~0x00000001); } result.entry_ = entry_; } else { result.entry_ = entryBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult other) { if (other == cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult.getDefaultInstance()) return this; if (entryBuilder_ == null) { if (!other.entry_.isEmpty()) { if (entry_.isEmpty()) { entry_ = other.entry_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureEntryIsMutable(); entry_.addAll(other.entry_); } onChanged(); } } else { if (!other.entry_.isEmpty()) { if (entryBuilder_.isEmpty()) { entryBuilder_.dispose(); entryBuilder_ = null; entry_ = other.entry_; bitField0_ = (bitField0_ & ~0x00000001); entryBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getEntryFieldBuilder() : null; } else { entryBuilder_.addAllMessages(other.entry_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { for (int i = 0; i < getEntryCount(); i++) { if (!getEntry(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.GetFriendRequestResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .FriendRequest entry = 1; private java.util.List entry_ = java.util.Collections.emptyList(); private void ensureEntryIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { entry_ = new java.util.ArrayList(entry_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.FriendRequest, cn.wildfirechat.proto.WFCMessage.FriendRequest.Builder, cn.wildfirechat.proto.WFCMessage.FriendRequestOrBuilder> entryBuilder_; /** * repeated .FriendRequest entry = 1; */ public java.util.List getEntryList() { if (entryBuilder_ == null) { return java.util.Collections.unmodifiableList(entry_); } else { return entryBuilder_.getMessageList(); } } /** * repeated .FriendRequest entry = 1; */ public int getEntryCount() { if (entryBuilder_ == null) { return entry_.size(); } else { return entryBuilder_.getCount(); } } /** * repeated .FriendRequest entry = 1; */ public cn.wildfirechat.proto.WFCMessage.FriendRequest getEntry(int index) { if (entryBuilder_ == null) { return entry_.get(index); } else { return entryBuilder_.getMessage(index); } } /** * repeated .FriendRequest entry = 1; */ public Builder setEntry( int index, cn.wildfirechat.proto.WFCMessage.FriendRequest value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.set(index, value); onChanged(); } else { entryBuilder_.setMessage(index, value); } return this; } /** * repeated .FriendRequest entry = 1; */ public Builder setEntry( int index, cn.wildfirechat.proto.WFCMessage.FriendRequest.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.set(index, builderForValue.build()); onChanged(); } else { entryBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .FriendRequest entry = 1; */ public Builder addEntry(cn.wildfirechat.proto.WFCMessage.FriendRequest value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.add(value); onChanged(); } else { entryBuilder_.addMessage(value); } return this; } /** * repeated .FriendRequest entry = 1; */ public Builder addEntry( int index, cn.wildfirechat.proto.WFCMessage.FriendRequest value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.add(index, value); onChanged(); } else { entryBuilder_.addMessage(index, value); } return this; } /** * repeated .FriendRequest entry = 1; */ public Builder addEntry( cn.wildfirechat.proto.WFCMessage.FriendRequest.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.add(builderForValue.build()); onChanged(); } else { entryBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .FriendRequest entry = 1; */ public Builder addEntry( int index, cn.wildfirechat.proto.WFCMessage.FriendRequest.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.add(index, builderForValue.build()); onChanged(); } else { entryBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .FriendRequest entry = 1; */ public Builder addAllEntry( java.lang.Iterable values) { if (entryBuilder_ == null) { ensureEntryIsMutable(); super.addAll(values, entry_); onChanged(); } else { entryBuilder_.addAllMessages(values); } return this; } /** * repeated .FriendRequest entry = 1; */ public Builder clearEntry() { if (entryBuilder_ == null) { entry_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { entryBuilder_.clear(); } return this; } /** * repeated .FriendRequest entry = 1; */ public Builder removeEntry(int index) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.remove(index); onChanged(); } else { entryBuilder_.remove(index); } return this; } /** * repeated .FriendRequest entry = 1; */ public cn.wildfirechat.proto.WFCMessage.FriendRequest.Builder getEntryBuilder( int index) { return getEntryFieldBuilder().getBuilder(index); } /** * repeated .FriendRequest entry = 1; */ public cn.wildfirechat.proto.WFCMessage.FriendRequestOrBuilder getEntryOrBuilder( int index) { if (entryBuilder_ == null) { return entry_.get(index); } else { return entryBuilder_.getMessageOrBuilder(index); } } /** * repeated .FriendRequest entry = 1; */ public java.util.List getEntryOrBuilderList() { if (entryBuilder_ != null) { return entryBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(entry_); } } /** * repeated .FriendRequest entry = 1; */ public cn.wildfirechat.proto.WFCMessage.FriendRequest.Builder addEntryBuilder() { return getEntryFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.FriendRequest.getDefaultInstance()); } /** * repeated .FriendRequest entry = 1; */ public cn.wildfirechat.proto.WFCMessage.FriendRequest.Builder addEntryBuilder( int index) { return getEntryFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.FriendRequest.getDefaultInstance()); } /** * repeated .FriendRequest entry = 1; */ public java.util.List getEntryBuilderList() { return getEntryFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.FriendRequest, cn.wildfirechat.proto.WFCMessage.FriendRequest.Builder, cn.wildfirechat.proto.WFCMessage.FriendRequestOrBuilder> getEntryFieldBuilder() { if (entryBuilder_ == null) { entryBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.FriendRequest, cn.wildfirechat.proto.WFCMessage.FriendRequest.Builder, cn.wildfirechat.proto.WFCMessage.FriendRequestOrBuilder>( entry_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); entry_ = null; } return entryBuilder_; } // @@protoc_insertion_point(builder_scope:GetFriendRequestResult) } static { defaultInstance = new GetFriendRequestResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:GetFriendRequestResult) } public interface ConnectAckPayloadOrBuilder extends com.google.protobuf.MessageOrBuilder { // optional int64 msg_head = 1; /** * optional int64 msg_head = 1; */ boolean hasMsgHead(); /** * optional int64 msg_head = 1; */ long getMsgHead(); // optional int64 friend_head = 2; /** * optional int64 friend_head = 2; */ boolean hasFriendHead(); /** * optional int64 friend_head = 2; */ long getFriendHead(); // optional int64 friend_rq_head = 3; /** * optional int64 friend_rq_head = 3; */ boolean hasFriendRqHead(); /** * optional int64 friend_rq_head = 3; */ long getFriendRqHead(); // optional int64 setting_head = 4; /** * optional int64 setting_head = 4; */ boolean hasSettingHead(); /** * optional int64 setting_head = 4; */ long getSettingHead(); // optional string node_addr = 5; /** * optional string node_addr = 5; */ boolean hasNodeAddr(); /** * optional string node_addr = 5; */ java.lang.String getNodeAddr(); /** * optional string node_addr = 5; */ com.google.protobuf.ByteString getNodeAddrBytes(); // optional int32 node_port = 6; /** * optional int32 node_port = 6; */ boolean hasNodePort(); /** * optional int32 node_port = 6; */ int getNodePort(); // optional int64 server_time = 7; /** * optional int64 server_time = 7; */ boolean hasServerTime(); /** * optional int64 server_time = 7; */ long getServerTime(); } /** * Protobuf type {@code ConnectAckPayload} */ public static final class ConnectAckPayload extends com.google.protobuf.GeneratedMessage implements ConnectAckPayloadOrBuilder { // Use ConnectAckPayload.newBuilder() to construct. private ConnectAckPayload(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ConnectAckPayload(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ConnectAckPayload defaultInstance; public static ConnectAckPayload getDefaultInstance() { return defaultInstance; } public ConnectAckPayload getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ConnectAckPayload( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; msgHead_ = input.readInt64(); break; } case 16: { bitField0_ |= 0x00000002; friendHead_ = input.readInt64(); break; } case 24: { bitField0_ |= 0x00000004; friendRqHead_ = input.readInt64(); break; } case 32: { bitField0_ |= 0x00000008; settingHead_ = input.readInt64(); break; } case 42: { bitField0_ |= 0x00000010; nodeAddr_ = input.readBytes(); break; } case 48: { bitField0_ |= 0x00000020; nodePort_ = input.readInt32(); break; } case 56: { bitField0_ |= 0x00000040; serverTime_ = input.readInt64(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ConnectAckPayload_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ConnectAckPayload_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ConnectAckPayload.class, cn.wildfirechat.proto.WFCMessage.ConnectAckPayload.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ConnectAckPayload parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ConnectAckPayload(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // optional int64 msg_head = 1; public static final int MSG_HEAD_FIELD_NUMBER = 1; private long msgHead_; /** * optional int64 msg_head = 1; */ public boolean hasMsgHead() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * optional int64 msg_head = 1; */ public long getMsgHead() { return msgHead_; } // optional int64 friend_head = 2; public static final int FRIEND_HEAD_FIELD_NUMBER = 2; private long friendHead_; /** * optional int64 friend_head = 2; */ public boolean hasFriendHead() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional int64 friend_head = 2; */ public long getFriendHead() { return friendHead_; } // optional int64 friend_rq_head = 3; public static final int FRIEND_RQ_HEAD_FIELD_NUMBER = 3; private long friendRqHead_; /** * optional int64 friend_rq_head = 3; */ public boolean hasFriendRqHead() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int64 friend_rq_head = 3; */ public long getFriendRqHead() { return friendRqHead_; } // optional int64 setting_head = 4; public static final int SETTING_HEAD_FIELD_NUMBER = 4; private long settingHead_; /** * optional int64 setting_head = 4; */ public boolean hasSettingHead() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int64 setting_head = 4; */ public long getSettingHead() { return settingHead_; } // optional string node_addr = 5; public static final int NODE_ADDR_FIELD_NUMBER = 5; private java.lang.Object nodeAddr_; /** * optional string node_addr = 5; */ public boolean hasNodeAddr() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string node_addr = 5; */ public java.lang.String getNodeAddr() { java.lang.Object ref = nodeAddr_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { nodeAddr_ = s; } return s; } } /** * optional string node_addr = 5; */ public com.google.protobuf.ByteString getNodeAddrBytes() { java.lang.Object ref = nodeAddr_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); nodeAddr_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 node_port = 6; public static final int NODE_PORT_FIELD_NUMBER = 6; private int nodePort_; /** * optional int32 node_port = 6; */ public boolean hasNodePort() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional int32 node_port = 6; */ public int getNodePort() { return nodePort_; } // optional int64 server_time = 7; public static final int SERVER_TIME_FIELD_NUMBER = 7; private long serverTime_; /** * optional int64 server_time = 7; */ public boolean hasServerTime() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional int64 server_time = 7; */ public long getServerTime() { return serverTime_; } private void initFields() { msgHead_ = 0L; friendHead_ = 0L; friendRqHead_ = 0L; settingHead_ = 0L; nodeAddr_ = ""; nodePort_ = 0; serverTime_ = 0L; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt64(1, msgHead_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt64(2, friendHead_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt64(3, friendRqHead_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeInt64(4, settingHead_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBytes(5, getNodeAddrBytes()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeInt32(6, nodePort_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeInt64(7, serverTime_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(1, msgHead_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(2, friendHead_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(3, friendRqHead_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(4, settingHead_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(5, getNodeAddrBytes()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(6, nodePort_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(7, serverTime_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ConnectAckPayload parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ConnectAckPayload parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ConnectAckPayload parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ConnectAckPayload parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ConnectAckPayload parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ConnectAckPayload parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ConnectAckPayload parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ConnectAckPayload parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ConnectAckPayload parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ConnectAckPayload parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ConnectAckPayload prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ConnectAckPayload} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ConnectAckPayloadOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ConnectAckPayload_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ConnectAckPayload_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ConnectAckPayload.class, cn.wildfirechat.proto.WFCMessage.ConnectAckPayload.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ConnectAckPayload.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); msgHead_ = 0L; bitField0_ = (bitField0_ & ~0x00000001); friendHead_ = 0L; bitField0_ = (bitField0_ & ~0x00000002); friendRqHead_ = 0L; bitField0_ = (bitField0_ & ~0x00000004); settingHead_ = 0L; bitField0_ = (bitField0_ & ~0x00000008); nodeAddr_ = ""; bitField0_ = (bitField0_ & ~0x00000010); nodePort_ = 0; bitField0_ = (bitField0_ & ~0x00000020); serverTime_ = 0L; bitField0_ = (bitField0_ & ~0x00000040); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ConnectAckPayload_descriptor; } public cn.wildfirechat.proto.WFCMessage.ConnectAckPayload getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ConnectAckPayload.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ConnectAckPayload build() { cn.wildfirechat.proto.WFCMessage.ConnectAckPayload result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ConnectAckPayload buildPartial() { cn.wildfirechat.proto.WFCMessage.ConnectAckPayload result = new cn.wildfirechat.proto.WFCMessage.ConnectAckPayload(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.msgHead_ = msgHead_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.friendHead_ = friendHead_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.friendRqHead_ = friendRqHead_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.settingHead_ = settingHead_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.nodeAddr_ = nodeAddr_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.nodePort_ = nodePort_; if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000040; } result.serverTime_ = serverTime_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ConnectAckPayload) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ConnectAckPayload)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ConnectAckPayload other) { if (other == cn.wildfirechat.proto.WFCMessage.ConnectAckPayload.getDefaultInstance()) return this; if (other.hasMsgHead()) { setMsgHead(other.getMsgHead()); } if (other.hasFriendHead()) { setFriendHead(other.getFriendHead()); } if (other.hasFriendRqHead()) { setFriendRqHead(other.getFriendRqHead()); } if (other.hasSettingHead()) { setSettingHead(other.getSettingHead()); } if (other.hasNodeAddr()) { bitField0_ |= 0x00000010; nodeAddr_ = other.nodeAddr_; onChanged(); } if (other.hasNodePort()) { setNodePort(other.getNodePort()); } if (other.hasServerTime()) { setServerTime(other.getServerTime()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ConnectAckPayload parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ConnectAckPayload) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // optional int64 msg_head = 1; private long msgHead_ ; /** * optional int64 msg_head = 1; */ public boolean hasMsgHead() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * optional int64 msg_head = 1; */ public long getMsgHead() { return msgHead_; } /** * optional int64 msg_head = 1; */ public Builder setMsgHead(long value) { bitField0_ |= 0x00000001; msgHead_ = value; onChanged(); return this; } /** * optional int64 msg_head = 1; */ public Builder clearMsgHead() { bitField0_ = (bitField0_ & ~0x00000001); msgHead_ = 0L; onChanged(); return this; } // optional int64 friend_head = 2; private long friendHead_ ; /** * optional int64 friend_head = 2; */ public boolean hasFriendHead() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional int64 friend_head = 2; */ public long getFriendHead() { return friendHead_; } /** * optional int64 friend_head = 2; */ public Builder setFriendHead(long value) { bitField0_ |= 0x00000002; friendHead_ = value; onChanged(); return this; } /** * optional int64 friend_head = 2; */ public Builder clearFriendHead() { bitField0_ = (bitField0_ & ~0x00000002); friendHead_ = 0L; onChanged(); return this; } // optional int64 friend_rq_head = 3; private long friendRqHead_ ; /** * optional int64 friend_rq_head = 3; */ public boolean hasFriendRqHead() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int64 friend_rq_head = 3; */ public long getFriendRqHead() { return friendRqHead_; } /** * optional int64 friend_rq_head = 3; */ public Builder setFriendRqHead(long value) { bitField0_ |= 0x00000004; friendRqHead_ = value; onChanged(); return this; } /** * optional int64 friend_rq_head = 3; */ public Builder clearFriendRqHead() { bitField0_ = (bitField0_ & ~0x00000004); friendRqHead_ = 0L; onChanged(); return this; } // optional int64 setting_head = 4; private long settingHead_ ; /** * optional int64 setting_head = 4; */ public boolean hasSettingHead() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int64 setting_head = 4; */ public long getSettingHead() { return settingHead_; } /** * optional int64 setting_head = 4; */ public Builder setSettingHead(long value) { bitField0_ |= 0x00000008; settingHead_ = value; onChanged(); return this; } /** * optional int64 setting_head = 4; */ public Builder clearSettingHead() { bitField0_ = (bitField0_ & ~0x00000008); settingHead_ = 0L; onChanged(); return this; } // optional string node_addr = 5; private java.lang.Object nodeAddr_ = ""; /** * optional string node_addr = 5; */ public boolean hasNodeAddr() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string node_addr = 5; */ public java.lang.String getNodeAddr() { java.lang.Object ref = nodeAddr_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); nodeAddr_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string node_addr = 5; */ public com.google.protobuf.ByteString getNodeAddrBytes() { java.lang.Object ref = nodeAddr_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); nodeAddr_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string node_addr = 5; */ public Builder setNodeAddr( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; nodeAddr_ = value; onChanged(); return this; } /** * optional string node_addr = 5; */ public Builder clearNodeAddr() { bitField0_ = (bitField0_ & ~0x00000010); nodeAddr_ = getDefaultInstance().getNodeAddr(); onChanged(); return this; } /** * optional string node_addr = 5; */ public Builder setNodeAddrBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; nodeAddr_ = value; onChanged(); return this; } // optional int32 node_port = 6; private int nodePort_ ; /** * optional int32 node_port = 6; */ public boolean hasNodePort() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional int32 node_port = 6; */ public int getNodePort() { return nodePort_; } /** * optional int32 node_port = 6; */ public Builder setNodePort(int value) { bitField0_ |= 0x00000020; nodePort_ = value; onChanged(); return this; } /** * optional int32 node_port = 6; */ public Builder clearNodePort() { bitField0_ = (bitField0_ & ~0x00000020); nodePort_ = 0; onChanged(); return this; } // optional int64 server_time = 7; private long serverTime_ ; /** * optional int64 server_time = 7; */ public boolean hasServerTime() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional int64 server_time = 7; */ public long getServerTime() { return serverTime_; } /** * optional int64 server_time = 7; */ public Builder setServerTime(long value) { bitField0_ |= 0x00000040; serverTime_ = value; onChanged(); return this; } /** * optional int64 server_time = 7; */ public Builder clearServerTime() { bitField0_ = (bitField0_ & ~0x00000040); serverTime_ = 0L; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:ConnectAckPayload) } static { defaultInstance = new ConnectAckPayload(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ConnectAckPayload) } public interface IMHttpWrapperOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string token = 1; /** * required string token = 1; */ boolean hasToken(); /** * required string token = 1; */ java.lang.String getToken(); /** * required string token = 1; */ com.google.protobuf.ByteString getTokenBytes(); // required string client_id = 2; /** * required string client_id = 2; */ boolean hasClientId(); /** * required string client_id = 2; */ java.lang.String getClientId(); /** * required string client_id = 2; */ com.google.protobuf.ByteString getClientIdBytes(); // required string request = 3; /** * required string request = 3; */ boolean hasRequest(); /** * required string request = 3; */ java.lang.String getRequest(); /** * required string request = 3; */ com.google.protobuf.ByteString getRequestBytes(); // optional bytes data = 4; /** * optional bytes data = 4; */ boolean hasData(); /** * optional bytes data = 4; */ com.google.protobuf.ByteString getData(); } /** * Protobuf type {@code IMHttpWrapper} */ public static final class IMHttpWrapper extends com.google.protobuf.GeneratedMessage implements IMHttpWrapperOrBuilder { // Use IMHttpWrapper.newBuilder() to construct. private IMHttpWrapper(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private IMHttpWrapper(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final IMHttpWrapper defaultInstance; public static IMHttpWrapper getDefaultInstance() { return defaultInstance; } public IMHttpWrapper getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private IMHttpWrapper( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; token_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; clientId_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; request_ = input.readBytes(); break; } case 34: { bitField0_ |= 0x00000008; data_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_IMHttpWrapper_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_IMHttpWrapper_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.IMHttpWrapper.class, cn.wildfirechat.proto.WFCMessage.IMHttpWrapper.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public IMHttpWrapper parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new IMHttpWrapper(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string token = 1; public static final int TOKEN_FIELD_NUMBER = 1; private java.lang.Object token_; /** * required string token = 1; */ public boolean hasToken() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string token = 1; */ public java.lang.String getToken() { java.lang.Object ref = token_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { token_ = s; } return s; } } /** * required string token = 1; */ public com.google.protobuf.ByteString getTokenBytes() { java.lang.Object ref = token_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); token_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string client_id = 2; public static final int CLIENT_ID_FIELD_NUMBER = 2; private java.lang.Object clientId_; /** * required string client_id = 2; */ public boolean hasClientId() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string client_id = 2; */ public java.lang.String getClientId() { java.lang.Object ref = clientId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { clientId_ = s; } return s; } } /** * required string client_id = 2; */ public com.google.protobuf.ByteString getClientIdBytes() { java.lang.Object ref = clientId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); clientId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string request = 3; public static final int REQUEST_FIELD_NUMBER = 3; private java.lang.Object request_; /** * required string request = 3; */ public boolean hasRequest() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string request = 3; */ public java.lang.String getRequest() { java.lang.Object ref = request_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { request_ = s; } return s; } } /** * required string request = 3; */ public com.google.protobuf.ByteString getRequestBytes() { java.lang.Object ref = request_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); request_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional bytes data = 4; public static final int DATA_FIELD_NUMBER = 4; private com.google.protobuf.ByteString data_; /** * optional bytes data = 4; */ public boolean hasData() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional bytes data = 4; */ public com.google.protobuf.ByteString getData() { return data_; } private void initFields() { token_ = ""; clientId_ = ""; request_ = ""; data_ = com.google.protobuf.ByteString.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasToken()) { memoizedIsInitialized = 0; return false; } if (!hasClientId()) { memoizedIsInitialized = 0; return false; } if (!hasRequest()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTokenBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getClientIdBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getRequestBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, data_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTokenBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getClientIdBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getRequestBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, data_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.IMHttpWrapper parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.IMHttpWrapper parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.IMHttpWrapper parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.IMHttpWrapper parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.IMHttpWrapper parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.IMHttpWrapper parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.IMHttpWrapper parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.IMHttpWrapper parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.IMHttpWrapper parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.IMHttpWrapper parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.IMHttpWrapper prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code IMHttpWrapper} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.IMHttpWrapperOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_IMHttpWrapper_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_IMHttpWrapper_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.IMHttpWrapper.class, cn.wildfirechat.proto.WFCMessage.IMHttpWrapper.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.IMHttpWrapper.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); token_ = ""; bitField0_ = (bitField0_ & ~0x00000001); clientId_ = ""; bitField0_ = (bitField0_ & ~0x00000002); request_ = ""; bitField0_ = (bitField0_ & ~0x00000004); data_ = com.google.protobuf.ByteString.EMPTY; bitField0_ = (bitField0_ & ~0x00000008); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_IMHttpWrapper_descriptor; } public cn.wildfirechat.proto.WFCMessage.IMHttpWrapper getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.IMHttpWrapper.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.IMHttpWrapper build() { cn.wildfirechat.proto.WFCMessage.IMHttpWrapper result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.IMHttpWrapper buildPartial() { cn.wildfirechat.proto.WFCMessage.IMHttpWrapper result = new cn.wildfirechat.proto.WFCMessage.IMHttpWrapper(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.token_ = token_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.clientId_ = clientId_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.request_ = request_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.data_ = data_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.IMHttpWrapper) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.IMHttpWrapper)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.IMHttpWrapper other) { if (other == cn.wildfirechat.proto.WFCMessage.IMHttpWrapper.getDefaultInstance()) return this; if (other.hasToken()) { bitField0_ |= 0x00000001; token_ = other.token_; onChanged(); } if (other.hasClientId()) { bitField0_ |= 0x00000002; clientId_ = other.clientId_; onChanged(); } if (other.hasRequest()) { bitField0_ |= 0x00000004; request_ = other.request_; onChanged(); } if (other.hasData()) { setData(other.getData()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasToken()) { return false; } if (!hasClientId()) { return false; } if (!hasRequest()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.IMHttpWrapper parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.IMHttpWrapper) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string token = 1; private java.lang.Object token_ = ""; /** * required string token = 1; */ public boolean hasToken() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string token = 1; */ public java.lang.String getToken() { java.lang.Object ref = token_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); token_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string token = 1; */ public com.google.protobuf.ByteString getTokenBytes() { java.lang.Object ref = token_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); token_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string token = 1; */ public Builder setToken( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; token_ = value; onChanged(); return this; } /** * required string token = 1; */ public Builder clearToken() { bitField0_ = (bitField0_ & ~0x00000001); token_ = getDefaultInstance().getToken(); onChanged(); return this; } /** * required string token = 1; */ public Builder setTokenBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; token_ = value; onChanged(); return this; } // required string client_id = 2; private java.lang.Object clientId_ = ""; /** * required string client_id = 2; */ public boolean hasClientId() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string client_id = 2; */ public java.lang.String getClientId() { java.lang.Object ref = clientId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); clientId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string client_id = 2; */ public com.google.protobuf.ByteString getClientIdBytes() { java.lang.Object ref = clientId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); clientId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string client_id = 2; */ public Builder setClientId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; clientId_ = value; onChanged(); return this; } /** * required string client_id = 2; */ public Builder clearClientId() { bitField0_ = (bitField0_ & ~0x00000002); clientId_ = getDefaultInstance().getClientId(); onChanged(); return this; } /** * required string client_id = 2; */ public Builder setClientIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; clientId_ = value; onChanged(); return this; } // required string request = 3; private java.lang.Object request_ = ""; /** * required string request = 3; */ public boolean hasRequest() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string request = 3; */ public java.lang.String getRequest() { java.lang.Object ref = request_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); request_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string request = 3; */ public com.google.protobuf.ByteString getRequestBytes() { java.lang.Object ref = request_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); request_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string request = 3; */ public Builder setRequest( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; request_ = value; onChanged(); return this; } /** * required string request = 3; */ public Builder clearRequest() { bitField0_ = (bitField0_ & ~0x00000004); request_ = getDefaultInstance().getRequest(); onChanged(); return this; } /** * required string request = 3; */ public Builder setRequestBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; request_ = value; onChanged(); return this; } // optional bytes data = 4; private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY; /** * optional bytes data = 4; */ public boolean hasData() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional bytes data = 4; */ public com.google.protobuf.ByteString getData() { return data_; } /** * optional bytes data = 4; */ public Builder setData(com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; data_ = value; onChanged(); return this; } /** * optional bytes data = 4; */ public Builder clearData() { bitField0_ = (bitField0_ & ~0x00000008); data_ = getDefaultInstance().getData(); onChanged(); return this; } // @@protoc_insertion_point(builder_scope:IMHttpWrapper) } static { defaultInstance = new IMHttpWrapper(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:IMHttpWrapper) } public interface SearchUserRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string keyword = 1; /** * required string keyword = 1; */ boolean hasKeyword(); /** * required string keyword = 1; */ java.lang.String getKeyword(); /** * required string keyword = 1; */ com.google.protobuf.ByteString getKeywordBytes(); // optional int32 fuzzy = 2; /** * optional int32 fuzzy = 2; */ boolean hasFuzzy(); /** * optional int32 fuzzy = 2; */ int getFuzzy(); // optional int32 page = 3; /** * optional int32 page = 3; */ boolean hasPage(); /** * optional int32 page = 3; */ int getPage(); // optional string domain_id = 4; /** * optional string domain_id = 4; */ boolean hasDomainId(); /** * optional string domain_id = 4; */ java.lang.String getDomainId(); /** * optional string domain_id = 4; */ com.google.protobuf.ByteString getDomainIdBytes(); // optional int32 type = 5; /** * optional int32 type = 5; */ boolean hasType(); /** * optional int32 type = 5; */ int getType(); } /** * Protobuf type {@code SearchUserRequest} */ public static final class SearchUserRequest extends com.google.protobuf.GeneratedMessage implements SearchUserRequestOrBuilder { // Use SearchUserRequest.newBuilder() to construct. private SearchUserRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private SearchUserRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final SearchUserRequest defaultInstance; public static SearchUserRequest getDefaultInstance() { return defaultInstance; } public SearchUserRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private SearchUserRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; keyword_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; fuzzy_ = input.readInt32(); break; } case 24: { bitField0_ |= 0x00000004; page_ = input.readInt32(); break; } case 34: { bitField0_ |= 0x00000008; domainId_ = input.readBytes(); break; } case 40: { bitField0_ |= 0x00000010; type_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchUserRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchUserRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.SearchUserRequest.class, cn.wildfirechat.proto.WFCMessage.SearchUserRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public SearchUserRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new SearchUserRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string keyword = 1; public static final int KEYWORD_FIELD_NUMBER = 1; private java.lang.Object keyword_; /** * required string keyword = 1; */ public boolean hasKeyword() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string keyword = 1; */ public java.lang.String getKeyword() { java.lang.Object ref = keyword_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { keyword_ = s; } return s; } } /** * required string keyword = 1; */ public com.google.protobuf.ByteString getKeywordBytes() { java.lang.Object ref = keyword_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); keyword_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 fuzzy = 2; public static final int FUZZY_FIELD_NUMBER = 2; private int fuzzy_; /** * optional int32 fuzzy = 2; */ public boolean hasFuzzy() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional int32 fuzzy = 2; */ public int getFuzzy() { return fuzzy_; } // optional int32 page = 3; public static final int PAGE_FIELD_NUMBER = 3; private int page_; /** * optional int32 page = 3; */ public boolean hasPage() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int32 page = 3; */ public int getPage() { return page_; } // optional string domain_id = 4; public static final int DOMAIN_ID_FIELD_NUMBER = 4; private java.lang.Object domainId_; /** * optional string domain_id = 4; */ public boolean hasDomainId() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string domain_id = 4; */ public java.lang.String getDomainId() { java.lang.Object ref = domainId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { domainId_ = s; } return s; } } /** * optional string domain_id = 4; */ public com.google.protobuf.ByteString getDomainIdBytes() { java.lang.Object ref = domainId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); domainId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 type = 5; public static final int TYPE_FIELD_NUMBER = 5; private int type_; /** * optional int32 type = 5; */ public boolean hasType() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int32 type = 5; */ public int getType() { return type_; } private void initFields() { keyword_ = ""; fuzzy_ = 0; page_ = 0; domainId_ = ""; type_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasKeyword()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getKeywordBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, fuzzy_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(3, page_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getDomainIdBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeInt32(5, type_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getKeywordBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, fuzzy_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(3, page_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getDomainIdBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(5, type_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.SearchUserRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.SearchUserRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SearchUserRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.SearchUserRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SearchUserRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.SearchUserRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SearchUserRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.SearchUserRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SearchUserRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.SearchUserRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.SearchUserRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code SearchUserRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.SearchUserRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchUserRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchUserRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.SearchUserRequest.class, cn.wildfirechat.proto.WFCMessage.SearchUserRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.SearchUserRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); keyword_ = ""; bitField0_ = (bitField0_ & ~0x00000001); fuzzy_ = 0; bitField0_ = (bitField0_ & ~0x00000002); page_ = 0; bitField0_ = (bitField0_ & ~0x00000004); domainId_ = ""; bitField0_ = (bitField0_ & ~0x00000008); type_ = 0; bitField0_ = (bitField0_ & ~0x00000010); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchUserRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.SearchUserRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.SearchUserRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.SearchUserRequest build() { cn.wildfirechat.proto.WFCMessage.SearchUserRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.SearchUserRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.SearchUserRequest result = new cn.wildfirechat.proto.WFCMessage.SearchUserRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.keyword_ = keyword_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.fuzzy_ = fuzzy_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.page_ = page_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.domainId_ = domainId_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.type_ = type_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.SearchUserRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.SearchUserRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.SearchUserRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.SearchUserRequest.getDefaultInstance()) return this; if (other.hasKeyword()) { bitField0_ |= 0x00000001; keyword_ = other.keyword_; onChanged(); } if (other.hasFuzzy()) { setFuzzy(other.getFuzzy()); } if (other.hasPage()) { setPage(other.getPage()); } if (other.hasDomainId()) { bitField0_ |= 0x00000008; domainId_ = other.domainId_; onChanged(); } if (other.hasType()) { setType(other.getType()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasKeyword()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.SearchUserRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.SearchUserRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string keyword = 1; private java.lang.Object keyword_ = ""; /** * required string keyword = 1; */ public boolean hasKeyword() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string keyword = 1; */ public java.lang.String getKeyword() { java.lang.Object ref = keyword_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); keyword_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string keyword = 1; */ public com.google.protobuf.ByteString getKeywordBytes() { java.lang.Object ref = keyword_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); keyword_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string keyword = 1; */ public Builder setKeyword( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; keyword_ = value; onChanged(); return this; } /** * required string keyword = 1; */ public Builder clearKeyword() { bitField0_ = (bitField0_ & ~0x00000001); keyword_ = getDefaultInstance().getKeyword(); onChanged(); return this; } /** * required string keyword = 1; */ public Builder setKeywordBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; keyword_ = value; onChanged(); return this; } // optional int32 fuzzy = 2; private int fuzzy_ ; /** * optional int32 fuzzy = 2; */ public boolean hasFuzzy() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional int32 fuzzy = 2; */ public int getFuzzy() { return fuzzy_; } /** * optional int32 fuzzy = 2; */ public Builder setFuzzy(int value) { bitField0_ |= 0x00000002; fuzzy_ = value; onChanged(); return this; } /** * optional int32 fuzzy = 2; */ public Builder clearFuzzy() { bitField0_ = (bitField0_ & ~0x00000002); fuzzy_ = 0; onChanged(); return this; } // optional int32 page = 3; private int page_ ; /** * optional int32 page = 3; */ public boolean hasPage() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int32 page = 3; */ public int getPage() { return page_; } /** * optional int32 page = 3; */ public Builder setPage(int value) { bitField0_ |= 0x00000004; page_ = value; onChanged(); return this; } /** * optional int32 page = 3; */ public Builder clearPage() { bitField0_ = (bitField0_ & ~0x00000004); page_ = 0; onChanged(); return this; } // optional string domain_id = 4; private java.lang.Object domainId_ = ""; /** * optional string domain_id = 4; */ public boolean hasDomainId() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string domain_id = 4; */ public java.lang.String getDomainId() { java.lang.Object ref = domainId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); domainId_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string domain_id = 4; */ public com.google.protobuf.ByteString getDomainIdBytes() { java.lang.Object ref = domainId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); domainId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string domain_id = 4; */ public Builder setDomainId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; domainId_ = value; onChanged(); return this; } /** * optional string domain_id = 4; */ public Builder clearDomainId() { bitField0_ = (bitField0_ & ~0x00000008); domainId_ = getDefaultInstance().getDomainId(); onChanged(); return this; } /** * optional string domain_id = 4; */ public Builder setDomainIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; domainId_ = value; onChanged(); return this; } // optional int32 type = 5; private int type_ ; /** * optional int32 type = 5; */ public boolean hasType() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int32 type = 5; */ public int getType() { return type_; } /** * optional int32 type = 5; */ public Builder setType(int value) { bitField0_ |= 0x00000010; type_ = value; onChanged(); return this; } /** * optional int32 type = 5; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000010); type_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:SearchUserRequest) } static { defaultInstance = new SearchUserRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:SearchUserRequest) } public interface SearchUserResultOrBuilder extends com.google.protobuf.MessageOrBuilder { // repeated .User entry = 1; /** * repeated .User entry = 1; */ java.util.List getEntryList(); /** * repeated .User entry = 1; */ cn.wildfirechat.proto.WFCMessage.User getEntry(int index); /** * repeated .User entry = 1; */ int getEntryCount(); /** * repeated .User entry = 1; */ java.util.List getEntryOrBuilderList(); /** * repeated .User entry = 1; */ cn.wildfirechat.proto.WFCMessage.UserOrBuilder getEntryOrBuilder( int index); } /** * Protobuf type {@code SearchUserResult} */ public static final class SearchUserResult extends com.google.protobuf.GeneratedMessage implements SearchUserResultOrBuilder { // Use SearchUserResult.newBuilder() to construct. private SearchUserResult(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private SearchUserResult(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final SearchUserResult defaultInstance; public static SearchUserResult getDefaultInstance() { return defaultInstance; } public SearchUserResult getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private SearchUserResult( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { if (!((mutable_bitField0_ & 0x00000001) == 0x00000001)) { entry_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000001; } entry_.add(input.readMessage(cn.wildfirechat.proto.WFCMessage.User.PARSER, extensionRegistry)); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000001) == 0x00000001)) { entry_ = java.util.Collections.unmodifiableList(entry_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchUserResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchUserResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.SearchUserResult.class, cn.wildfirechat.proto.WFCMessage.SearchUserResult.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public SearchUserResult parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new SearchUserResult(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } // repeated .User entry = 1; public static final int ENTRY_FIELD_NUMBER = 1; private java.util.List entry_; /** * repeated .User entry = 1; */ public java.util.List getEntryList() { return entry_; } /** * repeated .User entry = 1; */ public java.util.List getEntryOrBuilderList() { return entry_; } /** * repeated .User entry = 1; */ public int getEntryCount() { return entry_.size(); } /** * repeated .User entry = 1; */ public cn.wildfirechat.proto.WFCMessage.User getEntry(int index) { return entry_.get(index); } /** * repeated .User entry = 1; */ public cn.wildfirechat.proto.WFCMessage.UserOrBuilder getEntryOrBuilder( int index) { return entry_.get(index); } private void initFields() { entry_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; for (int i = 0; i < getEntryCount(); i++) { if (!getEntry(i).isInitialized()) { memoizedIsInitialized = 0; return false; } } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); for (int i = 0; i < entry_.size(); i++) { output.writeMessage(1, entry_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; for (int i = 0; i < entry_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, entry_.get(i)); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.SearchUserResult parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.SearchUserResult parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SearchUserResult parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.SearchUserResult parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SearchUserResult parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.SearchUserResult parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SearchUserResult parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.SearchUserResult parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.SearchUserResult parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.SearchUserResult parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.SearchUserResult prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code SearchUserResult} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.SearchUserResultOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchUserResult_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchUserResult_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.SearchUserResult.class, cn.wildfirechat.proto.WFCMessage.SearchUserResult.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.SearchUserResult.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getEntryFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (entryBuilder_ == null) { entry_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); } else { entryBuilder_.clear(); } return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_SearchUserResult_descriptor; } public cn.wildfirechat.proto.WFCMessage.SearchUserResult getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.SearchUserResult.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.SearchUserResult build() { cn.wildfirechat.proto.WFCMessage.SearchUserResult result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.SearchUserResult buildPartial() { cn.wildfirechat.proto.WFCMessage.SearchUserResult result = new cn.wildfirechat.proto.WFCMessage.SearchUserResult(this); int from_bitField0_ = bitField0_; if (entryBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { entry_ = java.util.Collections.unmodifiableList(entry_); bitField0_ = (bitField0_ & ~0x00000001); } result.entry_ = entry_; } else { result.entry_ = entryBuilder_.build(); } onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.SearchUserResult) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.SearchUserResult)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.SearchUserResult other) { if (other == cn.wildfirechat.proto.WFCMessage.SearchUserResult.getDefaultInstance()) return this; if (entryBuilder_ == null) { if (!other.entry_.isEmpty()) { if (entry_.isEmpty()) { entry_ = other.entry_; bitField0_ = (bitField0_ & ~0x00000001); } else { ensureEntryIsMutable(); entry_.addAll(other.entry_); } onChanged(); } } else { if (!other.entry_.isEmpty()) { if (entryBuilder_.isEmpty()) { entryBuilder_.dispose(); entryBuilder_ = null; entry_ = other.entry_; bitField0_ = (bitField0_ & ~0x00000001); entryBuilder_ = com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ? getEntryFieldBuilder() : null; } else { entryBuilder_.addAllMessages(other.entry_); } } } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { for (int i = 0; i < getEntryCount(); i++) { if (!getEntry(i).isInitialized()) { return false; } } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.SearchUserResult parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.SearchUserResult) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // repeated .User entry = 1; private java.util.List entry_ = java.util.Collections.emptyList(); private void ensureEntryIsMutable() { if (!((bitField0_ & 0x00000001) == 0x00000001)) { entry_ = new java.util.ArrayList(entry_); bitField0_ |= 0x00000001; } } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.User, cn.wildfirechat.proto.WFCMessage.User.Builder, cn.wildfirechat.proto.WFCMessage.UserOrBuilder> entryBuilder_; /** * repeated .User entry = 1; */ public java.util.List getEntryList() { if (entryBuilder_ == null) { return java.util.Collections.unmodifiableList(entry_); } else { return entryBuilder_.getMessageList(); } } /** * repeated .User entry = 1; */ public int getEntryCount() { if (entryBuilder_ == null) { return entry_.size(); } else { return entryBuilder_.getCount(); } } /** * repeated .User entry = 1; */ public cn.wildfirechat.proto.WFCMessage.User getEntry(int index) { if (entryBuilder_ == null) { return entry_.get(index); } else { return entryBuilder_.getMessage(index); } } /** * repeated .User entry = 1; */ public Builder setEntry( int index, cn.wildfirechat.proto.WFCMessage.User value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.set(index, value); onChanged(); } else { entryBuilder_.setMessage(index, value); } return this; } /** * repeated .User entry = 1; */ public Builder setEntry( int index, cn.wildfirechat.proto.WFCMessage.User.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.set(index, builderForValue.build()); onChanged(); } else { entryBuilder_.setMessage(index, builderForValue.build()); } return this; } /** * repeated .User entry = 1; */ public Builder addEntry(cn.wildfirechat.proto.WFCMessage.User value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.add(value); onChanged(); } else { entryBuilder_.addMessage(value); } return this; } /** * repeated .User entry = 1; */ public Builder addEntry( int index, cn.wildfirechat.proto.WFCMessage.User value) { if (entryBuilder_ == null) { if (value == null) { throw new NullPointerException(); } ensureEntryIsMutable(); entry_.add(index, value); onChanged(); } else { entryBuilder_.addMessage(index, value); } return this; } /** * repeated .User entry = 1; */ public Builder addEntry( cn.wildfirechat.proto.WFCMessage.User.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.add(builderForValue.build()); onChanged(); } else { entryBuilder_.addMessage(builderForValue.build()); } return this; } /** * repeated .User entry = 1; */ public Builder addEntry( int index, cn.wildfirechat.proto.WFCMessage.User.Builder builderForValue) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.add(index, builderForValue.build()); onChanged(); } else { entryBuilder_.addMessage(index, builderForValue.build()); } return this; } /** * repeated .User entry = 1; */ public Builder addAllEntry( java.lang.Iterable values) { if (entryBuilder_ == null) { ensureEntryIsMutable(); super.addAll(values, entry_); onChanged(); } else { entryBuilder_.addAllMessages(values); } return this; } /** * repeated .User entry = 1; */ public Builder clearEntry() { if (entryBuilder_ == null) { entry_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000001); onChanged(); } else { entryBuilder_.clear(); } return this; } /** * repeated .User entry = 1; */ public Builder removeEntry(int index) { if (entryBuilder_ == null) { ensureEntryIsMutable(); entry_.remove(index); onChanged(); } else { entryBuilder_.remove(index); } return this; } /** * repeated .User entry = 1; */ public cn.wildfirechat.proto.WFCMessage.User.Builder getEntryBuilder( int index) { return getEntryFieldBuilder().getBuilder(index); } /** * repeated .User entry = 1; */ public cn.wildfirechat.proto.WFCMessage.UserOrBuilder getEntryOrBuilder( int index) { if (entryBuilder_ == null) { return entry_.get(index); } else { return entryBuilder_.getMessageOrBuilder(index); } } /** * repeated .User entry = 1; */ public java.util.List getEntryOrBuilderList() { if (entryBuilder_ != null) { return entryBuilder_.getMessageOrBuilderList(); } else { return java.util.Collections.unmodifiableList(entry_); } } /** * repeated .User entry = 1; */ public cn.wildfirechat.proto.WFCMessage.User.Builder addEntryBuilder() { return getEntryFieldBuilder().addBuilder( cn.wildfirechat.proto.WFCMessage.User.getDefaultInstance()); } /** * repeated .User entry = 1; */ public cn.wildfirechat.proto.WFCMessage.User.Builder addEntryBuilder( int index) { return getEntryFieldBuilder().addBuilder( index, cn.wildfirechat.proto.WFCMessage.User.getDefaultInstance()); } /** * repeated .User entry = 1; */ public java.util.List getEntryBuilderList() { return getEntryFieldBuilder().getBuilderList(); } private com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.User, cn.wildfirechat.proto.WFCMessage.User.Builder, cn.wildfirechat.proto.WFCMessage.UserOrBuilder> getEntryFieldBuilder() { if (entryBuilder_ == null) { entryBuilder_ = new com.google.protobuf.RepeatedFieldBuilder< cn.wildfirechat.proto.WFCMessage.User, cn.wildfirechat.proto.WFCMessage.User.Builder, cn.wildfirechat.proto.WFCMessage.UserOrBuilder>( entry_, ((bitField0_ & 0x00000001) == 0x00000001), getParentForChildren(), isClean()); entry_ = null; } return entryBuilder_; } // @@protoc_insertion_point(builder_scope:SearchUserResult) } static { defaultInstance = new SearchUserResult(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:SearchUserResult) } public interface GetChatroomInfoRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string chatroom_id = 1; /** * required string chatroom_id = 1; */ boolean hasChatroomId(); /** * required string chatroom_id = 1; */ java.lang.String getChatroomId(); /** * required string chatroom_id = 1; */ com.google.protobuf.ByteString getChatroomIdBytes(); // optional int64 update_dt = 2; /** * optional int64 update_dt = 2; */ boolean hasUpdateDt(); /** * optional int64 update_dt = 2; */ long getUpdateDt(); } /** * Protobuf type {@code GetChatroomInfoRequest} */ public static final class GetChatroomInfoRequest extends com.google.protobuf.GeneratedMessage implements GetChatroomInfoRequestOrBuilder { // Use GetChatroomInfoRequest.newBuilder() to construct. private GetChatroomInfoRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private GetChatroomInfoRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final GetChatroomInfoRequest defaultInstance; public static GetChatroomInfoRequest getDefaultInstance() { return defaultInstance; } public GetChatroomInfoRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GetChatroomInfoRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; chatroomId_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; updateDt_ = input.readInt64(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetChatroomInfoRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetChatroomInfoRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest.class, cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public GetChatroomInfoRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GetChatroomInfoRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string chatroom_id = 1; public static final int CHATROOM_ID_FIELD_NUMBER = 1; private java.lang.Object chatroomId_; /** * required string chatroom_id = 1; */ public boolean hasChatroomId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string chatroom_id = 1; */ public java.lang.String getChatroomId() { java.lang.Object ref = chatroomId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { chatroomId_ = s; } return s; } } /** * required string chatroom_id = 1; */ public com.google.protobuf.ByteString getChatroomIdBytes() { java.lang.Object ref = chatroomId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); chatroomId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int64 update_dt = 2; public static final int UPDATE_DT_FIELD_NUMBER = 2; private long updateDt_; /** * optional int64 update_dt = 2; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional int64 update_dt = 2; */ public long getUpdateDt() { return updateDt_; } private void initFields() { chatroomId_ = ""; updateDt_ = 0L; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasChatroomId()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getChatroomIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt64(2, updateDt_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getChatroomIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(2, updateDt_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code GetChatroomInfoRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetChatroomInfoRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetChatroomInfoRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest.class, cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); chatroomId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); updateDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetChatroomInfoRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest build() { cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest result = new cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.chatroomId_ = chatroomId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.updateDt_ = updateDt_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest.getDefaultInstance()) return this; if (other.hasChatroomId()) { bitField0_ |= 0x00000001; chatroomId_ = other.chatroomId_; onChanged(); } if (other.hasUpdateDt()) { setUpdateDt(other.getUpdateDt()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasChatroomId()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.GetChatroomInfoRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string chatroom_id = 1; private java.lang.Object chatroomId_ = ""; /** * required string chatroom_id = 1; */ public boolean hasChatroomId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string chatroom_id = 1; */ public java.lang.String getChatroomId() { java.lang.Object ref = chatroomId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); chatroomId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string chatroom_id = 1; */ public com.google.protobuf.ByteString getChatroomIdBytes() { java.lang.Object ref = chatroomId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); chatroomId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string chatroom_id = 1; */ public Builder setChatroomId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; chatroomId_ = value; onChanged(); return this; } /** * required string chatroom_id = 1; */ public Builder clearChatroomId() { bitField0_ = (bitField0_ & ~0x00000001); chatroomId_ = getDefaultInstance().getChatroomId(); onChanged(); return this; } /** * required string chatroom_id = 1; */ public Builder setChatroomIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; chatroomId_ = value; onChanged(); return this; } // optional int64 update_dt = 2; private long updateDt_ ; /** * optional int64 update_dt = 2; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional int64 update_dt = 2; */ public long getUpdateDt() { return updateDt_; } /** * optional int64 update_dt = 2; */ public Builder setUpdateDt(long value) { bitField0_ |= 0x00000002; updateDt_ = value; onChanged(); return this; } /** * optional int64 update_dt = 2; */ public Builder clearUpdateDt() { bitField0_ = (bitField0_ & ~0x00000002); updateDt_ = 0L; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:GetChatroomInfoRequest) } static { defaultInstance = new GetChatroomInfoRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:GetChatroomInfoRequest) } public interface ChatroomInfoOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string title = 1; /** * required string title = 1; */ boolean hasTitle(); /** * required string title = 1; */ java.lang.String getTitle(); /** * required string title = 1; */ com.google.protobuf.ByteString getTitleBytes(); // optional string desc = 2; /** * optional string desc = 2; */ boolean hasDesc(); /** * optional string desc = 2; */ java.lang.String getDesc(); /** * optional string desc = 2; */ com.google.protobuf.ByteString getDescBytes(); // optional string portrait = 3; /** * optional string portrait = 3; */ boolean hasPortrait(); /** * optional string portrait = 3; */ java.lang.String getPortrait(); /** * optional string portrait = 3; */ com.google.protobuf.ByteString getPortraitBytes(); // optional int32 member_count = 4; /** * optional int32 member_count = 4; */ boolean hasMemberCount(); /** * optional int32 member_count = 4; */ int getMemberCount(); // optional int64 create_dt = 5; /** * optional int64 create_dt = 5; */ boolean hasCreateDt(); /** * optional int64 create_dt = 5; */ long getCreateDt(); // optional int64 update_dt = 6; /** * optional int64 update_dt = 6; */ boolean hasUpdateDt(); /** * optional int64 update_dt = 6; */ long getUpdateDt(); // optional string extra = 7; /** * optional string extra = 7; */ boolean hasExtra(); /** * optional string extra = 7; */ java.lang.String getExtra(); /** * optional string extra = 7; */ com.google.protobuf.ByteString getExtraBytes(); // optional int32 state = 8; /** * optional int32 state = 8; */ boolean hasState(); /** * optional int32 state = 8; */ int getState(); } /** * Protobuf type {@code ChatroomInfo} */ public static final class ChatroomInfo extends com.google.protobuf.GeneratedMessage implements ChatroomInfoOrBuilder { // Use ChatroomInfo.newBuilder() to construct. private ChatroomInfo(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ChatroomInfo(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ChatroomInfo defaultInstance; public static ChatroomInfo getDefaultInstance() { return defaultInstance; } public ChatroomInfo getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ChatroomInfo( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; title_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; desc_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; portrait_ = input.readBytes(); break; } case 32: { bitField0_ |= 0x00000008; memberCount_ = input.readInt32(); break; } case 40: { bitField0_ |= 0x00000010; createDt_ = input.readInt64(); break; } case 48: { bitField0_ |= 0x00000020; updateDt_ = input.readInt64(); break; } case 58: { bitField0_ |= 0x00000040; extra_ = input.readBytes(); break; } case 64: { bitField0_ |= 0x00000080; state_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChatroomInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChatroomInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ChatroomInfo.class, cn.wildfirechat.proto.WFCMessage.ChatroomInfo.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ChatroomInfo parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ChatroomInfo(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string title = 1; public static final int TITLE_FIELD_NUMBER = 1; private java.lang.Object title_; /** * required string title = 1; */ public boolean hasTitle() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string title = 1; */ public java.lang.String getTitle() { java.lang.Object ref = title_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { title_ = s; } return s; } } /** * required string title = 1; */ public com.google.protobuf.ByteString getTitleBytes() { java.lang.Object ref = title_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); title_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string desc = 2; public static final int DESC_FIELD_NUMBER = 2; private java.lang.Object desc_; /** * optional string desc = 2; */ public boolean hasDesc() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional string desc = 2; */ public java.lang.String getDesc() { java.lang.Object ref = desc_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { desc_ = s; } return s; } } /** * optional string desc = 2; */ public com.google.protobuf.ByteString getDescBytes() { java.lang.Object ref = desc_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); desc_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string portrait = 3; public static final int PORTRAIT_FIELD_NUMBER = 3; private java.lang.Object portrait_; /** * optional string portrait = 3; */ public boolean hasPortrait() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string portrait = 3; */ public java.lang.String getPortrait() { java.lang.Object ref = portrait_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { portrait_ = s; } return s; } } /** * optional string portrait = 3; */ public com.google.protobuf.ByteString getPortraitBytes() { java.lang.Object ref = portrait_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); portrait_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 member_count = 4; public static final int MEMBER_COUNT_FIELD_NUMBER = 4; private int memberCount_; /** * optional int32 member_count = 4; */ public boolean hasMemberCount() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int32 member_count = 4; */ public int getMemberCount() { return memberCount_; } // optional int64 create_dt = 5; public static final int CREATE_DT_FIELD_NUMBER = 5; private long createDt_; /** * optional int64 create_dt = 5; */ public boolean hasCreateDt() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int64 create_dt = 5; */ public long getCreateDt() { return createDt_; } // optional int64 update_dt = 6; public static final int UPDATE_DT_FIELD_NUMBER = 6; private long updateDt_; /** * optional int64 update_dt = 6; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional int64 update_dt = 6; */ public long getUpdateDt() { return updateDt_; } // optional string extra = 7; public static final int EXTRA_FIELD_NUMBER = 7; private java.lang.Object extra_; /** * optional string extra = 7; */ public boolean hasExtra() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string extra = 7; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { extra_ = s; } return s; } } /** * optional string extra = 7; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 state = 8; public static final int STATE_FIELD_NUMBER = 8; private int state_; /** * optional int32 state = 8; */ public boolean hasState() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional int32 state = 8; */ public int getState() { return state_; } private void initFields() { title_ = ""; desc_ = ""; portrait_ = ""; memberCount_ = 0; createDt_ = 0L; updateDt_ = 0L; extra_ = ""; state_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTitle()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTitleBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getDescBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getPortraitBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeInt32(4, memberCount_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeInt64(5, createDt_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeInt64(6, updateDt_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, getExtraBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeInt32(8, state_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTitleBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getDescBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getPortraitBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(4, memberCount_); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(5, createDt_); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(6, updateDt_); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(7, getExtraBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(8, state_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ChatroomInfo parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ChatroomInfo parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChatroomInfo parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ChatroomInfo parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChatroomInfo parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChatroomInfo parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChatroomInfo parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChatroomInfo parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChatroomInfo parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChatroomInfo parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ChatroomInfo prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ChatroomInfo} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ChatroomInfoOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChatroomInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChatroomInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ChatroomInfo.class, cn.wildfirechat.proto.WFCMessage.ChatroomInfo.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ChatroomInfo.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); title_ = ""; bitField0_ = (bitField0_ & ~0x00000001); desc_ = ""; bitField0_ = (bitField0_ & ~0x00000002); portrait_ = ""; bitField0_ = (bitField0_ & ~0x00000004); memberCount_ = 0; bitField0_ = (bitField0_ & ~0x00000008); createDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000010); updateDt_ = 0L; bitField0_ = (bitField0_ & ~0x00000020); extra_ = ""; bitField0_ = (bitField0_ & ~0x00000040); state_ = 0; bitField0_ = (bitField0_ & ~0x00000080); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChatroomInfo_descriptor; } public cn.wildfirechat.proto.WFCMessage.ChatroomInfo getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ChatroomInfo.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ChatroomInfo build() { cn.wildfirechat.proto.WFCMessage.ChatroomInfo result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ChatroomInfo buildPartial() { cn.wildfirechat.proto.WFCMessage.ChatroomInfo result = new cn.wildfirechat.proto.WFCMessage.ChatroomInfo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.title_ = title_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.desc_ = desc_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.portrait_ = portrait_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.memberCount_ = memberCount_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.createDt_ = createDt_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.updateDt_ = updateDt_; if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000040; } result.extra_ = extra_; if (((from_bitField0_ & 0x00000080) == 0x00000080)) { to_bitField0_ |= 0x00000080; } result.state_ = state_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ChatroomInfo) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ChatroomInfo)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ChatroomInfo other) { if (other == cn.wildfirechat.proto.WFCMessage.ChatroomInfo.getDefaultInstance()) return this; if (other.hasTitle()) { bitField0_ |= 0x00000001; title_ = other.title_; onChanged(); } if (other.hasDesc()) { bitField0_ |= 0x00000002; desc_ = other.desc_; onChanged(); } if (other.hasPortrait()) { bitField0_ |= 0x00000004; portrait_ = other.portrait_; onChanged(); } if (other.hasMemberCount()) { setMemberCount(other.getMemberCount()); } if (other.hasCreateDt()) { setCreateDt(other.getCreateDt()); } if (other.hasUpdateDt()) { setUpdateDt(other.getUpdateDt()); } if (other.hasExtra()) { bitField0_ |= 0x00000040; extra_ = other.extra_; onChanged(); } if (other.hasState()) { setState(other.getState()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTitle()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ChatroomInfo parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ChatroomInfo) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string title = 1; private java.lang.Object title_ = ""; /** * required string title = 1; */ public boolean hasTitle() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string title = 1; */ public java.lang.String getTitle() { java.lang.Object ref = title_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); title_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string title = 1; */ public com.google.protobuf.ByteString getTitleBytes() { java.lang.Object ref = title_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); title_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string title = 1; */ public Builder setTitle( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; title_ = value; onChanged(); return this; } /** * required string title = 1; */ public Builder clearTitle() { bitField0_ = (bitField0_ & ~0x00000001); title_ = getDefaultInstance().getTitle(); onChanged(); return this; } /** * required string title = 1; */ public Builder setTitleBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; title_ = value; onChanged(); return this; } // optional string desc = 2; private java.lang.Object desc_ = ""; /** * optional string desc = 2; */ public boolean hasDesc() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional string desc = 2; */ public java.lang.String getDesc() { java.lang.Object ref = desc_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); desc_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string desc = 2; */ public com.google.protobuf.ByteString getDescBytes() { java.lang.Object ref = desc_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); desc_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string desc = 2; */ public Builder setDesc( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; desc_ = value; onChanged(); return this; } /** * optional string desc = 2; */ public Builder clearDesc() { bitField0_ = (bitField0_ & ~0x00000002); desc_ = getDefaultInstance().getDesc(); onChanged(); return this; } /** * optional string desc = 2; */ public Builder setDescBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; desc_ = value; onChanged(); return this; } // optional string portrait = 3; private java.lang.Object portrait_ = ""; /** * optional string portrait = 3; */ public boolean hasPortrait() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional string portrait = 3; */ public java.lang.String getPortrait() { java.lang.Object ref = portrait_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); portrait_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string portrait = 3; */ public com.google.protobuf.ByteString getPortraitBytes() { java.lang.Object ref = portrait_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); portrait_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string portrait = 3; */ public Builder setPortrait( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; portrait_ = value; onChanged(); return this; } /** * optional string portrait = 3; */ public Builder clearPortrait() { bitField0_ = (bitField0_ & ~0x00000004); portrait_ = getDefaultInstance().getPortrait(); onChanged(); return this; } /** * optional string portrait = 3; */ public Builder setPortraitBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; portrait_ = value; onChanged(); return this; } // optional int32 member_count = 4; private int memberCount_ ; /** * optional int32 member_count = 4; */ public boolean hasMemberCount() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional int32 member_count = 4; */ public int getMemberCount() { return memberCount_; } /** * optional int32 member_count = 4; */ public Builder setMemberCount(int value) { bitField0_ |= 0x00000008; memberCount_ = value; onChanged(); return this; } /** * optional int32 member_count = 4; */ public Builder clearMemberCount() { bitField0_ = (bitField0_ & ~0x00000008); memberCount_ = 0; onChanged(); return this; } // optional int64 create_dt = 5; private long createDt_ ; /** * optional int64 create_dt = 5; */ public boolean hasCreateDt() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional int64 create_dt = 5; */ public long getCreateDt() { return createDt_; } /** * optional int64 create_dt = 5; */ public Builder setCreateDt(long value) { bitField0_ |= 0x00000010; createDt_ = value; onChanged(); return this; } /** * optional int64 create_dt = 5; */ public Builder clearCreateDt() { bitField0_ = (bitField0_ & ~0x00000010); createDt_ = 0L; onChanged(); return this; } // optional int64 update_dt = 6; private long updateDt_ ; /** * optional int64 update_dt = 6; */ public boolean hasUpdateDt() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional int64 update_dt = 6; */ public long getUpdateDt() { return updateDt_; } /** * optional int64 update_dt = 6; */ public Builder setUpdateDt(long value) { bitField0_ |= 0x00000020; updateDt_ = value; onChanged(); return this; } /** * optional int64 update_dt = 6; */ public Builder clearUpdateDt() { bitField0_ = (bitField0_ & ~0x00000020); updateDt_ = 0L; onChanged(); return this; } // optional string extra = 7; private java.lang.Object extra_ = ""; /** * optional string extra = 7; */ public boolean hasExtra() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string extra = 7; */ public java.lang.String getExtra() { java.lang.Object ref = extra_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); extra_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string extra = 7; */ public com.google.protobuf.ByteString getExtraBytes() { java.lang.Object ref = extra_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); extra_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string extra = 7; */ public Builder setExtra( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; extra_ = value; onChanged(); return this; } /** * optional string extra = 7; */ public Builder clearExtra() { bitField0_ = (bitField0_ & ~0x00000040); extra_ = getDefaultInstance().getExtra(); onChanged(); return this; } /** * optional string extra = 7; */ public Builder setExtraBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; extra_ = value; onChanged(); return this; } // optional int32 state = 8; private int state_ ; /** * optional int32 state = 8; */ public boolean hasState() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional int32 state = 8; */ public int getState() { return state_; } /** * optional int32 state = 8; */ public Builder setState(int value) { bitField0_ |= 0x00000080; state_ = value; onChanged(); return this; } /** * optional int32 state = 8; */ public Builder clearState() { bitField0_ = (bitField0_ & ~0x00000080); state_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:ChatroomInfo) } static { defaultInstance = new ChatroomInfo(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ChatroomInfo) } public interface GetChatroomMemberInfoRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string chatroom_id = 1; /** * required string chatroom_id = 1; */ boolean hasChatroomId(); /** * required string chatroom_id = 1; */ java.lang.String getChatroomId(); /** * required string chatroom_id = 1; */ com.google.protobuf.ByteString getChatroomIdBytes(); // optional int32 max_count = 2; /** * optional int32 max_count = 2; */ boolean hasMaxCount(); /** * optional int32 max_count = 2; */ int getMaxCount(); } /** * Protobuf type {@code GetChatroomMemberInfoRequest} */ public static final class GetChatroomMemberInfoRequest extends com.google.protobuf.GeneratedMessage implements GetChatroomMemberInfoRequestOrBuilder { // Use GetChatroomMemberInfoRequest.newBuilder() to construct. private GetChatroomMemberInfoRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private GetChatroomMemberInfoRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final GetChatroomMemberInfoRequest defaultInstance; public static GetChatroomMemberInfoRequest getDefaultInstance() { return defaultInstance; } public GetChatroomMemberInfoRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GetChatroomMemberInfoRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; chatroomId_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; maxCount_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetChatroomMemberInfoRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetChatroomMemberInfoRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest.class, cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public GetChatroomMemberInfoRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GetChatroomMemberInfoRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string chatroom_id = 1; public static final int CHATROOM_ID_FIELD_NUMBER = 1; private java.lang.Object chatroomId_; /** * required string chatroom_id = 1; */ public boolean hasChatroomId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string chatroom_id = 1; */ public java.lang.String getChatroomId() { java.lang.Object ref = chatroomId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { chatroomId_ = s; } return s; } } /** * required string chatroom_id = 1; */ public com.google.protobuf.ByteString getChatroomIdBytes() { java.lang.Object ref = chatroomId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); chatroomId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 max_count = 2; public static final int MAX_COUNT_FIELD_NUMBER = 2; private int maxCount_; /** * optional int32 max_count = 2; */ public boolean hasMaxCount() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional int32 max_count = 2; */ public int getMaxCount() { return maxCount_; } private void initFields() { chatroomId_ = ""; maxCount_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasChatroomId()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getChatroomIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, maxCount_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getChatroomIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, maxCount_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code GetChatroomMemberInfoRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetChatroomMemberInfoRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetChatroomMemberInfoRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest.class, cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); chatroomId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); maxCount_ = 0; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetChatroomMemberInfoRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest build() { cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest result = new cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.chatroomId_ = chatroomId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.maxCount_ = maxCount_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest.getDefaultInstance()) return this; if (other.hasChatroomId()) { bitField0_ |= 0x00000001; chatroomId_ = other.chatroomId_; onChanged(); } if (other.hasMaxCount()) { setMaxCount(other.getMaxCount()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasChatroomId()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.GetChatroomMemberInfoRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string chatroom_id = 1; private java.lang.Object chatroomId_ = ""; /** * required string chatroom_id = 1; */ public boolean hasChatroomId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string chatroom_id = 1; */ public java.lang.String getChatroomId() { java.lang.Object ref = chatroomId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); chatroomId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string chatroom_id = 1; */ public com.google.protobuf.ByteString getChatroomIdBytes() { java.lang.Object ref = chatroomId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); chatroomId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string chatroom_id = 1; */ public Builder setChatroomId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; chatroomId_ = value; onChanged(); return this; } /** * required string chatroom_id = 1; */ public Builder clearChatroomId() { bitField0_ = (bitField0_ & ~0x00000001); chatroomId_ = getDefaultInstance().getChatroomId(); onChanged(); return this; } /** * required string chatroom_id = 1; */ public Builder setChatroomIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; chatroomId_ = value; onChanged(); return this; } // optional int32 max_count = 2; private int maxCount_ ; /** * optional int32 max_count = 2; */ public boolean hasMaxCount() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional int32 max_count = 2; */ public int getMaxCount() { return maxCount_; } /** * optional int32 max_count = 2; */ public Builder setMaxCount(int value) { bitField0_ |= 0x00000002; maxCount_ = value; onChanged(); return this; } /** * optional int32 max_count = 2; */ public Builder clearMaxCount() { bitField0_ = (bitField0_ & ~0x00000002); maxCount_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:GetChatroomMemberInfoRequest) } static { defaultInstance = new GetChatroomMemberInfoRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:GetChatroomMemberInfoRequest) } public interface ChatroomMemberInfoOrBuilder extends com.google.protobuf.MessageOrBuilder { // optional int32 member_count = 1; /** * optional int32 member_count = 1; */ boolean hasMemberCount(); /** * optional int32 member_count = 1; */ int getMemberCount(); // repeated string members = 2; /** * repeated string members = 2; */ java.util.List getMembersList(); /** * repeated string members = 2; */ int getMembersCount(); /** * repeated string members = 2; */ java.lang.String getMembers(int index); /** * repeated string members = 2; */ com.google.protobuf.ByteString getMembersBytes(int index); } /** * Protobuf type {@code ChatroomMemberInfo} */ public static final class ChatroomMemberInfo extends com.google.protobuf.GeneratedMessage implements ChatroomMemberInfoOrBuilder { // Use ChatroomMemberInfo.newBuilder() to construct. private ChatroomMemberInfo(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ChatroomMemberInfo(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ChatroomMemberInfo defaultInstance; public static ChatroomMemberInfo getDefaultInstance() { return defaultInstance; } public ChatroomMemberInfo getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ChatroomMemberInfo( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; memberCount_ = input.readInt32(); break; } case 18: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { members_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000002; } members_.add(input.readBytes()); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { members_ = new com.google.protobuf.UnmodifiableLazyStringList(members_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChatroomMemberInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChatroomMemberInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo.class, cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ChatroomMemberInfo parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ChatroomMemberInfo(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // optional int32 member_count = 1; public static final int MEMBER_COUNT_FIELD_NUMBER = 1; private int memberCount_; /** * optional int32 member_count = 1; */ public boolean hasMemberCount() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * optional int32 member_count = 1; */ public int getMemberCount() { return memberCount_; } // repeated string members = 2; public static final int MEMBERS_FIELD_NUMBER = 2; private com.google.protobuf.LazyStringList members_; /** * repeated string members = 2; */ public java.util.List getMembersList() { return members_; } /** * repeated string members = 2; */ public int getMembersCount() { return members_.size(); } /** * repeated string members = 2; */ public java.lang.String getMembers(int index) { return members_.get(index); } /** * repeated string members = 2; */ public com.google.protobuf.ByteString getMembersBytes(int index) { return members_.getByteString(index); } private void initFields() { memberCount_ = 0; members_ = com.google.protobuf.LazyStringArrayList.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, memberCount_); } for (int i = 0; i < members_.size(); i++) { output.writeBytes(2, members_.getByteString(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, memberCount_); } { int dataSize = 0; for (int i = 0; i < members_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeBytesSizeNoTag(members_.getByteString(i)); } size += dataSize; size += 1 * getMembersList().size(); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ChatroomMemberInfo} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfoOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChatroomMemberInfo_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChatroomMemberInfo_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo.class, cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); memberCount_ = 0; bitField0_ = (bitField0_ & ~0x00000001); members_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ChatroomMemberInfo_descriptor; } public cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo build() { cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo buildPartial() { cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo result = new cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.memberCount_ = memberCount_; if (((bitField0_ & 0x00000002) == 0x00000002)) { members_ = new com.google.protobuf.UnmodifiableLazyStringList( members_); bitField0_ = (bitField0_ & ~0x00000002); } result.members_ = members_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo other) { if (other == cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo.getDefaultInstance()) return this; if (other.hasMemberCount()) { setMemberCount(other.getMemberCount()); } if (!other.members_.isEmpty()) { if (members_.isEmpty()) { members_ = other.members_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureMembersIsMutable(); members_.addAll(other.members_); } onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ChatroomMemberInfo) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // optional int32 member_count = 1; private int memberCount_ ; /** * optional int32 member_count = 1; */ public boolean hasMemberCount() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * optional int32 member_count = 1; */ public int getMemberCount() { return memberCount_; } /** * optional int32 member_count = 1; */ public Builder setMemberCount(int value) { bitField0_ |= 0x00000001; memberCount_ = value; onChanged(); return this; } /** * optional int32 member_count = 1; */ public Builder clearMemberCount() { bitField0_ = (bitField0_ & ~0x00000001); memberCount_ = 0; onChanged(); return this; } // repeated string members = 2; private com.google.protobuf.LazyStringList members_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureMembersIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { members_ = new com.google.protobuf.LazyStringArrayList(members_); bitField0_ |= 0x00000002; } } /** * repeated string members = 2; */ public java.util.List getMembersList() { return java.util.Collections.unmodifiableList(members_); } /** * repeated string members = 2; */ public int getMembersCount() { return members_.size(); } /** * repeated string members = 2; */ public java.lang.String getMembers(int index) { return members_.get(index); } /** * repeated string members = 2; */ public com.google.protobuf.ByteString getMembersBytes(int index) { return members_.getByteString(index); } /** * repeated string members = 2; */ public Builder setMembers( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureMembersIsMutable(); members_.set(index, value); onChanged(); return this; } /** * repeated string members = 2; */ public Builder addMembers( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureMembersIsMutable(); members_.add(value); onChanged(); return this; } /** * repeated string members = 2; */ public Builder addAllMembers( java.lang.Iterable values) { ensureMembersIsMutable(); super.addAll(values, members_); onChanged(); return this; } /** * repeated string members = 2; */ public Builder clearMembers() { members_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } /** * repeated string members = 2; */ public Builder addMembersBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } ensureMembersIsMutable(); members_.add(value); onChanged(); return this; } // @@protoc_insertion_point(builder_scope:ChatroomMemberInfo) } static { defaultInstance = new ChatroomMemberInfo(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ChatroomMemberInfo) } public interface INT64BufOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int64 id = 1; /** * required int64 id = 1; */ boolean hasId(); /** * required int64 id = 1; */ long getId(); } /** * Protobuf type {@code INT64Buf} */ public static final class INT64Buf extends com.google.protobuf.GeneratedMessage implements INT64BufOrBuilder { // Use INT64Buf.newBuilder() to construct. private INT64Buf(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private INT64Buf(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final INT64Buf defaultInstance; public static INT64Buf getDefaultInstance() { return defaultInstance; } public INT64Buf getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private INT64Buf( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; id_ = input.readInt64(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_INT64Buf_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_INT64Buf_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.INT64Buf.class, cn.wildfirechat.proto.WFCMessage.INT64Buf.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public INT64Buf parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new INT64Buf(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int64 id = 1; public static final int ID_FIELD_NUMBER = 1; private long id_; /** * required int64 id = 1; */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int64 id = 1; */ public long getId() { return id_; } private void initFields() { id_ = 0L; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasId()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt64(1, id_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(1, id_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.INT64Buf parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.INT64Buf parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.INT64Buf parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.INT64Buf parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.INT64Buf parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.INT64Buf parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.INT64Buf parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.INT64Buf parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.INT64Buf parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.INT64Buf parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.INT64Buf prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code INT64Buf} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.INT64BufOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_INT64Buf_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_INT64Buf_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.INT64Buf.class, cn.wildfirechat.proto.WFCMessage.INT64Buf.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.INT64Buf.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); id_ = 0L; bitField0_ = (bitField0_ & ~0x00000001); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_INT64Buf_descriptor; } public cn.wildfirechat.proto.WFCMessage.INT64Buf getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.INT64Buf.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.INT64Buf build() { cn.wildfirechat.proto.WFCMessage.INT64Buf result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.INT64Buf buildPartial() { cn.wildfirechat.proto.WFCMessage.INT64Buf result = new cn.wildfirechat.proto.WFCMessage.INT64Buf(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.id_ = id_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.INT64Buf) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.INT64Buf)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.INT64Buf other) { if (other == cn.wildfirechat.proto.WFCMessage.INT64Buf.getDefaultInstance()) return this; if (other.hasId()) { setId(other.getId()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasId()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.INT64Buf parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.INT64Buf) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int64 id = 1; private long id_ ; /** * required int64 id = 1; */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int64 id = 1; */ public long getId() { return id_; } /** * required int64 id = 1; */ public Builder setId(long value) { bitField0_ |= 0x00000001; id_ = value; onChanged(); return this; } /** * required int64 id = 1; */ public Builder clearId() { bitField0_ = (bitField0_ & ~0x00000001); id_ = 0L; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:INT64Buf) } static { defaultInstance = new INT64Buf(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:INT64Buf) } public interface NotifyRecallMessageOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int64 id = 1; /** * required int64 id = 1; */ boolean hasId(); /** * required int64 id = 1; */ long getId(); // required string from_user = 2; /** * required string from_user = 2; */ boolean hasFromUser(); /** * required string from_user = 2; */ java.lang.String getFromUser(); /** * required string from_user = 2; */ com.google.protobuf.ByteString getFromUserBytes(); } /** * Protobuf type {@code NotifyRecallMessage} */ public static final class NotifyRecallMessage extends com.google.protobuf.GeneratedMessage implements NotifyRecallMessageOrBuilder { // Use NotifyRecallMessage.newBuilder() to construct. private NotifyRecallMessage(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private NotifyRecallMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final NotifyRecallMessage defaultInstance; public static NotifyRecallMessage getDefaultInstance() { return defaultInstance; } public NotifyRecallMessage getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private NotifyRecallMessage( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; id_ = input.readInt64(); break; } case 18: { bitField0_ |= 0x00000002; fromUser_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_NotifyRecallMessage_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_NotifyRecallMessage_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage.class, cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public NotifyRecallMessage parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new NotifyRecallMessage(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int64 id = 1; public static final int ID_FIELD_NUMBER = 1; private long id_; /** * required int64 id = 1; */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int64 id = 1; */ public long getId() { return id_; } // required string from_user = 2; public static final int FROM_USER_FIELD_NUMBER = 2; private java.lang.Object fromUser_; /** * required string from_user = 2; */ public boolean hasFromUser() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string from_user = 2; */ public java.lang.String getFromUser() { java.lang.Object ref = fromUser_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { fromUser_ = s; } return s; } } /** * required string from_user = 2; */ public com.google.protobuf.ByteString getFromUserBytes() { java.lang.Object ref = fromUser_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); fromUser_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { id_ = 0L; fromUser_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasId()) { memoizedIsInitialized = 0; return false; } if (!hasFromUser()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt64(1, id_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getFromUserBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(1, id_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getFromUserBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code NotifyRecallMessage} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.NotifyRecallMessageOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_NotifyRecallMessage_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_NotifyRecallMessage_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage.class, cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); id_ = 0L; bitField0_ = (bitField0_ & ~0x00000001); fromUser_ = ""; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_NotifyRecallMessage_descriptor; } public cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage build() { cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage buildPartial() { cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage result = new cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.id_ = id_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.fromUser_ = fromUser_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage other) { if (other == cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage.getDefaultInstance()) return this; if (other.hasId()) { setId(other.getId()); } if (other.hasFromUser()) { bitField0_ |= 0x00000002; fromUser_ = other.fromUser_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasId()) { return false; } if (!hasFromUser()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.NotifyRecallMessage) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int64 id = 1; private long id_ ; /** * required int64 id = 1; */ public boolean hasId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int64 id = 1; */ public long getId() { return id_; } /** * required int64 id = 1; */ public Builder setId(long value) { bitField0_ |= 0x00000001; id_ = value; onChanged(); return this; } /** * required int64 id = 1; */ public Builder clearId() { bitField0_ = (bitField0_ & ~0x00000001); id_ = 0L; onChanged(); return this; } // required string from_user = 2; private java.lang.Object fromUser_ = ""; /** * required string from_user = 2; */ public boolean hasFromUser() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string from_user = 2; */ public java.lang.String getFromUser() { java.lang.Object ref = fromUser_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); fromUser_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string from_user = 2; */ public com.google.protobuf.ByteString getFromUserBytes() { java.lang.Object ref = fromUser_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); fromUser_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string from_user = 2; */ public Builder setFromUser( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; fromUser_ = value; onChanged(); return this; } /** * required string from_user = 2; */ public Builder clearFromUser() { bitField0_ = (bitField0_ & ~0x00000002); fromUser_ = getDefaultInstance().getFromUser(); onChanged(); return this; } /** * required string from_user = 2; */ public Builder setFromUserBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; fromUser_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:NotifyRecallMessage) } static { defaultInstance = new NotifyRecallMessage(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:NotifyRecallMessage) } public interface BlackUserRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string uid = 1; /** * required string uid = 1; */ boolean hasUid(); /** * required string uid = 1; */ java.lang.String getUid(); /** * required string uid = 1; */ com.google.protobuf.ByteString getUidBytes(); // required int32 status = 2; /** * required int32 status = 2; */ boolean hasStatus(); /** * required int32 status = 2; */ int getStatus(); } /** * Protobuf type {@code BlackUserRequest} */ public static final class BlackUserRequest extends com.google.protobuf.GeneratedMessage implements BlackUserRequestOrBuilder { // Use BlackUserRequest.newBuilder() to construct. private BlackUserRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private BlackUserRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final BlackUserRequest defaultInstance; public static BlackUserRequest getDefaultInstance() { return defaultInstance; } public BlackUserRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private BlackUserRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; uid_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; status_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_BlackUserRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_BlackUserRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.BlackUserRequest.class, cn.wildfirechat.proto.WFCMessage.BlackUserRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public BlackUserRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new BlackUserRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string uid = 1; public static final int UID_FIELD_NUMBER = 1; private java.lang.Object uid_; /** * required string uid = 1; */ public boolean hasUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string uid = 1; */ public java.lang.String getUid() { java.lang.Object ref = uid_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { uid_ = s; } return s; } } /** * required string uid = 1; */ public com.google.protobuf.ByteString getUidBytes() { java.lang.Object ref = uid_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); uid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 status = 2; public static final int STATUS_FIELD_NUMBER = 2; private int status_; /** * required int32 status = 2; */ public boolean hasStatus() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 status = 2; */ public int getStatus() { return status_; } private void initFields() { uid_ = ""; status_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasUid()) { memoizedIsInitialized = 0; return false; } if (!hasStatus()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, status_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getUidBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, status_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.BlackUserRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.BlackUserRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.BlackUserRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.BlackUserRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.BlackUserRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.BlackUserRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.BlackUserRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.BlackUserRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.BlackUserRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.BlackUserRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.BlackUserRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code BlackUserRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.BlackUserRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_BlackUserRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_BlackUserRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.BlackUserRequest.class, cn.wildfirechat.proto.WFCMessage.BlackUserRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.BlackUserRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); uid_ = ""; bitField0_ = (bitField0_ & ~0x00000001); status_ = 0; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_BlackUserRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.BlackUserRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.BlackUserRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.BlackUserRequest build() { cn.wildfirechat.proto.WFCMessage.BlackUserRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.BlackUserRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.BlackUserRequest result = new cn.wildfirechat.proto.WFCMessage.BlackUserRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.uid_ = uid_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.status_ = status_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.BlackUserRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.BlackUserRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.BlackUserRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.BlackUserRequest.getDefaultInstance()) return this; if (other.hasUid()) { bitField0_ |= 0x00000001; uid_ = other.uid_; onChanged(); } if (other.hasStatus()) { setStatus(other.getStatus()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasUid()) { return false; } if (!hasStatus()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.BlackUserRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.BlackUserRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string uid = 1; private java.lang.Object uid_ = ""; /** * required string uid = 1; */ public boolean hasUid() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string uid = 1; */ public java.lang.String getUid() { java.lang.Object ref = uid_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); uid_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string uid = 1; */ public com.google.protobuf.ByteString getUidBytes() { java.lang.Object ref = uid_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); uid_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string uid = 1; */ public Builder setUid( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; uid_ = value; onChanged(); return this; } /** * required string uid = 1; */ public Builder clearUid() { bitField0_ = (bitField0_ & ~0x00000001); uid_ = getDefaultInstance().getUid(); onChanged(); return this; } /** * required string uid = 1; */ public Builder setUidBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; uid_ = value; onChanged(); return this; } // required int32 status = 2; private int status_ ; /** * required int32 status = 2; */ public boolean hasStatus() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 status = 2; */ public int getStatus() { return status_; } /** * required int32 status = 2; */ public Builder setStatus(int value) { bitField0_ |= 0x00000002; status_ = value; onChanged(); return this; } /** * required int32 status = 2; */ public Builder clearStatus() { bitField0_ = (bitField0_ & ~0x00000002); status_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:BlackUserRequest) } static { defaultInstance = new BlackUserRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:BlackUserRequest) } public interface RouteRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // optional string app = 1; /** * optional string app = 1; */ boolean hasApp(); /** * optional string app = 1; */ java.lang.String getApp(); /** * optional string app = 1; */ com.google.protobuf.ByteString getAppBytes(); // optional int32 platform = 2; /** * optional int32 platform = 2; */ boolean hasPlatform(); /** * optional int32 platform = 2; */ int getPlatform(); // optional int32 push_type = 3; /** * optional int32 push_type = 3; */ boolean hasPushType(); /** * optional int32 push_type = 3; */ int getPushType(); // optional string device_name = 4; /** * optional string device_name = 4; */ boolean hasDeviceName(); /** * optional string device_name = 4; */ java.lang.String getDeviceName(); /** * optional string device_name = 4; */ com.google.protobuf.ByteString getDeviceNameBytes(); // optional string device_version = 5; /** * optional string device_version = 5; */ boolean hasDeviceVersion(); /** * optional string device_version = 5; */ java.lang.String getDeviceVersion(); /** * optional string device_version = 5; */ com.google.protobuf.ByteString getDeviceVersionBytes(); // optional string phone_name = 6; /** * optional string phone_name = 6; */ boolean hasPhoneName(); /** * optional string phone_name = 6; */ java.lang.String getPhoneName(); /** * optional string phone_name = 6; */ com.google.protobuf.ByteString getPhoneNameBytes(); // optional string language = 7; /** * optional string language = 7; */ boolean hasLanguage(); /** * optional string language = 7; */ java.lang.String getLanguage(); /** * optional string language = 7; */ com.google.protobuf.ByteString getLanguageBytes(); // optional string carrier_name = 8; /** * optional string carrier_name = 8; */ boolean hasCarrierName(); /** * optional string carrier_name = 8; */ java.lang.String getCarrierName(); /** * optional string carrier_name = 8; */ com.google.protobuf.ByteString getCarrierNameBytes(); // optional string app_version = 9; /** * optional string app_version = 9; */ boolean hasAppVersion(); /** * optional string app_version = 9; */ java.lang.String getAppVersion(); /** * optional string app_version = 9; */ com.google.protobuf.ByteString getAppVersionBytes(); // optional string sdk_version = 10; /** * optional string sdk_version = 10; */ boolean hasSdkVersion(); /** * optional string sdk_version = 10; */ java.lang.String getSdkVersion(); /** * optional string sdk_version = 10; */ com.google.protobuf.ByteString getSdkVersionBytes(); } /** * Protobuf type {@code RouteRequest} */ public static final class RouteRequest extends com.google.protobuf.GeneratedMessage implements RouteRequestOrBuilder { // Use RouteRequest.newBuilder() to construct. private RouteRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private RouteRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final RouteRequest defaultInstance; public static RouteRequest getDefaultInstance() { return defaultInstance; } public RouteRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private RouteRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; app_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; platform_ = input.readInt32(); break; } case 24: { bitField0_ |= 0x00000004; pushType_ = input.readInt32(); break; } case 34: { bitField0_ |= 0x00000008; deviceName_ = input.readBytes(); break; } case 42: { bitField0_ |= 0x00000010; deviceVersion_ = input.readBytes(); break; } case 50: { bitField0_ |= 0x00000020; phoneName_ = input.readBytes(); break; } case 58: { bitField0_ |= 0x00000040; language_ = input.readBytes(); break; } case 66: { bitField0_ |= 0x00000080; carrierName_ = input.readBytes(); break; } case 74: { bitField0_ |= 0x00000100; appVersion_ = input.readBytes(); break; } case 82: { bitField0_ |= 0x00000200; sdkVersion_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_RouteRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_RouteRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.RouteRequest.class, cn.wildfirechat.proto.WFCMessage.RouteRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public RouteRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new RouteRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // optional string app = 1; public static final int APP_FIELD_NUMBER = 1; private java.lang.Object app_; /** * optional string app = 1; */ public boolean hasApp() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * optional string app = 1; */ public java.lang.String getApp() { java.lang.Object ref = app_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { app_ = s; } return s; } } /** * optional string app = 1; */ public com.google.protobuf.ByteString getAppBytes() { java.lang.Object ref = app_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); app_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 platform = 2; public static final int PLATFORM_FIELD_NUMBER = 2; private int platform_; /** * optional int32 platform = 2; */ public boolean hasPlatform() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional int32 platform = 2; */ public int getPlatform() { return platform_; } // optional int32 push_type = 3; public static final int PUSH_TYPE_FIELD_NUMBER = 3; private int pushType_; /** * optional int32 push_type = 3; */ public boolean hasPushType() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int32 push_type = 3; */ public int getPushType() { return pushType_; } // optional string device_name = 4; public static final int DEVICE_NAME_FIELD_NUMBER = 4; private java.lang.Object deviceName_; /** * optional string device_name = 4; */ public boolean hasDeviceName() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string device_name = 4; */ public java.lang.String getDeviceName() { java.lang.Object ref = deviceName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { deviceName_ = s; } return s; } } /** * optional string device_name = 4; */ public com.google.protobuf.ByteString getDeviceNameBytes() { java.lang.Object ref = deviceName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); deviceName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string device_version = 5; public static final int DEVICE_VERSION_FIELD_NUMBER = 5; private java.lang.Object deviceVersion_; /** * optional string device_version = 5; */ public boolean hasDeviceVersion() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string device_version = 5; */ public java.lang.String getDeviceVersion() { java.lang.Object ref = deviceVersion_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { deviceVersion_ = s; } return s; } } /** * optional string device_version = 5; */ public com.google.protobuf.ByteString getDeviceVersionBytes() { java.lang.Object ref = deviceVersion_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); deviceVersion_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string phone_name = 6; public static final int PHONE_NAME_FIELD_NUMBER = 6; private java.lang.Object phoneName_; /** * optional string phone_name = 6; */ public boolean hasPhoneName() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string phone_name = 6; */ public java.lang.String getPhoneName() { java.lang.Object ref = phoneName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { phoneName_ = s; } return s; } } /** * optional string phone_name = 6; */ public com.google.protobuf.ByteString getPhoneNameBytes() { java.lang.Object ref = phoneName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); phoneName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string language = 7; public static final int LANGUAGE_FIELD_NUMBER = 7; private java.lang.Object language_; /** * optional string language = 7; */ public boolean hasLanguage() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string language = 7; */ public java.lang.String getLanguage() { java.lang.Object ref = language_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { language_ = s; } return s; } } /** * optional string language = 7; */ public com.google.protobuf.ByteString getLanguageBytes() { java.lang.Object ref = language_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); language_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string carrier_name = 8; public static final int CARRIER_NAME_FIELD_NUMBER = 8; private java.lang.Object carrierName_; /** * optional string carrier_name = 8; */ public boolean hasCarrierName() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional string carrier_name = 8; */ public java.lang.String getCarrierName() { java.lang.Object ref = carrierName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { carrierName_ = s; } return s; } } /** * optional string carrier_name = 8; */ public com.google.protobuf.ByteString getCarrierNameBytes() { java.lang.Object ref = carrierName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); carrierName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string app_version = 9; public static final int APP_VERSION_FIELD_NUMBER = 9; private java.lang.Object appVersion_; /** * optional string app_version = 9; */ public boolean hasAppVersion() { return ((bitField0_ & 0x00000100) == 0x00000100); } /** * optional string app_version = 9; */ public java.lang.String getAppVersion() { java.lang.Object ref = appVersion_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { appVersion_ = s; } return s; } } /** * optional string app_version = 9; */ public com.google.protobuf.ByteString getAppVersionBytes() { java.lang.Object ref = appVersion_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); appVersion_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string sdk_version = 10; public static final int SDK_VERSION_FIELD_NUMBER = 10; private java.lang.Object sdkVersion_; /** * optional string sdk_version = 10; */ public boolean hasSdkVersion() { return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional string sdk_version = 10; */ public java.lang.String getSdkVersion() { java.lang.Object ref = sdkVersion_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { sdkVersion_ = s; } return s; } } /** * optional string sdk_version = 10; */ public com.google.protobuf.ByteString getSdkVersionBytes() { java.lang.Object ref = sdkVersion_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); sdkVersion_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { app_ = ""; platform_ = 0; pushType_ = 0; deviceName_ = ""; deviceVersion_ = ""; phoneName_ = ""; language_ = ""; carrierName_ = ""; appVersion_ = ""; sdkVersion_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getAppBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, platform_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(3, pushType_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getDeviceNameBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBytes(5, getDeviceVersionBytes()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { output.writeBytes(6, getPhoneNameBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { output.writeBytes(7, getLanguageBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { output.writeBytes(8, getCarrierNameBytes()); } if (((bitField0_ & 0x00000100) == 0x00000100)) { output.writeBytes(9, getAppVersionBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { output.writeBytes(10, getSdkVersionBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getAppBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, platform_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(3, pushType_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getDeviceNameBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(5, getDeviceVersionBytes()); } if (((bitField0_ & 0x00000020) == 0x00000020)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(6, getPhoneNameBytes()); } if (((bitField0_ & 0x00000040) == 0x00000040)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(7, getLanguageBytes()); } if (((bitField0_ & 0x00000080) == 0x00000080)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(8, getCarrierNameBytes()); } if (((bitField0_ & 0x00000100) == 0x00000100)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(9, getAppVersionBytes()); } if (((bitField0_ & 0x00000200) == 0x00000200)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(10, getSdkVersionBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.RouteRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.RouteRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RouteRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.RouteRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RouteRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.RouteRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RouteRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.RouteRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RouteRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.RouteRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.RouteRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code RouteRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.RouteRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_RouteRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_RouteRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.RouteRequest.class, cn.wildfirechat.proto.WFCMessage.RouteRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.RouteRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); app_ = ""; bitField0_ = (bitField0_ & ~0x00000001); platform_ = 0; bitField0_ = (bitField0_ & ~0x00000002); pushType_ = 0; bitField0_ = (bitField0_ & ~0x00000004); deviceName_ = ""; bitField0_ = (bitField0_ & ~0x00000008); deviceVersion_ = ""; bitField0_ = (bitField0_ & ~0x00000010); phoneName_ = ""; bitField0_ = (bitField0_ & ~0x00000020); language_ = ""; bitField0_ = (bitField0_ & ~0x00000040); carrierName_ = ""; bitField0_ = (bitField0_ & ~0x00000080); appVersion_ = ""; bitField0_ = (bitField0_ & ~0x00000100); sdkVersion_ = ""; bitField0_ = (bitField0_ & ~0x00000200); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_RouteRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.RouteRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.RouteRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.RouteRequest build() { cn.wildfirechat.proto.WFCMessage.RouteRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.RouteRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.RouteRequest result = new cn.wildfirechat.proto.WFCMessage.RouteRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.app_ = app_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.platform_ = platform_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.pushType_ = pushType_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.deviceName_ = deviceName_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.deviceVersion_ = deviceVersion_; if (((from_bitField0_ & 0x00000020) == 0x00000020)) { to_bitField0_ |= 0x00000020; } result.phoneName_ = phoneName_; if (((from_bitField0_ & 0x00000040) == 0x00000040)) { to_bitField0_ |= 0x00000040; } result.language_ = language_; if (((from_bitField0_ & 0x00000080) == 0x00000080)) { to_bitField0_ |= 0x00000080; } result.carrierName_ = carrierName_; if (((from_bitField0_ & 0x00000100) == 0x00000100)) { to_bitField0_ |= 0x00000100; } result.appVersion_ = appVersion_; if (((from_bitField0_ & 0x00000200) == 0x00000200)) { to_bitField0_ |= 0x00000200; } result.sdkVersion_ = sdkVersion_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.RouteRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.RouteRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.RouteRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.RouteRequest.getDefaultInstance()) return this; if (other.hasApp()) { bitField0_ |= 0x00000001; app_ = other.app_; onChanged(); } if (other.hasPlatform()) { setPlatform(other.getPlatform()); } if (other.hasPushType()) { setPushType(other.getPushType()); } if (other.hasDeviceName()) { bitField0_ |= 0x00000008; deviceName_ = other.deviceName_; onChanged(); } if (other.hasDeviceVersion()) { bitField0_ |= 0x00000010; deviceVersion_ = other.deviceVersion_; onChanged(); } if (other.hasPhoneName()) { bitField0_ |= 0x00000020; phoneName_ = other.phoneName_; onChanged(); } if (other.hasLanguage()) { bitField0_ |= 0x00000040; language_ = other.language_; onChanged(); } if (other.hasCarrierName()) { bitField0_ |= 0x00000080; carrierName_ = other.carrierName_; onChanged(); } if (other.hasAppVersion()) { bitField0_ |= 0x00000100; appVersion_ = other.appVersion_; onChanged(); } if (other.hasSdkVersion()) { bitField0_ |= 0x00000200; sdkVersion_ = other.sdkVersion_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.RouteRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.RouteRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // optional string app = 1; private java.lang.Object app_ = ""; /** * optional string app = 1; */ public boolean hasApp() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * optional string app = 1; */ public java.lang.String getApp() { java.lang.Object ref = app_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); app_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string app = 1; */ public com.google.protobuf.ByteString getAppBytes() { java.lang.Object ref = app_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); app_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string app = 1; */ public Builder setApp( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; app_ = value; onChanged(); return this; } /** * optional string app = 1; */ public Builder clearApp() { bitField0_ = (bitField0_ & ~0x00000001); app_ = getDefaultInstance().getApp(); onChanged(); return this; } /** * optional string app = 1; */ public Builder setAppBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; app_ = value; onChanged(); return this; } // optional int32 platform = 2; private int platform_ ; /** * optional int32 platform = 2; */ public boolean hasPlatform() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional int32 platform = 2; */ public int getPlatform() { return platform_; } /** * optional int32 platform = 2; */ public Builder setPlatform(int value) { bitField0_ |= 0x00000002; platform_ = value; onChanged(); return this; } /** * optional int32 platform = 2; */ public Builder clearPlatform() { bitField0_ = (bitField0_ & ~0x00000002); platform_ = 0; onChanged(); return this; } // optional int32 push_type = 3; private int pushType_ ; /** * optional int32 push_type = 3; */ public boolean hasPushType() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int32 push_type = 3; */ public int getPushType() { return pushType_; } /** * optional int32 push_type = 3; */ public Builder setPushType(int value) { bitField0_ |= 0x00000004; pushType_ = value; onChanged(); return this; } /** * optional int32 push_type = 3; */ public Builder clearPushType() { bitField0_ = (bitField0_ & ~0x00000004); pushType_ = 0; onChanged(); return this; } // optional string device_name = 4; private java.lang.Object deviceName_ = ""; /** * optional string device_name = 4; */ public boolean hasDeviceName() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * optional string device_name = 4; */ public java.lang.String getDeviceName() { java.lang.Object ref = deviceName_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); deviceName_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string device_name = 4; */ public com.google.protobuf.ByteString getDeviceNameBytes() { java.lang.Object ref = deviceName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); deviceName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string device_name = 4; */ public Builder setDeviceName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; deviceName_ = value; onChanged(); return this; } /** * optional string device_name = 4; */ public Builder clearDeviceName() { bitField0_ = (bitField0_ & ~0x00000008); deviceName_ = getDefaultInstance().getDeviceName(); onChanged(); return this; } /** * optional string device_name = 4; */ public Builder setDeviceNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; deviceName_ = value; onChanged(); return this; } // optional string device_version = 5; private java.lang.Object deviceVersion_ = ""; /** * optional string device_version = 5; */ public boolean hasDeviceVersion() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * optional string device_version = 5; */ public java.lang.String getDeviceVersion() { java.lang.Object ref = deviceVersion_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); deviceVersion_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string device_version = 5; */ public com.google.protobuf.ByteString getDeviceVersionBytes() { java.lang.Object ref = deviceVersion_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); deviceVersion_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string device_version = 5; */ public Builder setDeviceVersion( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; deviceVersion_ = value; onChanged(); return this; } /** * optional string device_version = 5; */ public Builder clearDeviceVersion() { bitField0_ = (bitField0_ & ~0x00000010); deviceVersion_ = getDefaultInstance().getDeviceVersion(); onChanged(); return this; } /** * optional string device_version = 5; */ public Builder setDeviceVersionBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; deviceVersion_ = value; onChanged(); return this; } // optional string phone_name = 6; private java.lang.Object phoneName_ = ""; /** * optional string phone_name = 6; */ public boolean hasPhoneName() { return ((bitField0_ & 0x00000020) == 0x00000020); } /** * optional string phone_name = 6; */ public java.lang.String getPhoneName() { java.lang.Object ref = phoneName_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); phoneName_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string phone_name = 6; */ public com.google.protobuf.ByteString getPhoneNameBytes() { java.lang.Object ref = phoneName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); phoneName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string phone_name = 6; */ public Builder setPhoneName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; phoneName_ = value; onChanged(); return this; } /** * optional string phone_name = 6; */ public Builder clearPhoneName() { bitField0_ = (bitField0_ & ~0x00000020); phoneName_ = getDefaultInstance().getPhoneName(); onChanged(); return this; } /** * optional string phone_name = 6; */ public Builder setPhoneNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000020; phoneName_ = value; onChanged(); return this; } // optional string language = 7; private java.lang.Object language_ = ""; /** * optional string language = 7; */ public boolean hasLanguage() { return ((bitField0_ & 0x00000040) == 0x00000040); } /** * optional string language = 7; */ public java.lang.String getLanguage() { java.lang.Object ref = language_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); language_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string language = 7; */ public com.google.protobuf.ByteString getLanguageBytes() { java.lang.Object ref = language_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); language_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string language = 7; */ public Builder setLanguage( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; language_ = value; onChanged(); return this; } /** * optional string language = 7; */ public Builder clearLanguage() { bitField0_ = (bitField0_ & ~0x00000040); language_ = getDefaultInstance().getLanguage(); onChanged(); return this; } /** * optional string language = 7; */ public Builder setLanguageBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000040; language_ = value; onChanged(); return this; } // optional string carrier_name = 8; private java.lang.Object carrierName_ = ""; /** * optional string carrier_name = 8; */ public boolean hasCarrierName() { return ((bitField0_ & 0x00000080) == 0x00000080); } /** * optional string carrier_name = 8; */ public java.lang.String getCarrierName() { java.lang.Object ref = carrierName_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); carrierName_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string carrier_name = 8; */ public com.google.protobuf.ByteString getCarrierNameBytes() { java.lang.Object ref = carrierName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); carrierName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string carrier_name = 8; */ public Builder setCarrierName( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000080; carrierName_ = value; onChanged(); return this; } /** * optional string carrier_name = 8; */ public Builder clearCarrierName() { bitField0_ = (bitField0_ & ~0x00000080); carrierName_ = getDefaultInstance().getCarrierName(); onChanged(); return this; } /** * optional string carrier_name = 8; */ public Builder setCarrierNameBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000080; carrierName_ = value; onChanged(); return this; } // optional string app_version = 9; private java.lang.Object appVersion_ = ""; /** * optional string app_version = 9; */ public boolean hasAppVersion() { return ((bitField0_ & 0x00000100) == 0x00000100); } /** * optional string app_version = 9; */ public java.lang.String getAppVersion() { java.lang.Object ref = appVersion_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); appVersion_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string app_version = 9; */ public com.google.protobuf.ByteString getAppVersionBytes() { java.lang.Object ref = appVersion_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); appVersion_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string app_version = 9; */ public Builder setAppVersion( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000100; appVersion_ = value; onChanged(); return this; } /** * optional string app_version = 9; */ public Builder clearAppVersion() { bitField0_ = (bitField0_ & ~0x00000100); appVersion_ = getDefaultInstance().getAppVersion(); onChanged(); return this; } /** * optional string app_version = 9; */ public Builder setAppVersionBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000100; appVersion_ = value; onChanged(); return this; } // optional string sdk_version = 10; private java.lang.Object sdkVersion_ = ""; /** * optional string sdk_version = 10; */ public boolean hasSdkVersion() { return ((bitField0_ & 0x00000200) == 0x00000200); } /** * optional string sdk_version = 10; */ public java.lang.String getSdkVersion() { java.lang.Object ref = sdkVersion_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); sdkVersion_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string sdk_version = 10; */ public com.google.protobuf.ByteString getSdkVersionBytes() { java.lang.Object ref = sdkVersion_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); sdkVersion_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string sdk_version = 10; */ public Builder setSdkVersion( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000200; sdkVersion_ = value; onChanged(); return this; } /** * optional string sdk_version = 10; */ public Builder clearSdkVersion() { bitField0_ = (bitField0_ & ~0x00000200); sdkVersion_ = getDefaultInstance().getSdkVersion(); onChanged(); return this; } /** * optional string sdk_version = 10; */ public Builder setSdkVersionBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000200; sdkVersion_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:RouteRequest) } static { defaultInstance = new RouteRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:RouteRequest) } public interface RouteResponseOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string host = 1; /** * required string host = 1; */ boolean hasHost(); /** * required string host = 1; */ java.lang.String getHost(); /** * required string host = 1; */ com.google.protobuf.ByteString getHostBytes(); // required int32 long_port = 2; /** * required int32 long_port = 2; */ boolean hasLongPort(); /** * required int32 long_port = 2; */ int getLongPort(); // required int32 short_port = 3; /** * required int32 short_port = 3; */ boolean hasShortPort(); /** * required int32 short_port = 3; */ int getShortPort(); } /** * Protobuf type {@code RouteResponse} */ public static final class RouteResponse extends com.google.protobuf.GeneratedMessage implements RouteResponseOrBuilder { // Use RouteResponse.newBuilder() to construct. private RouteResponse(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private RouteResponse(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final RouteResponse defaultInstance; public static RouteResponse getDefaultInstance() { return defaultInstance; } public RouteResponse getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private RouteResponse( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; host_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; longPort_ = input.readInt32(); break; } case 24: { bitField0_ |= 0x00000004; shortPort_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_RouteResponse_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_RouteResponse_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.RouteResponse.class, cn.wildfirechat.proto.WFCMessage.RouteResponse.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public RouteResponse parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new RouteResponse(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string host = 1; public static final int HOST_FIELD_NUMBER = 1; private java.lang.Object host_; /** * required string host = 1; */ public boolean hasHost() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string host = 1; */ public java.lang.String getHost() { java.lang.Object ref = host_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { host_ = s; } return s; } } /** * required string host = 1; */ public com.google.protobuf.ByteString getHostBytes() { java.lang.Object ref = host_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); host_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 long_port = 2; public static final int LONG_PORT_FIELD_NUMBER = 2; private int longPort_; /** * required int32 long_port = 2; */ public boolean hasLongPort() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 long_port = 2; */ public int getLongPort() { return longPort_; } // required int32 short_port = 3; public static final int SHORT_PORT_FIELD_NUMBER = 3; private int shortPort_; /** * required int32 short_port = 3; */ public boolean hasShortPort() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int32 short_port = 3; */ public int getShortPort() { return shortPort_; } private void initFields() { host_ = ""; longPort_ = 0; shortPort_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasHost()) { memoizedIsInitialized = 0; return false; } if (!hasLongPort()) { memoizedIsInitialized = 0; return false; } if (!hasShortPort()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getHostBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, longPort_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(3, shortPort_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getHostBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, longPort_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(3, shortPort_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.RouteResponse parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.RouteResponse parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RouteResponse parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.RouteResponse parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RouteResponse parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.RouteResponse parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RouteResponse parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.RouteResponse parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RouteResponse parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.RouteResponse parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.RouteResponse prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code RouteResponse} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.RouteResponseOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_RouteResponse_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_RouteResponse_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.RouteResponse.class, cn.wildfirechat.proto.WFCMessage.RouteResponse.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.RouteResponse.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); host_ = ""; bitField0_ = (bitField0_ & ~0x00000001); longPort_ = 0; bitField0_ = (bitField0_ & ~0x00000002); shortPort_ = 0; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_RouteResponse_descriptor; } public cn.wildfirechat.proto.WFCMessage.RouteResponse getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.RouteResponse.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.RouteResponse build() { cn.wildfirechat.proto.WFCMessage.RouteResponse result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.RouteResponse buildPartial() { cn.wildfirechat.proto.WFCMessage.RouteResponse result = new cn.wildfirechat.proto.WFCMessage.RouteResponse(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.host_ = host_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.longPort_ = longPort_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.shortPort_ = shortPort_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.RouteResponse) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.RouteResponse)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.RouteResponse other) { if (other == cn.wildfirechat.proto.WFCMessage.RouteResponse.getDefaultInstance()) return this; if (other.hasHost()) { bitField0_ |= 0x00000001; host_ = other.host_; onChanged(); } if (other.hasLongPort()) { setLongPort(other.getLongPort()); } if (other.hasShortPort()) { setShortPort(other.getShortPort()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasHost()) { return false; } if (!hasLongPort()) { return false; } if (!hasShortPort()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.RouteResponse parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.RouteResponse) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string host = 1; private java.lang.Object host_ = ""; /** * required string host = 1; */ public boolean hasHost() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string host = 1; */ public java.lang.String getHost() { java.lang.Object ref = host_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); host_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string host = 1; */ public com.google.protobuf.ByteString getHostBytes() { java.lang.Object ref = host_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); host_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string host = 1; */ public Builder setHost( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; host_ = value; onChanged(); return this; } /** * required string host = 1; */ public Builder clearHost() { bitField0_ = (bitField0_ & ~0x00000001); host_ = getDefaultInstance().getHost(); onChanged(); return this; } /** * required string host = 1; */ public Builder setHostBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; host_ = value; onChanged(); return this; } // required int32 long_port = 2; private int longPort_ ; /** * required int32 long_port = 2; */ public boolean hasLongPort() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 long_port = 2; */ public int getLongPort() { return longPort_; } /** * required int32 long_port = 2; */ public Builder setLongPort(int value) { bitField0_ |= 0x00000002; longPort_ = value; onChanged(); return this; } /** * required int32 long_port = 2; */ public Builder clearLongPort() { bitField0_ = (bitField0_ & ~0x00000002); longPort_ = 0; onChanged(); return this; } // required int32 short_port = 3; private int shortPort_ ; /** * required int32 short_port = 3; */ public boolean hasShortPort() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int32 short_port = 3; */ public int getShortPort() { return shortPort_; } /** * required int32 short_port = 3; */ public Builder setShortPort(int value) { bitField0_ |= 0x00000004; shortPort_ = value; onChanged(); return this; } /** * required int32 short_port = 3; */ public Builder clearShortPort() { bitField0_ = (bitField0_ & ~0x00000004); shortPort_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:RouteResponse) } static { defaultInstance = new RouteResponse(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:RouteResponse) } public interface GetTokenRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string user_id = 1; /** * required string user_id = 1; */ boolean hasUserId(); /** * required string user_id = 1; */ java.lang.String getUserId(); /** * required string user_id = 1; */ com.google.protobuf.ByteString getUserIdBytes(); // required string client_id = 2; /** * required string client_id = 2; */ boolean hasClientId(); /** * required string client_id = 2; */ java.lang.String getClientId(); /** * required string client_id = 2; */ com.google.protobuf.ByteString getClientIdBytes(); // optional int32 platform = 3; /** * optional int32 platform = 3; */ boolean hasPlatform(); /** * optional int32 platform = 3; */ int getPlatform(); } /** * Protobuf type {@code GetTokenRequest} */ public static final class GetTokenRequest extends com.google.protobuf.GeneratedMessage implements GetTokenRequestOrBuilder { // Use GetTokenRequest.newBuilder() to construct. private GetTokenRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private GetTokenRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final GetTokenRequest defaultInstance; public static GetTokenRequest getDefaultInstance() { return defaultInstance; } public GetTokenRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private GetTokenRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; userId_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; clientId_ = input.readBytes(); break; } case 24: { bitField0_ |= 0x00000004; platform_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetTokenRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetTokenRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetTokenRequest.class, cn.wildfirechat.proto.WFCMessage.GetTokenRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public GetTokenRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new GetTokenRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string user_id = 1; public static final int USER_ID_FIELD_NUMBER = 1; private java.lang.Object userId_; /** * required string user_id = 1; */ public boolean hasUserId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string user_id = 1; */ public java.lang.String getUserId() { java.lang.Object ref = userId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { userId_ = s; } return s; } } /** * required string user_id = 1; */ public com.google.protobuf.ByteString getUserIdBytes() { java.lang.Object ref = userId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); userId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string client_id = 2; public static final int CLIENT_ID_FIELD_NUMBER = 2; private java.lang.Object clientId_; /** * required string client_id = 2; */ public boolean hasClientId() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string client_id = 2; */ public java.lang.String getClientId() { java.lang.Object ref = clientId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { clientId_ = s; } return s; } } /** * required string client_id = 2; */ public com.google.protobuf.ByteString getClientIdBytes() { java.lang.Object ref = clientId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); clientId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional int32 platform = 3; public static final int PLATFORM_FIELD_NUMBER = 3; private int platform_; /** * optional int32 platform = 3; */ public boolean hasPlatform() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int32 platform = 3; */ public int getPlatform() { return platform_; } private void initFields() { userId_ = ""; clientId_ = ""; platform_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasUserId()) { memoizedIsInitialized = 0; return false; } if (!hasClientId()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getUserIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getClientIdBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(3, platform_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getUserIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getClientIdBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(3, platform_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.GetTokenRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetTokenRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetTokenRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.GetTokenRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetTokenRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetTokenRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetTokenRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetTokenRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.GetTokenRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.GetTokenRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.GetTokenRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code GetTokenRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.GetTokenRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetTokenRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetTokenRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.GetTokenRequest.class, cn.wildfirechat.proto.WFCMessage.GetTokenRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.GetTokenRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); userId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); clientId_ = ""; bitField0_ = (bitField0_ & ~0x00000002); platform_ = 0; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_GetTokenRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.GetTokenRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.GetTokenRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.GetTokenRequest build() { cn.wildfirechat.proto.WFCMessage.GetTokenRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.GetTokenRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.GetTokenRequest result = new cn.wildfirechat.proto.WFCMessage.GetTokenRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.userId_ = userId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.clientId_ = clientId_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.platform_ = platform_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.GetTokenRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.GetTokenRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.GetTokenRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.GetTokenRequest.getDefaultInstance()) return this; if (other.hasUserId()) { bitField0_ |= 0x00000001; userId_ = other.userId_; onChanged(); } if (other.hasClientId()) { bitField0_ |= 0x00000002; clientId_ = other.clientId_; onChanged(); } if (other.hasPlatform()) { setPlatform(other.getPlatform()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasUserId()) { return false; } if (!hasClientId()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.GetTokenRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.GetTokenRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string user_id = 1; private java.lang.Object userId_ = ""; /** * required string user_id = 1; */ public boolean hasUserId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string user_id = 1; */ public java.lang.String getUserId() { java.lang.Object ref = userId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); userId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string user_id = 1; */ public com.google.protobuf.ByteString getUserIdBytes() { java.lang.Object ref = userId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); userId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string user_id = 1; */ public Builder setUserId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; userId_ = value; onChanged(); return this; } /** * required string user_id = 1; */ public Builder clearUserId() { bitField0_ = (bitField0_ & ~0x00000001); userId_ = getDefaultInstance().getUserId(); onChanged(); return this; } /** * required string user_id = 1; */ public Builder setUserIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; userId_ = value; onChanged(); return this; } // required string client_id = 2; private java.lang.Object clientId_ = ""; /** * required string client_id = 2; */ public boolean hasClientId() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required string client_id = 2; */ public java.lang.String getClientId() { java.lang.Object ref = clientId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); clientId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string client_id = 2; */ public com.google.protobuf.ByteString getClientIdBytes() { java.lang.Object ref = clientId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); clientId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string client_id = 2; */ public Builder setClientId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; clientId_ = value; onChanged(); return this; } /** * required string client_id = 2; */ public Builder clearClientId() { bitField0_ = (bitField0_ & ~0x00000002); clientId_ = getDefaultInstance().getClientId(); onChanged(); return this; } /** * required string client_id = 2; */ public Builder setClientIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; clientId_ = value; onChanged(); return this; } // optional int32 platform = 3; private int platform_ ; /** * optional int32 platform = 3; */ public boolean hasPlatform() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * optional int32 platform = 3; */ public int getPlatform() { return platform_; } /** * optional int32 platform = 3; */ public Builder setPlatform(int value) { bitField0_ |= 0x00000004; platform_ = value; onChanged(); return this; } /** * optional int32 platform = 3; */ public Builder clearPlatform() { bitField0_ = (bitField0_ & ~0x00000004); platform_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:GetTokenRequest) } static { defaultInstance = new GetTokenRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:GetTokenRequest) } public interface LoadRemoteMessagesOrBuilder extends com.google.protobuf.MessageOrBuilder { // required .Conversation conversation = 1; /** * required .Conversation conversation = 1; */ boolean hasConversation(); /** * required .Conversation conversation = 1; */ cn.wildfirechat.proto.WFCMessage.Conversation getConversation(); /** * required .Conversation conversation = 1; */ cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder getConversationOrBuilder(); // required int64 before_uid = 2; /** * required int64 before_uid = 2; */ boolean hasBeforeUid(); /** * required int64 before_uid = 2; */ long getBeforeUid(); // required int32 count = 3; /** * required int32 count = 3; */ boolean hasCount(); /** * required int32 count = 3; */ int getCount(); // repeated int32 content_type = 4; /** * repeated int32 content_type = 4; */ java.util.List getContentTypeList(); /** * repeated int32 content_type = 4; */ int getContentTypeCount(); /** * repeated int32 content_type = 4; */ int getContentType(int index); } /** * Protobuf type {@code LoadRemoteMessages} */ public static final class LoadRemoteMessages extends com.google.protobuf.GeneratedMessage implements LoadRemoteMessagesOrBuilder { // Use LoadRemoteMessages.newBuilder() to construct. private LoadRemoteMessages(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private LoadRemoteMessages(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final LoadRemoteMessages defaultInstance; public static LoadRemoteMessages getDefaultInstance() { return defaultInstance; } public LoadRemoteMessages getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private LoadRemoteMessages( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { cn.wildfirechat.proto.WFCMessage.Conversation.Builder subBuilder = null; if (((bitField0_ & 0x00000001) == 0x00000001)) { subBuilder = conversation_.toBuilder(); } conversation_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.Conversation.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(conversation_); conversation_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000001; break; } case 16: { bitField0_ |= 0x00000002; beforeUid_ = input.readInt64(); break; } case 24: { bitField0_ |= 0x00000004; count_ = input.readInt32(); break; } case 32: { if (!((mutable_bitField0_ & 0x00000008) == 0x00000008)) { contentType_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000008; } contentType_.add(input.readInt32()); break; } case 34: { int length = input.readRawVarint32(); int limit = input.pushLimit(length); if (!((mutable_bitField0_ & 0x00000008) == 0x00000008) && input.getBytesUntilLimit() > 0) { contentType_ = new java.util.ArrayList(); mutable_bitField0_ |= 0x00000008; } while (input.getBytesUntilLimit() > 0) { contentType_.add(input.readInt32()); } input.popLimit(limit); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000008) == 0x00000008)) { contentType_ = java.util.Collections.unmodifiableList(contentType_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_LoadRemoteMessages_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_LoadRemoteMessages_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages.class, cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public LoadRemoteMessages parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new LoadRemoteMessages(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required .Conversation conversation = 1; public static final int CONVERSATION_FIELD_NUMBER = 1; private cn.wildfirechat.proto.WFCMessage.Conversation conversation_; /** * required .Conversation conversation = 1; */ public boolean hasConversation() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required .Conversation conversation = 1; */ public cn.wildfirechat.proto.WFCMessage.Conversation getConversation() { return conversation_; } /** * required .Conversation conversation = 1; */ public cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder getConversationOrBuilder() { return conversation_; } // required int64 before_uid = 2; public static final int BEFORE_UID_FIELD_NUMBER = 2; private long beforeUid_; /** * required int64 before_uid = 2; */ public boolean hasBeforeUid() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int64 before_uid = 2; */ public long getBeforeUid() { return beforeUid_; } // required int32 count = 3; public static final int COUNT_FIELD_NUMBER = 3; private int count_; /** * required int32 count = 3; */ public boolean hasCount() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int32 count = 3; */ public int getCount() { return count_; } // repeated int32 content_type = 4; public static final int CONTENT_TYPE_FIELD_NUMBER = 4; private java.util.List contentType_; /** * repeated int32 content_type = 4; */ public java.util.List getContentTypeList() { return contentType_; } /** * repeated int32 content_type = 4; */ public int getContentTypeCount() { return contentType_.size(); } /** * repeated int32 content_type = 4; */ public int getContentType(int index) { return contentType_.get(index); } private void initFields() { conversation_ = cn.wildfirechat.proto.WFCMessage.Conversation.getDefaultInstance(); beforeUid_ = 0L; count_ = 0; contentType_ = java.util.Collections.emptyList(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasConversation()) { memoizedIsInitialized = 0; return false; } if (!hasBeforeUid()) { memoizedIsInitialized = 0; return false; } if (!hasCount()) { memoizedIsInitialized = 0; return false; } if (!getConversation().isInitialized()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeMessage(1, conversation_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt64(2, beforeUid_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(3, count_); } for (int i = 0; i < contentType_.size(); i++) { output.writeInt32(4, contentType_.get(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, conversation_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(2, beforeUid_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(3, count_); } { int dataSize = 0; for (int i = 0; i < contentType_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeInt32SizeNoTag(contentType_.get(i)); } size += dataSize; size += 1 * getContentTypeList().size(); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code LoadRemoteMessages} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.LoadRemoteMessagesOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_LoadRemoteMessages_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_LoadRemoteMessages_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages.class, cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getConversationFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); if (conversationBuilder_ == null) { conversation_ = cn.wildfirechat.proto.WFCMessage.Conversation.getDefaultInstance(); } else { conversationBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); beforeUid_ = 0L; bitField0_ = (bitField0_ & ~0x00000002); count_ = 0; bitField0_ = (bitField0_ & ~0x00000004); contentType_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000008); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_LoadRemoteMessages_descriptor; } public cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages build() { cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages buildPartial() { cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages result = new cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } if (conversationBuilder_ == null) { result.conversation_ = conversation_; } else { result.conversation_ = conversationBuilder_.build(); } if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.beforeUid_ = beforeUid_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.count_ = count_; if (((bitField0_ & 0x00000008) == 0x00000008)) { contentType_ = java.util.Collections.unmodifiableList(contentType_); bitField0_ = (bitField0_ & ~0x00000008); } result.contentType_ = contentType_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages other) { if (other == cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages.getDefaultInstance()) return this; if (other.hasConversation()) { mergeConversation(other.getConversation()); } if (other.hasBeforeUid()) { setBeforeUid(other.getBeforeUid()); } if (other.hasCount()) { setCount(other.getCount()); } if (!other.contentType_.isEmpty()) { if (contentType_.isEmpty()) { contentType_ = other.contentType_; bitField0_ = (bitField0_ & ~0x00000008); } else { ensureContentTypeIsMutable(); contentType_.addAll(other.contentType_); } onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasConversation()) { return false; } if (!hasBeforeUid()) { return false; } if (!hasCount()) { return false; } if (!getConversation().isInitialized()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.LoadRemoteMessages) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required .Conversation conversation = 1; private cn.wildfirechat.proto.WFCMessage.Conversation conversation_ = cn.wildfirechat.proto.WFCMessage.Conversation.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.Conversation, cn.wildfirechat.proto.WFCMessage.Conversation.Builder, cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder> conversationBuilder_; /** * required .Conversation conversation = 1; */ public boolean hasConversation() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required .Conversation conversation = 1; */ public cn.wildfirechat.proto.WFCMessage.Conversation getConversation() { if (conversationBuilder_ == null) { return conversation_; } else { return conversationBuilder_.getMessage(); } } /** * required .Conversation conversation = 1; */ public Builder setConversation(cn.wildfirechat.proto.WFCMessage.Conversation value) { if (conversationBuilder_ == null) { if (value == null) { throw new NullPointerException(); } conversation_ = value; onChanged(); } else { conversationBuilder_.setMessage(value); } bitField0_ |= 0x00000001; return this; } /** * required .Conversation conversation = 1; */ public Builder setConversation( cn.wildfirechat.proto.WFCMessage.Conversation.Builder builderForValue) { if (conversationBuilder_ == null) { conversation_ = builderForValue.build(); onChanged(); } else { conversationBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000001; return this; } /** * required .Conversation conversation = 1; */ public Builder mergeConversation(cn.wildfirechat.proto.WFCMessage.Conversation value) { if (conversationBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && conversation_ != cn.wildfirechat.proto.WFCMessage.Conversation.getDefaultInstance()) { conversation_ = cn.wildfirechat.proto.WFCMessage.Conversation.newBuilder(conversation_).mergeFrom(value).buildPartial(); } else { conversation_ = value; } onChanged(); } else { conversationBuilder_.mergeFrom(value); } bitField0_ |= 0x00000001; return this; } /** * required .Conversation conversation = 1; */ public Builder clearConversation() { if (conversationBuilder_ == null) { conversation_ = cn.wildfirechat.proto.WFCMessage.Conversation.getDefaultInstance(); onChanged(); } else { conversationBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); return this; } /** * required .Conversation conversation = 1; */ public cn.wildfirechat.proto.WFCMessage.Conversation.Builder getConversationBuilder() { bitField0_ |= 0x00000001; onChanged(); return getConversationFieldBuilder().getBuilder(); } /** * required .Conversation conversation = 1; */ public cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder getConversationOrBuilder() { if (conversationBuilder_ != null) { return conversationBuilder_.getMessageOrBuilder(); } else { return conversation_; } } /** * required .Conversation conversation = 1; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.Conversation, cn.wildfirechat.proto.WFCMessage.Conversation.Builder, cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder> getConversationFieldBuilder() { if (conversationBuilder_ == null) { conversationBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.Conversation, cn.wildfirechat.proto.WFCMessage.Conversation.Builder, cn.wildfirechat.proto.WFCMessage.ConversationOrBuilder>( conversation_, getParentForChildren(), isClean()); conversation_ = null; } return conversationBuilder_; } // required int64 before_uid = 2; private long beforeUid_ ; /** * required int64 before_uid = 2; */ public boolean hasBeforeUid() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int64 before_uid = 2; */ public long getBeforeUid() { return beforeUid_; } /** * required int64 before_uid = 2; */ public Builder setBeforeUid(long value) { bitField0_ |= 0x00000002; beforeUid_ = value; onChanged(); return this; } /** * required int64 before_uid = 2; */ public Builder clearBeforeUid() { bitField0_ = (bitField0_ & ~0x00000002); beforeUid_ = 0L; onChanged(); return this; } // required int32 count = 3; private int count_ ; /** * required int32 count = 3; */ public boolean hasCount() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int32 count = 3; */ public int getCount() { return count_; } /** * required int32 count = 3; */ public Builder setCount(int value) { bitField0_ |= 0x00000004; count_ = value; onChanged(); return this; } /** * required int32 count = 3; */ public Builder clearCount() { bitField0_ = (bitField0_ & ~0x00000004); count_ = 0; onChanged(); return this; } // repeated int32 content_type = 4; private java.util.List contentType_ = java.util.Collections.emptyList(); private void ensureContentTypeIsMutable() { if (!((bitField0_ & 0x00000008) == 0x00000008)) { contentType_ = new java.util.ArrayList(contentType_); bitField0_ |= 0x00000008; } } /** * repeated int32 content_type = 4; */ public java.util.List getContentTypeList() { return java.util.Collections.unmodifiableList(contentType_); } /** * repeated int32 content_type = 4; */ public int getContentTypeCount() { return contentType_.size(); } /** * repeated int32 content_type = 4; */ public int getContentType(int index) { return contentType_.get(index); } /** * repeated int32 content_type = 4; */ public Builder setContentType( int index, int value) { ensureContentTypeIsMutable(); contentType_.set(index, value); onChanged(); return this; } /** * repeated int32 content_type = 4; */ public Builder addContentType(int value) { ensureContentTypeIsMutable(); contentType_.add(value); onChanged(); return this; } /** * repeated int32 content_type = 4; */ public Builder addAllContentType( java.lang.Iterable values) { ensureContentTypeIsMutable(); super.addAll(values, contentType_); onChanged(); return this; } /** * repeated int32 content_type = 4; */ public Builder clearContentType() { contentType_ = java.util.Collections.emptyList(); bitField0_ = (bitField0_ & ~0x00000008); onChanged(); return this; } // @@protoc_insertion_point(builder_scope:LoadRemoteMessages) } static { defaultInstance = new LoadRemoteMessages(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:LoadRemoteMessages) } public interface MultiCastMessageOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string from_user = 1; /** * required string from_user = 1; */ boolean hasFromUser(); /** * required string from_user = 1; */ java.lang.String getFromUser(); /** * required string from_user = 1; */ com.google.protobuf.ByteString getFromUserBytes(); // required .MessageContent content = 2; /** * required .MessageContent content = 2; */ boolean hasContent(); /** * required .MessageContent content = 2; */ cn.wildfirechat.proto.WFCMessage.MessageContent getContent(); /** * required .MessageContent content = 2; */ cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getContentOrBuilder(); // repeated string to = 3; /** * repeated string to = 3; */ java.util.List getToList(); /** * repeated string to = 3; */ int getToCount(); /** * repeated string to = 3; */ java.lang.String getTo(int index); /** * repeated string to = 3; */ com.google.protobuf.ByteString getToBytes(int index); // required int32 line = 4; /** * required int32 line = 4; */ boolean hasLine(); /** * required int32 line = 4; */ int getLine(); } /** * Protobuf type {@code MultiCastMessage} */ public static final class MultiCastMessage extends com.google.protobuf.GeneratedMessage implements MultiCastMessageOrBuilder { // Use MultiCastMessage.newBuilder() to construct. private MultiCastMessage(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private MultiCastMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final MultiCastMessage defaultInstance; public static MultiCastMessage getDefaultInstance() { return defaultInstance; } public MultiCastMessage getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private MultiCastMessage( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; fromUser_ = input.readBytes(); break; } case 18: { cn.wildfirechat.proto.WFCMessage.MessageContent.Builder subBuilder = null; if (((bitField0_ & 0x00000002) == 0x00000002)) { subBuilder = content_.toBuilder(); } content_ = input.readMessage(cn.wildfirechat.proto.WFCMessage.MessageContent.PARSER, extensionRegistry); if (subBuilder != null) { subBuilder.mergeFrom(content_); content_ = subBuilder.buildPartial(); } bitField0_ |= 0x00000002; break; } case 26: { if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) { to_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000004; } to_.add(input.readBytes()); break; } case 32: { bitField0_ |= 0x00000004; line_ = input.readInt32(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) { to_ = new com.google.protobuf.UnmodifiableLazyStringList(to_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_MultiCastMessage_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_MultiCastMessage_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.MultiCastMessage.class, cn.wildfirechat.proto.WFCMessage.MultiCastMessage.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public MultiCastMessage parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new MultiCastMessage(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string from_user = 1; public static final int FROM_USER_FIELD_NUMBER = 1; private java.lang.Object fromUser_; /** * required string from_user = 1; */ public boolean hasFromUser() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string from_user = 1; */ public java.lang.String getFromUser() { java.lang.Object ref = fromUser_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { fromUser_ = s; } return s; } } /** * required string from_user = 1; */ public com.google.protobuf.ByteString getFromUserBytes() { java.lang.Object ref = fromUser_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); fromUser_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required .MessageContent content = 2; public static final int CONTENT_FIELD_NUMBER = 2; private cn.wildfirechat.proto.WFCMessage.MessageContent content_; /** * required .MessageContent content = 2; */ public boolean hasContent() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required .MessageContent content = 2; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getContent() { return content_; } /** * required .MessageContent content = 2; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getContentOrBuilder() { return content_; } // repeated string to = 3; public static final int TO_FIELD_NUMBER = 3; private com.google.protobuf.LazyStringList to_; /** * repeated string to = 3; */ public java.util.List getToList() { return to_; } /** * repeated string to = 3; */ public int getToCount() { return to_.size(); } /** * repeated string to = 3; */ public java.lang.String getTo(int index) { return to_.get(index); } /** * repeated string to = 3; */ public com.google.protobuf.ByteString getToBytes(int index) { return to_.getByteString(index); } // required int32 line = 4; public static final int LINE_FIELD_NUMBER = 4; private int line_; /** * required int32 line = 4; */ public boolean hasLine() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int32 line = 4; */ public int getLine() { return line_; } private void initFields() { fromUser_ = ""; content_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); to_ = com.google.protobuf.LazyStringArrayList.EMPTY; line_ = 0; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasFromUser()) { memoizedIsInitialized = 0; return false; } if (!hasContent()) { memoizedIsInitialized = 0; return false; } if (!hasLine()) { memoizedIsInitialized = 0; return false; } if (!getContent().isInitialized()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getFromUserBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(2, content_); } for (int i = 0; i < to_.size(); i++) { output.writeBytes(3, to_.getByteString(i)); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt32(4, line_); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getFromUserBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(2, content_); } { int dataSize = 0; for (int i = 0; i < to_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeBytesSizeNoTag(to_.getByteString(i)); } size += dataSize; size += 1 * getToList().size(); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(4, line_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.MultiCastMessage parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.MultiCastMessage parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.MultiCastMessage parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.MultiCastMessage parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.MultiCastMessage parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.MultiCastMessage parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.MultiCastMessage parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.MultiCastMessage parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.MultiCastMessage parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.MultiCastMessage parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.MultiCastMessage prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code MultiCastMessage} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.MultiCastMessageOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_MultiCastMessage_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_MultiCastMessage_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.MultiCastMessage.class, cn.wildfirechat.proto.WFCMessage.MultiCastMessage.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.MultiCastMessage.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { getContentFieldBuilder(); } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); fromUser_ = ""; bitField0_ = (bitField0_ & ~0x00000001); if (contentBuilder_ == null) { content_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); } else { contentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000002); to_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000004); line_ = 0; bitField0_ = (bitField0_ & ~0x00000008); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_MultiCastMessage_descriptor; } public cn.wildfirechat.proto.WFCMessage.MultiCastMessage getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.MultiCastMessage.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.MultiCastMessage build() { cn.wildfirechat.proto.WFCMessage.MultiCastMessage result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.MultiCastMessage buildPartial() { cn.wildfirechat.proto.WFCMessage.MultiCastMessage result = new cn.wildfirechat.proto.WFCMessage.MultiCastMessage(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.fromUser_ = fromUser_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } if (contentBuilder_ == null) { result.content_ = content_; } else { result.content_ = contentBuilder_.build(); } if (((bitField0_ & 0x00000004) == 0x00000004)) { to_ = new com.google.protobuf.UnmodifiableLazyStringList( to_); bitField0_ = (bitField0_ & ~0x00000004); } result.to_ = to_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000004; } result.line_ = line_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.MultiCastMessage) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.MultiCastMessage)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.MultiCastMessage other) { if (other == cn.wildfirechat.proto.WFCMessage.MultiCastMessage.getDefaultInstance()) return this; if (other.hasFromUser()) { bitField0_ |= 0x00000001; fromUser_ = other.fromUser_; onChanged(); } if (other.hasContent()) { mergeContent(other.getContent()); } if (!other.to_.isEmpty()) { if (to_.isEmpty()) { to_ = other.to_; bitField0_ = (bitField0_ & ~0x00000004); } else { ensureToIsMutable(); to_.addAll(other.to_); } onChanged(); } if (other.hasLine()) { setLine(other.getLine()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasFromUser()) { return false; } if (!hasContent()) { return false; } if (!hasLine()) { return false; } if (!getContent().isInitialized()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.MultiCastMessage parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.MultiCastMessage) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string from_user = 1; private java.lang.Object fromUser_ = ""; /** * required string from_user = 1; */ public boolean hasFromUser() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string from_user = 1; */ public java.lang.String getFromUser() { java.lang.Object ref = fromUser_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); fromUser_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string from_user = 1; */ public com.google.protobuf.ByteString getFromUserBytes() { java.lang.Object ref = fromUser_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); fromUser_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string from_user = 1; */ public Builder setFromUser( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; fromUser_ = value; onChanged(); return this; } /** * required string from_user = 1; */ public Builder clearFromUser() { bitField0_ = (bitField0_ & ~0x00000001); fromUser_ = getDefaultInstance().getFromUser(); onChanged(); return this; } /** * required string from_user = 1; */ public Builder setFromUserBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; fromUser_ = value; onChanged(); return this; } // required .MessageContent content = 2; private cn.wildfirechat.proto.WFCMessage.MessageContent content_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> contentBuilder_; /** * required .MessageContent content = 2; */ public boolean hasContent() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required .MessageContent content = 2; */ public cn.wildfirechat.proto.WFCMessage.MessageContent getContent() { if (contentBuilder_ == null) { return content_; } else { return contentBuilder_.getMessage(); } } /** * required .MessageContent content = 2; */ public Builder setContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (contentBuilder_ == null) { if (value == null) { throw new NullPointerException(); } content_ = value; onChanged(); } else { contentBuilder_.setMessage(value); } bitField0_ |= 0x00000002; return this; } /** * required .MessageContent content = 2; */ public Builder setContent( cn.wildfirechat.proto.WFCMessage.MessageContent.Builder builderForValue) { if (contentBuilder_ == null) { content_ = builderForValue.build(); onChanged(); } else { contentBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000002; return this; } /** * required .MessageContent content = 2; */ public Builder mergeContent(cn.wildfirechat.proto.WFCMessage.MessageContent value) { if (contentBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002) && content_ != cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance()) { content_ = cn.wildfirechat.proto.WFCMessage.MessageContent.newBuilder(content_).mergeFrom(value).buildPartial(); } else { content_ = value; } onChanged(); } else { contentBuilder_.mergeFrom(value); } bitField0_ |= 0x00000002; return this; } /** * required .MessageContent content = 2; */ public Builder clearContent() { if (contentBuilder_ == null) { content_ = cn.wildfirechat.proto.WFCMessage.MessageContent.getDefaultInstance(); onChanged(); } else { contentBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000002); return this; } /** * required .MessageContent content = 2; */ public cn.wildfirechat.proto.WFCMessage.MessageContent.Builder getContentBuilder() { bitField0_ |= 0x00000002; onChanged(); return getContentFieldBuilder().getBuilder(); } /** * required .MessageContent content = 2; */ public cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder getContentOrBuilder() { if (contentBuilder_ != null) { return contentBuilder_.getMessageOrBuilder(); } else { return content_; } } /** * required .MessageContent content = 2; */ private com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder> getContentFieldBuilder() { if (contentBuilder_ == null) { contentBuilder_ = new com.google.protobuf.SingleFieldBuilder< cn.wildfirechat.proto.WFCMessage.MessageContent, cn.wildfirechat.proto.WFCMessage.MessageContent.Builder, cn.wildfirechat.proto.WFCMessage.MessageContentOrBuilder>( content_, getParentForChildren(), isClean()); content_ = null; } return contentBuilder_; } // repeated string to = 3; private com.google.protobuf.LazyStringList to_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureToIsMutable() { if (!((bitField0_ & 0x00000004) == 0x00000004)) { to_ = new com.google.protobuf.LazyStringArrayList(to_); bitField0_ |= 0x00000004; } } /** * repeated string to = 3; */ public java.util.List getToList() { return java.util.Collections.unmodifiableList(to_); } /** * repeated string to = 3; */ public int getToCount() { return to_.size(); } /** * repeated string to = 3; */ public java.lang.String getTo(int index) { return to_.get(index); } /** * repeated string to = 3; */ public com.google.protobuf.ByteString getToBytes(int index) { return to_.getByteString(index); } /** * repeated string to = 3; */ public Builder setTo( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureToIsMutable(); to_.set(index, value); onChanged(); return this; } /** * repeated string to = 3; */ public Builder addTo( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureToIsMutable(); to_.add(value); onChanged(); return this; } /** * repeated string to = 3; */ public Builder addAllTo( java.lang.Iterable values) { ensureToIsMutable(); super.addAll(values, to_); onChanged(); return this; } /** * repeated string to = 3; */ public Builder clearTo() { to_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000004); onChanged(); return this; } /** * repeated string to = 3; */ public Builder addToBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } ensureToIsMutable(); to_.add(value); onChanged(); return this; } // required int32 line = 4; private int line_ ; /** * required int32 line = 4; */ public boolean hasLine() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * required int32 line = 4; */ public int getLine() { return line_; } /** * required int32 line = 4; */ public Builder setLine(int value) { bitField0_ |= 0x00000008; line_ = value; onChanged(); return this; } /** * required int32 line = 4; */ public Builder clearLine() { bitField0_ = (bitField0_ & ~0x00000008); line_ = 0; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:MultiCastMessage) } static { defaultInstance = new MultiCastMessage(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:MultiCastMessage) } public interface RecallMultiCastMessageRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int64 message_id = 1; /** * required int64 message_id = 1; */ boolean hasMessageId(); /** * required int64 message_id = 1; */ long getMessageId(); // repeated string receiver = 2; /** * repeated string receiver = 2; */ java.util.List getReceiverList(); /** * repeated string receiver = 2; */ int getReceiverCount(); /** * repeated string receiver = 2; */ java.lang.String getReceiver(int index); /** * repeated string receiver = 2; */ com.google.protobuf.ByteString getReceiverBytes(int index); } /** * Protobuf type {@code RecallMultiCastMessageRequest} */ public static final class RecallMultiCastMessageRequest extends com.google.protobuf.GeneratedMessage implements RecallMultiCastMessageRequestOrBuilder { // Use RecallMultiCastMessageRequest.newBuilder() to construct. private RecallMultiCastMessageRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private RecallMultiCastMessageRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final RecallMultiCastMessageRequest defaultInstance; public static RecallMultiCastMessageRequest getDefaultInstance() { return defaultInstance; } public RecallMultiCastMessageRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private RecallMultiCastMessageRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; messageId_ = input.readInt64(); break; } case 18: { if (!((mutable_bitField0_ & 0x00000002) == 0x00000002)) { receiver_ = new com.google.protobuf.LazyStringArrayList(); mutable_bitField0_ |= 0x00000002; } receiver_.add(input.readBytes()); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { if (((mutable_bitField0_ & 0x00000002) == 0x00000002)) { receiver_ = new com.google.protobuf.UnmodifiableLazyStringList(receiver_); } this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_RecallMultiCastMessageRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_RecallMultiCastMessageRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest.class, cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public RecallMultiCastMessageRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new RecallMultiCastMessageRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required int64 message_id = 1; public static final int MESSAGE_ID_FIELD_NUMBER = 1; private long messageId_; /** * required int64 message_id = 1; */ public boolean hasMessageId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int64 message_id = 1; */ public long getMessageId() { return messageId_; } // repeated string receiver = 2; public static final int RECEIVER_FIELD_NUMBER = 2; private com.google.protobuf.LazyStringList receiver_; /** * repeated string receiver = 2; */ public java.util.List getReceiverList() { return receiver_; } /** * repeated string receiver = 2; */ public int getReceiverCount() { return receiver_.size(); } /** * repeated string receiver = 2; */ public java.lang.String getReceiver(int index) { return receiver_.get(index); } /** * repeated string receiver = 2; */ public com.google.protobuf.ByteString getReceiverBytes(int index) { return receiver_.getByteString(index); } private void initFields() { messageId_ = 0L; receiver_ = com.google.protobuf.LazyStringArrayList.EMPTY; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasMessageId()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt64(1, messageId_); } for (int i = 0; i < receiver_.size(); i++) { output.writeBytes(2, receiver_.getByteString(i)); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(1, messageId_); } { int dataSize = 0; for (int i = 0; i < receiver_.size(); i++) { dataSize += com.google.protobuf.CodedOutputStream .computeBytesSizeNoTag(receiver_.getByteString(i)); } size += dataSize; size += 1 * getReceiverList().size(); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code RecallMultiCastMessageRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_RecallMultiCastMessageRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_RecallMultiCastMessageRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest.class, cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); messageId_ = 0L; bitField0_ = (bitField0_ & ~0x00000001); receiver_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_RecallMultiCastMessageRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest build() { cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest result = new cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.messageId_ = messageId_; if (((bitField0_ & 0x00000002) == 0x00000002)) { receiver_ = new com.google.protobuf.UnmodifiableLazyStringList( receiver_); bitField0_ = (bitField0_ & ~0x00000002); } result.receiver_ = receiver_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest.getDefaultInstance()) return this; if (other.hasMessageId()) { setMessageId(other.getMessageId()); } if (!other.receiver_.isEmpty()) { if (receiver_.isEmpty()) { receiver_ = other.receiver_; bitField0_ = (bitField0_ & ~0x00000002); } else { ensureReceiverIsMutable(); receiver_.addAll(other.receiver_); } onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasMessageId()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.RecallMultiCastMessageRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required int64 message_id = 1; private long messageId_ ; /** * required int64 message_id = 1; */ public boolean hasMessageId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required int64 message_id = 1; */ public long getMessageId() { return messageId_; } /** * required int64 message_id = 1; */ public Builder setMessageId(long value) { bitField0_ |= 0x00000001; messageId_ = value; onChanged(); return this; } /** * required int64 message_id = 1; */ public Builder clearMessageId() { bitField0_ = (bitField0_ & ~0x00000001); messageId_ = 0L; onChanged(); return this; } // repeated string receiver = 2; private com.google.protobuf.LazyStringList receiver_ = com.google.protobuf.LazyStringArrayList.EMPTY; private void ensureReceiverIsMutable() { if (!((bitField0_ & 0x00000002) == 0x00000002)) { receiver_ = new com.google.protobuf.LazyStringArrayList(receiver_); bitField0_ |= 0x00000002; } } /** * repeated string receiver = 2; */ public java.util.List getReceiverList() { return java.util.Collections.unmodifiableList(receiver_); } /** * repeated string receiver = 2; */ public int getReceiverCount() { return receiver_.size(); } /** * repeated string receiver = 2; */ public java.lang.String getReceiver(int index) { return receiver_.get(index); } /** * repeated string receiver = 2; */ public com.google.protobuf.ByteString getReceiverBytes(int index) { return receiver_.getByteString(index); } /** * repeated string receiver = 2; */ public Builder setReceiver( int index, java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureReceiverIsMutable(); receiver_.set(index, value); onChanged(); return this; } /** * repeated string receiver = 2; */ public Builder addReceiver( java.lang.String value) { if (value == null) { throw new NullPointerException(); } ensureReceiverIsMutable(); receiver_.add(value); onChanged(); return this; } /** * repeated string receiver = 2; */ public Builder addAllReceiver( java.lang.Iterable values) { ensureReceiverIsMutable(); super.addAll(values, receiver_); onChanged(); return this; } /** * repeated string receiver = 2; */ public Builder clearReceiver() { receiver_ = com.google.protobuf.LazyStringArrayList.EMPTY; bitField0_ = (bitField0_ & ~0x00000002); onChanged(); return this; } /** * repeated string receiver = 2; */ public Builder addReceiverBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } ensureReceiverIsMutable(); receiver_.add(value); onChanged(); return this; } // @@protoc_insertion_point(builder_scope:RecallMultiCastMessageRequest) } static { defaultInstance = new RecallMultiCastMessageRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:RecallMultiCastMessageRequest) } public interface AuthCodeRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string target_id = 1; /** * required string target_id = 1; */ boolean hasTargetId(); /** * required string target_id = 1; */ java.lang.String getTargetId(); /** * required string target_id = 1; */ com.google.protobuf.ByteString getTargetIdBytes(); // required int32 type = 2; /** * required int32 type = 2; */ boolean hasType(); /** * required int32 type = 2; */ int getType(); // required string host = 3; /** * required string host = 3; */ boolean hasHost(); /** * required string host = 3; */ java.lang.String getHost(); /** * required string host = 3; */ com.google.protobuf.ByteString getHostBytes(); } /** * Protobuf type {@code AuthCodeRequest} */ public static final class AuthCodeRequest extends com.google.protobuf.GeneratedMessage implements AuthCodeRequestOrBuilder { // Use AuthCodeRequest.newBuilder() to construct. private AuthCodeRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private AuthCodeRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final AuthCodeRequest defaultInstance; public static AuthCodeRequest getDefaultInstance() { return defaultInstance; } public AuthCodeRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private AuthCodeRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; targetId_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; type_ = input.readInt32(); break; } case 26: { bitField0_ |= 0x00000004; host_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_AuthCodeRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_AuthCodeRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.AuthCodeRequest.class, cn.wildfirechat.proto.WFCMessage.AuthCodeRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public AuthCodeRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new AuthCodeRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string target_id = 1; public static final int TARGET_ID_FIELD_NUMBER = 1; private java.lang.Object targetId_; /** * required string target_id = 1; */ public boolean hasTargetId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string target_id = 1; */ public java.lang.String getTargetId() { java.lang.Object ref = targetId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { targetId_ = s; } return s; } } /** * required string target_id = 1; */ public com.google.protobuf.ByteString getTargetIdBytes() { java.lang.Object ref = targetId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); targetId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 type = 2; public static final int TYPE_FIELD_NUMBER = 2; private int type_; /** * required int32 type = 2; */ public boolean hasType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 type = 2; */ public int getType() { return type_; } // required string host = 3; public static final int HOST_FIELD_NUMBER = 3; private java.lang.Object host_; /** * required string host = 3; */ public boolean hasHost() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string host = 3; */ public java.lang.String getHost() { java.lang.Object ref = host_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { host_ = s; } return s; } } /** * required string host = 3; */ public com.google.protobuf.ByteString getHostBytes() { java.lang.Object ref = host_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); host_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { targetId_ = ""; type_ = 0; host_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasTargetId()) { memoizedIsInitialized = 0; return false; } if (!hasType()) { memoizedIsInitialized = 0; return false; } if (!hasHost()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getTargetIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, type_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getHostBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getTargetIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, type_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getHostBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.AuthCodeRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.AuthCodeRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.AuthCodeRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.AuthCodeRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.AuthCodeRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.AuthCodeRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.AuthCodeRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.AuthCodeRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.AuthCodeRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.AuthCodeRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.AuthCodeRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code AuthCodeRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.AuthCodeRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_AuthCodeRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_AuthCodeRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.AuthCodeRequest.class, cn.wildfirechat.proto.WFCMessage.AuthCodeRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.AuthCodeRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); targetId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); type_ = 0; bitField0_ = (bitField0_ & ~0x00000002); host_ = ""; bitField0_ = (bitField0_ & ~0x00000004); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_AuthCodeRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.AuthCodeRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.AuthCodeRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.AuthCodeRequest build() { cn.wildfirechat.proto.WFCMessage.AuthCodeRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.AuthCodeRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.AuthCodeRequest result = new cn.wildfirechat.proto.WFCMessage.AuthCodeRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.targetId_ = targetId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.type_ = type_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.host_ = host_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.AuthCodeRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.AuthCodeRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.AuthCodeRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.AuthCodeRequest.getDefaultInstance()) return this; if (other.hasTargetId()) { bitField0_ |= 0x00000001; targetId_ = other.targetId_; onChanged(); } if (other.hasType()) { setType(other.getType()); } if (other.hasHost()) { bitField0_ |= 0x00000004; host_ = other.host_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasTargetId()) { return false; } if (!hasType()) { return false; } if (!hasHost()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.AuthCodeRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.AuthCodeRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string target_id = 1; private java.lang.Object targetId_ = ""; /** * required string target_id = 1; */ public boolean hasTargetId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string target_id = 1; */ public java.lang.String getTargetId() { java.lang.Object ref = targetId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); targetId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string target_id = 1; */ public com.google.protobuf.ByteString getTargetIdBytes() { java.lang.Object ref = targetId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); targetId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string target_id = 1; */ public Builder setTargetId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; targetId_ = value; onChanged(); return this; } /** * required string target_id = 1; */ public Builder clearTargetId() { bitField0_ = (bitField0_ & ~0x00000001); targetId_ = getDefaultInstance().getTargetId(); onChanged(); return this; } /** * required string target_id = 1; */ public Builder setTargetIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; targetId_ = value; onChanged(); return this; } // required int32 type = 2; private int type_ ; /** * required int32 type = 2; */ public boolean hasType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 type = 2; */ public int getType() { return type_; } /** * required int32 type = 2; */ public Builder setType(int value) { bitField0_ |= 0x00000002; type_ = value; onChanged(); return this; } /** * required int32 type = 2; */ public Builder clearType() { bitField0_ = (bitField0_ & ~0x00000002); type_ = 0; onChanged(); return this; } // required string host = 3; private java.lang.Object host_ = ""; /** * required string host = 3; */ public boolean hasHost() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required string host = 3; */ public java.lang.String getHost() { java.lang.Object ref = host_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); host_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string host = 3; */ public com.google.protobuf.ByteString getHostBytes() { java.lang.Object ref = host_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); host_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string host = 3; */ public Builder setHost( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; host_ = value; onChanged(); return this; } /** * required string host = 3; */ public Builder clearHost() { bitField0_ = (bitField0_ & ~0x00000004); host_ = getDefaultInstance().getHost(); onChanged(); return this; } /** * required string host = 3; */ public Builder setHostBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000004; host_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:AuthCodeRequest) } static { defaultInstance = new AuthCodeRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:AuthCodeRequest) } public interface ApplicationConfigRequestOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string appId = 1; /** * required string appId = 1; */ boolean hasAppId(); /** * required string appId = 1; */ java.lang.String getAppId(); /** * required string appId = 1; */ com.google.protobuf.ByteString getAppIdBytes(); // required int32 appType = 2; /** * required int32 appType = 2; */ boolean hasAppType(); /** * required int32 appType = 2; */ int getAppType(); // required int64 timestamp = 3; /** * required int64 timestamp = 3; */ boolean hasTimestamp(); /** * required int64 timestamp = 3; */ long getTimestamp(); // required string nonce = 4; /** * required string nonce = 4; */ boolean hasNonce(); /** * required string nonce = 4; */ java.lang.String getNonce(); /** * required string nonce = 4; */ com.google.protobuf.ByteString getNonceBytes(); // required string signature = 5; /** * required string signature = 5; */ boolean hasSignature(); /** * required string signature = 5; */ java.lang.String getSignature(); /** * required string signature = 5; */ com.google.protobuf.ByteString getSignatureBytes(); } /** * Protobuf type {@code ApplicationConfigRequest} */ public static final class ApplicationConfigRequest extends com.google.protobuf.GeneratedMessage implements ApplicationConfigRequestOrBuilder { // Use ApplicationConfigRequest.newBuilder() to construct. private ApplicationConfigRequest(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private ApplicationConfigRequest(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final ApplicationConfigRequest defaultInstance; public static ApplicationConfigRequest getDefaultInstance() { return defaultInstance; } public ApplicationConfigRequest getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private ApplicationConfigRequest( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; appId_ = input.readBytes(); break; } case 16: { bitField0_ |= 0x00000002; appType_ = input.readInt32(); break; } case 24: { bitField0_ |= 0x00000004; timestamp_ = input.readInt64(); break; } case 34: { bitField0_ |= 0x00000008; nonce_ = input.readBytes(); break; } case 42: { bitField0_ |= 0x00000010; signature_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ApplicationConfigRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ApplicationConfigRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest.class, cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public ApplicationConfigRequest parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new ApplicationConfigRequest(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string appId = 1; public static final int APPID_FIELD_NUMBER = 1; private java.lang.Object appId_; /** * required string appId = 1; */ public boolean hasAppId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string appId = 1; */ public java.lang.String getAppId() { java.lang.Object ref = appId_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { appId_ = s; } return s; } } /** * required string appId = 1; */ public com.google.protobuf.ByteString getAppIdBytes() { java.lang.Object ref = appId_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); appId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required int32 appType = 2; public static final int APPTYPE_FIELD_NUMBER = 2; private int appType_; /** * required int32 appType = 2; */ public boolean hasAppType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 appType = 2; */ public int getAppType() { return appType_; } // required int64 timestamp = 3; public static final int TIMESTAMP_FIELD_NUMBER = 3; private long timestamp_; /** * required int64 timestamp = 3; */ public boolean hasTimestamp() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int64 timestamp = 3; */ public long getTimestamp() { return timestamp_; } // required string nonce = 4; public static final int NONCE_FIELD_NUMBER = 4; private java.lang.Object nonce_; /** * required string nonce = 4; */ public boolean hasNonce() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * required string nonce = 4; */ public java.lang.String getNonce() { java.lang.Object ref = nonce_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { nonce_ = s; } return s; } } /** * required string nonce = 4; */ public com.google.protobuf.ByteString getNonceBytes() { java.lang.Object ref = nonce_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); nonce_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string signature = 5; public static final int SIGNATURE_FIELD_NUMBER = 5; private java.lang.Object signature_; /** * required string signature = 5; */ public boolean hasSignature() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * required string signature = 5; */ public java.lang.String getSignature() { java.lang.Object ref = signature_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { signature_ = s; } return s; } } /** * required string signature = 5; */ public com.google.protobuf.ByteString getSignatureBytes() { java.lang.Object ref = signature_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); signature_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { appId_ = ""; appType_ = 0; timestamp_ = 0L; nonce_ = ""; signature_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasAppId()) { memoizedIsInitialized = 0; return false; } if (!hasAppType()) { memoizedIsInitialized = 0; return false; } if (!hasTimestamp()) { memoizedIsInitialized = 0; return false; } if (!hasNonce()) { memoizedIsInitialized = 0; return false; } if (!hasSignature()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getAppIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, appType_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeInt64(3, timestamp_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getNonceBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { output.writeBytes(5, getSignatureBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getAppIdBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, appType_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeInt64Size(3, timestamp_); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getNonceBytes()); } if (((bitField0_ & 0x00000010) == 0x00000010)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(5, getSignatureBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code ApplicationConfigRequest} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequestOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_ApplicationConfigRequest_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_ApplicationConfigRequest_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest.class, cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); appId_ = ""; bitField0_ = (bitField0_ & ~0x00000001); appType_ = 0; bitField0_ = (bitField0_ & ~0x00000002); timestamp_ = 0L; bitField0_ = (bitField0_ & ~0x00000004); nonce_ = ""; bitField0_ = (bitField0_ & ~0x00000008); signature_ = ""; bitField0_ = (bitField0_ & ~0x00000010); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_ApplicationConfigRequest_descriptor; } public cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest build() { cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest buildPartial() { cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest result = new cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.appId_ = appId_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.appType_ = appType_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.timestamp_ = timestamp_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.nonce_ = nonce_; if (((from_bitField0_ & 0x00000010) == 0x00000010)) { to_bitField0_ |= 0x00000010; } result.signature_ = signature_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest other) { if (other == cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest.getDefaultInstance()) return this; if (other.hasAppId()) { bitField0_ |= 0x00000001; appId_ = other.appId_; onChanged(); } if (other.hasAppType()) { setAppType(other.getAppType()); } if (other.hasTimestamp()) { setTimestamp(other.getTimestamp()); } if (other.hasNonce()) { bitField0_ |= 0x00000008; nonce_ = other.nonce_; onChanged(); } if (other.hasSignature()) { bitField0_ |= 0x00000010; signature_ = other.signature_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasAppId()) { return false; } if (!hasAppType()) { return false; } if (!hasTimestamp()) { return false; } if (!hasNonce()) { return false; } if (!hasSignature()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.ApplicationConfigRequest) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string appId = 1; private java.lang.Object appId_ = ""; /** * required string appId = 1; */ public boolean hasAppId() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string appId = 1; */ public java.lang.String getAppId() { java.lang.Object ref = appId_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); appId_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string appId = 1; */ public com.google.protobuf.ByteString getAppIdBytes() { java.lang.Object ref = appId_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); appId_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string appId = 1; */ public Builder setAppId( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; appId_ = value; onChanged(); return this; } /** * required string appId = 1; */ public Builder clearAppId() { bitField0_ = (bitField0_ & ~0x00000001); appId_ = getDefaultInstance().getAppId(); onChanged(); return this; } /** * required string appId = 1; */ public Builder setAppIdBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; appId_ = value; onChanged(); return this; } // required int32 appType = 2; private int appType_ ; /** * required int32 appType = 2; */ public boolean hasAppType() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * required int32 appType = 2; */ public int getAppType() { return appType_; } /** * required int32 appType = 2; */ public Builder setAppType(int value) { bitField0_ |= 0x00000002; appType_ = value; onChanged(); return this; } /** * required int32 appType = 2; */ public Builder clearAppType() { bitField0_ = (bitField0_ & ~0x00000002); appType_ = 0; onChanged(); return this; } // required int64 timestamp = 3; private long timestamp_ ; /** * required int64 timestamp = 3; */ public boolean hasTimestamp() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * required int64 timestamp = 3; */ public long getTimestamp() { return timestamp_; } /** * required int64 timestamp = 3; */ public Builder setTimestamp(long value) { bitField0_ |= 0x00000004; timestamp_ = value; onChanged(); return this; } /** * required int64 timestamp = 3; */ public Builder clearTimestamp() { bitField0_ = (bitField0_ & ~0x00000004); timestamp_ = 0L; onChanged(); return this; } // required string nonce = 4; private java.lang.Object nonce_ = ""; /** * required string nonce = 4; */ public boolean hasNonce() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * required string nonce = 4; */ public java.lang.String getNonce() { java.lang.Object ref = nonce_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); nonce_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string nonce = 4; */ public com.google.protobuf.ByteString getNonceBytes() { java.lang.Object ref = nonce_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); nonce_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string nonce = 4; */ public Builder setNonce( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; nonce_ = value; onChanged(); return this; } /** * required string nonce = 4; */ public Builder clearNonce() { bitField0_ = (bitField0_ & ~0x00000008); nonce_ = getDefaultInstance().getNonce(); onChanged(); return this; } /** * required string nonce = 4; */ public Builder setNonceBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000008; nonce_ = value; onChanged(); return this; } // required string signature = 5; private java.lang.Object signature_ = ""; /** * required string signature = 5; */ public boolean hasSignature() { return ((bitField0_ & 0x00000010) == 0x00000010); } /** * required string signature = 5; */ public java.lang.String getSignature() { java.lang.Object ref = signature_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); signature_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string signature = 5; */ public com.google.protobuf.ByteString getSignatureBytes() { java.lang.Object ref = signature_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); signature_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string signature = 5; */ public Builder setSignature( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; signature_ = value; onChanged(); return this; } /** * required string signature = 5; */ public Builder clearSignature() { bitField0_ = (bitField0_ & ~0x00000010); signature_ = getDefaultInstance().getSignature(); onChanged(); return this; } /** * required string signature = 5; */ public Builder setSignatureBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000010; signature_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:ApplicationConfigRequest) } static { defaultInstance = new ApplicationConfigRequest(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:ApplicationConfigRequest) } public interface StringPairOrBuilder extends com.google.protobuf.MessageOrBuilder { // required string key = 1; /** * required string key = 1; */ boolean hasKey(); /** * required string key = 1; */ java.lang.String getKey(); /** * required string key = 1; */ com.google.protobuf.ByteString getKeyBytes(); // optional string value = 2; /** * optional string value = 2; */ boolean hasValue(); /** * optional string value = 2; */ java.lang.String getValue(); /** * optional string value = 2; */ com.google.protobuf.ByteString getValueBytes(); } /** * Protobuf type {@code StringPair} */ public static final class StringPair extends com.google.protobuf.GeneratedMessage implements StringPairOrBuilder { // Use StringPair.newBuilder() to construct. private StringPair(com.google.protobuf.GeneratedMessage.Builder builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private StringPair(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } private static final StringPair defaultInstance; public static StringPair getDefaultInstance() { return defaultInstance; } public StringPair getDefaultInstanceForType() { return defaultInstance; } private final com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override public final com.google.protobuf.UnknownFieldSet getUnknownFields() { return this.unknownFields; } private StringPair( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 10: { bitField0_ |= 0x00000001; key_ = input.readBytes(); break; } case 18: { bitField0_ |= 0x00000002; value_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { throw new com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_StringPair_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_StringPair_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.StringPair.class, cn.wildfirechat.proto.WFCMessage.StringPair.Builder.class); } public static com.google.protobuf.Parser PARSER = new com.google.protobuf.AbstractParser() { public StringPair parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return new StringPair(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser getParserForType() { return PARSER; } private int bitField0_; // required string key = 1; public static final int KEY_FIELD_NUMBER = 1; private java.lang.Object key_; /** * required string key = 1; */ public boolean hasKey() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string key = 1; */ public java.lang.String getKey() { java.lang.Object ref = key_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { key_ = s; } return s; } } /** * required string key = 1; */ public com.google.protobuf.ByteString getKeyBytes() { java.lang.Object ref = key_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); key_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // optional string value = 2; public static final int VALUE_FIELD_NUMBER = 2; private java.lang.Object value_; /** * optional string value = 2; */ public boolean hasValue() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional string value = 2; */ public java.lang.String getValue() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { value_ = s; } return s; } } /** * optional string value = 2; */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } private void initFields() { key_ = ""; value_ = ""; } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasKey()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; } public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeBytes(1, getKeyBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getValueBytes()); } getUnknownFields().writeTo(output); } private int memoizedSerializedSize = -1; public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(1, getKeyBytes()); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getValueBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } private static final long serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { return super.writeReplace(); } public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.StringPair parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } public static cn.wildfirechat.proto.WFCMessage.StringPair parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } public static cn.wildfirechat.proto.WFCMessage.StringPair parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } public static Builder newBuilder(cn.wildfirechat.proto.WFCMessage.StringPair prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code StringPair} */ public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder implements cn.wildfirechat.proto.WFCMessage.StringPairOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { return cn.wildfirechat.proto.WFCMessage.internal_static_StringPair_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return cn.wildfirechat.proto.WFCMessage.internal_static_StringPair_fieldAccessorTable .ensureFieldAccessorsInitialized( cn.wildfirechat.proto.WFCMessage.StringPair.class, cn.wildfirechat.proto.WFCMessage.StringPair.Builder.class); } // Construct using cn.wildfirechat.proto.WFCMessage.StringPair.newBuilder() private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } private static Builder create() { return new Builder(); } public Builder clear() { super.clear(); key_ = ""; bitField0_ = (bitField0_ & ~0x00000001); value_ = ""; bitField0_ = (bitField0_ & ~0x00000002); return this; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return cn.wildfirechat.proto.WFCMessage.internal_static_StringPair_descriptor; } public cn.wildfirechat.proto.WFCMessage.StringPair getDefaultInstanceForType() { return cn.wildfirechat.proto.WFCMessage.StringPair.getDefaultInstance(); } public cn.wildfirechat.proto.WFCMessage.StringPair build() { cn.wildfirechat.proto.WFCMessage.StringPair result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public cn.wildfirechat.proto.WFCMessage.StringPair buildPartial() { cn.wildfirechat.proto.WFCMessage.StringPair result = new cn.wildfirechat.proto.WFCMessage.StringPair(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.key_ = key_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.value_ = value_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof cn.wildfirechat.proto.WFCMessage.StringPair) { return mergeFrom((cn.wildfirechat.proto.WFCMessage.StringPair)other); } else { super.mergeFrom(other); return this; } } public Builder mergeFrom(cn.wildfirechat.proto.WFCMessage.StringPair other) { if (other == cn.wildfirechat.proto.WFCMessage.StringPair.getDefaultInstance()) return this; if (other.hasKey()) { bitField0_ |= 0x00000001; key_ = other.key_; onChanged(); } if (other.hasValue()) { bitField0_ |= 0x00000002; value_ = other.value_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { if (!hasKey()) { return false; } return true; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { cn.wildfirechat.proto.WFCMessage.StringPair parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (cn.wildfirechat.proto.WFCMessage.StringPair) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } return this; } private int bitField0_; // required string key = 1; private java.lang.Object key_ = ""; /** * required string key = 1; */ public boolean hasKey() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * required string key = 1; */ public java.lang.String getKey() { java.lang.Object ref = key_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); key_ = s; return s; } else { return (java.lang.String) ref; } } /** * required string key = 1; */ public com.google.protobuf.ByteString getKeyBytes() { java.lang.Object ref = key_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); key_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * required string key = 1; */ public Builder setKey( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; key_ = value; onChanged(); return this; } /** * required string key = 1; */ public Builder clearKey() { bitField0_ = (bitField0_ & ~0x00000001); key_ = getDefaultInstance().getKey(); onChanged(); return this; } /** * required string key = 1; */ public Builder setKeyBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000001; key_ = value; onChanged(); return this; } // optional string value = 2; private java.lang.Object value_ = ""; /** * optional string value = 2; */ public boolean hasValue() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * optional string value = 2; */ public java.lang.String getValue() { java.lang.Object ref = value_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); value_ = s; return s; } else { return (java.lang.String) ref; } } /** * optional string value = 2; */ public com.google.protobuf.ByteString getValueBytes() { java.lang.Object ref = value_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); value_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * optional string value = 2; */ public Builder setValue( java.lang.String value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; value_ = value; onChanged(); return this; } /** * optional string value = 2; */ public Builder clearValue() { bitField0_ = (bitField0_ & ~0x00000002); value_ = getDefaultInstance().getValue(); onChanged(); return this; } /** * optional string value = 2; */ public Builder setValueBytes( com.google.protobuf.ByteString value) { if (value == null) { throw new NullPointerException(); } bitField0_ |= 0x00000002; value_ = value; onChanged(); return this; } // @@protoc_insertion_point(builder_scope:StringPair) } static { defaultInstance = new StringPair(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:StringPair) } private static com.google.protobuf.Descriptors.Descriptor internal_static_AddFriendRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_AddFriendRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_Conversation_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_Conversation_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_GroupInfo_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_GroupInfo_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_GroupMember_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_GroupMember_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_Group_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_Group_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ChannelMenu_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ChannelMenu_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ChannelMenuList_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ChannelMenuList_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ChannelInfo_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ChannelInfo_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ModifyChannelInfo_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ModifyChannelInfo_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_TransferChannel_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_TransferChannel_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_PullChannelInfo_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_PullChannelInfo_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_PullChannelListener_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_PullChannelListener_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_PullChannelListenerResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_PullChannelListenerResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ListenChannel_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ListenChannel_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_SearchChannelResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_SearchChannelResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_MessageContent_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_MessageContent_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_AddGroupMemberRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_AddGroupMemberRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_CreateGroupRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_CreateGroupRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_DismissGroupRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_DismissGroupRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_FriendRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_FriendRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_GeneralResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_GeneralResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_GetUploadTokenRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_GetUploadTokenRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_GetUploadTokenResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_GetUploadTokenResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_HandleFriendRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_HandleFriendRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_IDBuf_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_IDBuf_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_IDListBuf_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_IDListBuf_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_Message_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_Message_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_User_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_User_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_Robot_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_Robot_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_GetRobotsResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_GetRobotsResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_UploadDeviceTokenRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_UploadDeviceTokenRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ModifyGroupInfoRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ModifyGroupInfoRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_SetGroupManagerRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_SetGroupManagerRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_InfoEntry_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_InfoEntry_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ModifyMyInfoRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ModifyMyInfoRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_NotifyMessage_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_NotifyMessage_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_PullMessageRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_PullMessageRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_PullMessageResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_PullMessageResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_PullGroupInfoResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_PullGroupInfoResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_PullGroupMemberRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_PullGroupMemberRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_PullGroupMemberResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_PullGroupMemberResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_UserRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_UserRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_PullUserRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_PullUserRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_UserResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_UserResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_PullUserResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_PullUserResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_QuitGroupRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_QuitGroupRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_RemoveGroupMemberRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_RemoveGroupMemberRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_TransferGroupRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_TransferGroupRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ModifyGroupMemberAlias_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ModifyGroupMemberAlias_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ModifyGroupMemberExtra_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ModifyGroupMemberExtra_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_UserSettingEntry_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_UserSettingEntry_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ModifyUserSettingReq_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ModifyUserSettingReq_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_Version_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_Version_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_GetUserSettingResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_GetUserSettingResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_Friend_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_Friend_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_GetFriendsResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_GetFriendsResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_GetFriendRequestResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_GetFriendRequestResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ConnectAckPayload_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ConnectAckPayload_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_IMHttpWrapper_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_IMHttpWrapper_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_SearchUserRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_SearchUserRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_SearchUserResult_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_SearchUserResult_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_GetChatroomInfoRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_GetChatroomInfoRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ChatroomInfo_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ChatroomInfo_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_GetChatroomMemberInfoRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_GetChatroomMemberInfoRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ChatroomMemberInfo_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ChatroomMemberInfo_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_INT64Buf_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_INT64Buf_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_NotifyRecallMessage_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_NotifyRecallMessage_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_BlackUserRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_BlackUserRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_RouteRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_RouteRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_RouteResponse_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_RouteResponse_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_GetTokenRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_GetTokenRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_LoadRemoteMessages_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_LoadRemoteMessages_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_MultiCastMessage_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_MultiCastMessage_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_RecallMultiCastMessageRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_RecallMultiCastMessageRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_AuthCodeRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_AuthCodeRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_ApplicationConfigRequest_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_ApplicationConfigRequest_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor internal_static_StringPair_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_StringPair_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } private static com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n\032wfcmessage_community.proto\"E\n\020AddFrien" + "dRequest\022\022\n\ntarget_uid\030\001 \002(\t\022\016\n\006reason\030\002" + " \002(\t\022\r\n\005extra\030\003 \001(\t\":\n\014Conversation\022\014\n\004t" + "ype\030\001 \002(\005\022\016\n\006target\030\002 \002(\t\022\014\n\004line\030\003 \002(\005\"" + "\321\002\n\tGroupInfo\022\021\n\ttarget_id\030\001 \001(\t\022\014\n\004name" + "\030\002 \002(\t\022\020\n\010portrait\030\003 \001(\t\022\r\n\005owner\030\004 \001(\t\022" + "\014\n\004type\030\005 \002(\005\022\024\n\014member_count\030\006 \001(\005\022\r\n\005e" + "xtra\030\007 \001(\t\022\021\n\tupdate_dt\030\010 \001(\003\022\030\n\020member_" + "update_dt\030\t \001(\003\022\014\n\004mute\030\n \001(\005\022\021\n\tjoin_ty" + "pe\030\013 \001(\005\022\024\n\014private_chat\030\014 \001(\005\022\022\n\nsearch", "able\030\r \001(\005\022\030\n\020max_member_count\030\016 \001(\005\022\027\n\017" + "history_message\030\017 \001(\005\022\023\n\013super_group\030\020 \001" + "(\005\022\017\n\007deleted\030\021 \001(\005\"r\n\013GroupMember\022\021\n\tme" + "mber_id\030\001 \002(\t\022\r\n\005alias\030\002 \001(\t\022\014\n\004type\030\003 \002" + "(\005\022\021\n\tupdate_dt\030\004 \001(\003\022\021\n\tcreate_dt\030\005 \001(\003" + "\022\r\n\005extra\030\006 \001(\t\"F\n\005Group\022\036\n\ngroup_info\030\001" + " \002(\0132\n.GroupInfo\022\035\n\007members\030\002 \003(\0132\014.Grou" + "pMember\"\313\001\n\013ChannelMenu\022\014\n\004type\030\001 \002(\t\022\014\n" + "\004name\030\002 \002(\t\022\013\n\003key\030\003 \001(\t\022\013\n\003url\030\004 \001(\t\022\020\n" + "\010media_id\030\005 \001(\t\022\022\n\narticle_id\030\006 \001(\t\022\016\n\006a", "pp_id\030\007 \001(\t\022\020\n\010app_page\030\010 \001(\t\022\036\n\010sub_men" + "u\030\t \003(\0132\014.ChannelMenu\022\017\n\007menu_id\030\n \001(\t\022\r" + "\n\005extra\030\013 \001(\t\"-\n\017ChannelMenuList\022\032\n\004menu" + "\030\001 \003(\0132\014.ChannelMenu\"\340\001\n\013ChannelInfo\022\021\n\t" + "target_id\030\001 \001(\t\022\014\n\004name\030\002 \002(\t\022\020\n\010portrai" + "t\030\003 \001(\t\022\r\n\005owner\030\004 \001(\t\022\016\n\006status\030\005 \001(\005\022\014" + "\n\004desc\030\006 \001(\t\022\r\n\005extra\030\007 \001(\t\022\021\n\tupdate_dt" + "\030\010 \001(\003\022\016\n\006secret\030\t \001(\t\022\020\n\010callback\030\n \001(\t" + "\022\021\n\tautomatic\030\013 \001(\005\022\032\n\004menu\030\014 \003(\0132\014.Chan" + "nelMenu\"D\n\021ModifyChannelInfo\022\022\n\nchannel_", "id\030\001 \002(\t\022\014\n\004type\030\002 \002(\005\022\r\n\005value\030\003 \002(\t\"8\n" + "\017TransferChannel\022\022\n\nchannel_id\030\001 \002(\t\022\021\n\t" + "new_owner\030\002 \002(\t\"3\n\017PullChannelInfo\022\022\n\nch" + "annel_id\030\001 \002(\t\022\014\n\004head\030\002 \002(\003\"H\n\023PullChan" + "nelListener\022\022\n\nchannel_id\030\001 \002(\t\022\016\n\006offse" + "t\030\002 \002(\005\022\r\n\005count\030\003 \002(\005\"R\n\031PullChannelLis" + "tenerResult\022\023\n\013total_count\030\001 \002(\005\022\016\n\006offs" + "et\030\002 \002(\005\022\020\n\010listener\030\003 \003(\t\"3\n\rListenChan" + "nel\022\022\n\nchannel_id\030\001 \002(\t\022\016\n\006listen\030\002 \002(\005\"" + "E\n\023SearchChannelResult\022\035\n\007channel\030\001 \003(\0132", "\014.ChannelInfo\022\017\n\007keyword\030\002 \002(\t\"\235\002\n\016Messa" + "geContent\022\014\n\004type\030\001 \002(\005\022\032\n\022searchable_co" + "ntent\030\002 \001(\t\022\024\n\014push_content\030\003 \001(\t\022\017\n\007con" + "tent\030\004 \001(\t\022\014\n\004data\030\005 \001(\014\022\021\n\tmediaType\030\006 " + "\001(\005\022\026\n\016remoteMediaUrl\030\007 \001(\t\022\024\n\014persist_f" + "lag\030\010 \001(\005\022\027\n\017expire_duration\030\t \001(\005\022\026\n\016me" + "ntioned_type\030\n \001(\005\022\030\n\020mentioned_target\030\013" + " \003(\t\022\r\n\005extra\030\014 \001(\t\022\021\n\tpush_data\030\r \001(\t\"\226" + "\001\n\025AddGroupMemberRequest\022\020\n\010group_id\030\001 \002" + "(\t\022\"\n\014added_member\030\002 \003(\0132\014.GroupMember\022\017", "\n\007to_line\030\003 \003(\005\022\'\n\016notify_content\030\004 \001(\0132" + "\017.MessageContent\022\r\n\005extra\030\005 \001(\t\"{\n\022Creat" + "eGroupRequest\022\025\n\005group\030\001 \002(\0132\006.Group\022\017\n\007" + "to_line\030\002 \003(\005\022\'\n\016notify_content\030\003 \001(\0132\017." + "MessageContent\022\024\n\014member_extra\030\004 \001(\t\"a\n\023" + "DismissGroupRequest\022\020\n\010group_id\030\001 \002(\t\022\017\n" + "\007to_line\030\002 \003(\005\022\'\n\016notify_content\030\003 \001(\0132\017" + ".MessageContent\"\245\001\n\rFriendRequest\022\020\n\010fro" + "m_uid\030\001 \001(\t\022\016\n\006to_uid\030\002 \002(\t\022\016\n\006reason\030\003 " + "\002(\t\022\016\n\006status\030\004 \001(\005\022\021\n\tupdate_dt\030\005 \001(\003\022\030", "\n\020from_read_status\030\006 \001(\010\022\026\n\016to_read_stat" + "us\030\007 \001(\010\022\r\n\005extra\030\010 \001(\t\"#\n\rGeneralResult" + "\022\022\n\nerror_code\030\001 \002(\005\"?\n\025GetUploadTokenRe" + "quest\022\022\n\nmedia_type\030\001 \002(\005\022\022\n\nmedia_path\030" + "\002 \002(\t\"S\n\024GetUploadTokenResult\022\016\n\006domain\030" + "\001 \002(\t\022\r\n\005token\030\002 \002(\t\022\016\n\006server\030\003 \002(\t\022\014\n\004" + "port\030\004 \001(\005\"H\n\023HandleFriendRequest\022\022\n\ntar" + "get_uid\030\001 \002(\t\022\016\n\006status\030\002 \002(\005\022\r\n\005extra\030\003" + " \001(\t\"\023\n\005IDBuf\022\n\n\002id\030\001 \002(\t\"\027\n\tIDListBuf\022\n" + "\n\002id\030\001 \003(\t\"\256\001\n\007Message\022#\n\014conversation\030\001", " \002(\0132\r.Conversation\022\021\n\tfrom_user\030\002 \002(\t\022 " + "\n\007content\030\003 \002(\0132\017.MessageContent\022\022\n\nmess" + "age_id\030\004 \001(\003\022\030\n\020server_timestamp\030\005 \001(\003\022\017" + "\n\007to_user\030\006 \001(\t\022\n\n\002to\030\007 \003(\t\"\353\001\n\004User\022\013\n\003" + "uid\030\001 \002(\t\022\014\n\004name\030\002 \001(\t\022\024\n\014display_name\030" + "\003 \001(\t\022\020\n\010portrait\030\004 \001(\t\022\016\n\006mobile\030\005 \001(\t\022" + "\r\n\005email\030\006 \001(\t\022\017\n\007address\030\007 \001(\t\022\017\n\007compa" + "ny\030\010 \001(\t\022\r\n\005extra\030\t \001(\t\022\021\n\tupdate_dt\030\n \001" + "(\003\022\016\n\006gender\030\013 \001(\005\022\016\n\006social\030\014 \001(\t\022\014\n\004ty" + "pe\030\r \001(\005\022\017\n\007deleted\030\016 \001(\005\"c\n\005Robot\022\013\n\003ui", "d\030\001 \002(\t\022\r\n\005state\030\002 \002(\005\022\r\n\005owner\030\003 \001(\t\022\016\n" + "\006secret\030\004 \001(\t\022\020\n\010callback\030\005 \001(\t\022\r\n\005extra" + "\030\006 \001(\t\"(\n\017GetRobotsResult\022\025\n\005entry\030\001 \003(\013" + "2\006.Robot\"g\n\030UploadDeviceTokenRequest\022\020\n\010" + "platform\030\001 \002(\005\022\020\n\010app_name\030\002 \002(\t\022\024\n\014devi" + "ce_token\030\003 \002(\t\022\021\n\tpush_type\030\004 \002(\005\"\201\001\n\026Mo" + "difyGroupInfoRequest\022\020\n\010group_id\030\001 \002(\t\022\014" + "\n\004type\030\002 \002(\005\022\r\n\005value\030\003 \002(\t\022\017\n\007to_line\030\004" + " \003(\005\022\'\n\016notify_content\030\005 \001(\0132\017.MessageCo" + "ntent\"\203\001\n\026SetGroupManagerRequest\022\020\n\010grou", "p_id\030\001 \002(\t\022\014\n\004type\030\002 \002(\005\022\017\n\007user_id\030\003 \003(" + "\t\022\017\n\007to_line\030\004 \003(\005\022\'\n\016notify_content\030\005 \001" + "(\0132\017.MessageContent\"(\n\tInfoEntry\022\014\n\004type" + "\030\001 \002(\005\022\r\n\005value\030\002 \002(\t\"0\n\023ModifyMyInfoReq" + "uest\022\031\n\005entry\030\001 \003(\0132\n.InfoEntry\";\n\rNotif" + "yMessage\022\014\n\004type\030\001 \002(\005\022\014\n\004head\030\002 \002(\003\022\016\n\006" + "target\030\003 \001(\t\"=\n\022PullMessageRequest\022\n\n\002id" + "\030\001 \002(\003\022\014\n\004type\030\002 \002(\005\022\r\n\005delay\030\003 \001(\003\"M\n\021P" + "ullMessageResult\022\031\n\007message\030\001 \003(\0132\010.Mess" + "age\022\017\n\007current\030\002 \002(\003\022\014\n\004head\030\003 \002(\003\"/\n\023Pu", "llGroupInfoResult\022\030\n\004info\030\001 \003(\0132\n.GroupI" + "nfo\"6\n\026PullGroupMemberRequest\022\016\n\006target\030" + "\001 \002(\t\022\014\n\004head\030\002 \002(\003\"5\n\025PullGroupMemberRe" + "sult\022\034\n\006member\030\001 \003(\0132\014.GroupMember\"-\n\013Us" + "erRequest\022\013\n\003uid\030\001 \002(\t\022\021\n\tupdate_dt\030\002 \001(" + "\003\"0\n\017PullUserRequest\022\035\n\007request\030\001 \003(\0132\014." + "UserRequest\"/\n\nUserResult\022\023\n\004user\030\001 \002(\0132" + "\005.User\022\014\n\004code\030\002 \002(\005\"-\n\016PullUserResult\022\033" + "\n\006result\030\001 \003(\0132\013.UserResult\"p\n\020QuitGroup" + "Request\022\020\n\010group_id\030\001 \002(\t\022\017\n\007to_line\030\002 \003", "(\005\022\'\n\016notify_content\030\003 \001(\0132\017.MessageCont" + "ent\022\020\n\010keep_msg\030\004 \001(\005\"~\n\030RemoveGroupMemb" + "erRequest\022\020\n\010group_id\030\001 \002(\t\022\026\n\016removed_m" + "ember\030\002 \003(\t\022\017\n\007to_line\030\003 \003(\005\022\'\n\016notify_c" + "ontent\030\004 \001(\0132\017.MessageContent\"u\n\024Transfe" + "rGroupRequest\022\020\n\010group_id\030\001 \002(\t\022\021\n\tnew_o" + "wner\030\002 \002(\t\022\017\n\007to_line\030\003 \003(\005\022\'\n\016notify_co" + "ntent\030\004 \001(\0132\017.MessageContent\"\206\001\n\026ModifyG" + "roupMemberAlias\022\020\n\010group_id\030\001 \002(\t\022\r\n\005ali" + "as\030\002 \002(\t\022\017\n\007to_line\030\003 \003(\005\022\'\n\016notify_cont", "ent\030\004 \001(\0132\017.MessageContent\022\021\n\tmember_id\030" + "\005 \001(\t\"\206\001\n\026ModifyGroupMemberExtra\022\020\n\010grou" + "p_id\030\001 \002(\t\022\017\n\007to_line\030\002 \003(\005\022\'\n\016notify_co" + "ntent\030\003 \001(\0132\017.MessageContent\022\r\n\005extra\030\004 " + "\001(\t\022\021\n\tmember_id\030\005 \001(\t\"P\n\020UserSettingEnt" + "ry\022\r\n\005scope\030\001 \002(\005\022\013\n\003key\030\002 \002(\t\022\r\n\005value\030" + "\003 \002(\t\022\021\n\tupdate_dt\030\004 \002(\003\"A\n\024ModifyUserSe" + "ttingReq\022\r\n\005scope\030\001 \002(\005\022\013\n\003key\030\002 \002(\t\022\r\n\005" + "value\030\003 \002(\t\"\032\n\007Version\022\017\n\007version\030\001 \002(\003\"" + "8\n\024GetUserSettingResult\022 \n\005entry\030\001 \003(\0132\021", ".UserSettingEntry\"f\n\006Friend\022\013\n\003uid\030\001 \002(\t" + "\022\r\n\005state\030\002 \002(\005\022\021\n\tupdate_dt\030\003 \002(\003\022\r\n\005al" + "ias\030\004 \001(\t\022\017\n\007blacked\030\005 \001(\005\022\r\n\005extra\030\006 \001(" + "\t\"*\n\020GetFriendsResult\022\026\n\005entry\030\001 \003(\0132\007.F" + "riend\"7\n\026GetFriendRequestResult\022\035\n\005entry" + "\030\001 \003(\0132\016.FriendRequest\"\243\001\n\021ConnectAckPay" + "load\022\020\n\010msg_head\030\001 \001(\003\022\023\n\013friend_head\030\002 " + "\001(\003\022\026\n\016friend_rq_head\030\003 \001(\003\022\024\n\014setting_h" + "ead\030\004 \001(\003\022\021\n\tnode_addr\030\005 \001(\t\022\021\n\tnode_por" + "t\030\006 \001(\005\022\023\n\013server_time\030\007 \001(\003\"P\n\rIMHttpWr", "apper\022\r\n\005token\030\001 \002(\t\022\021\n\tclient_id\030\002 \002(\t\022" + "\017\n\007request\030\003 \002(\t\022\014\n\004data\030\004 \001(\014\"b\n\021Search" + "UserRequest\022\017\n\007keyword\030\001 \002(\t\022\r\n\005fuzzy\030\002 " + "\001(\005\022\014\n\004page\030\003 \001(\005\022\021\n\tdomain_id\030\004 \001(\t\022\014\n\004" + "type\030\005 \001(\005\"(\n\020SearchUserResult\022\024\n\005entry\030" + "\001 \003(\0132\005.User\"@\n\026GetChatroomInfoRequest\022\023" + "\n\013chatroom_id\030\001 \002(\t\022\021\n\tupdate_dt\030\002 \001(\003\"\227" + "\001\n\014ChatroomInfo\022\r\n\005title\030\001 \002(\t\022\014\n\004desc\030\002" + " \001(\t\022\020\n\010portrait\030\003 \001(\t\022\024\n\014member_count\030\004" + " \001(\005\022\021\n\tcreate_dt\030\005 \001(\003\022\021\n\tupdate_dt\030\006 \001", "(\003\022\r\n\005extra\030\007 \001(\t\022\r\n\005state\030\010 \001(\005\"F\n\034GetC" + "hatroomMemberInfoRequest\022\023\n\013chatroom_id\030" + "\001 \002(\t\022\021\n\tmax_count\030\002 \001(\005\";\n\022ChatroomMemb" + "erInfo\022\024\n\014member_count\030\001 \001(\005\022\017\n\007members\030" + "\002 \003(\t\"\026\n\010INT64Buf\022\n\n\002id\030\001 \002(\003\"4\n\023NotifyR" + "ecallMessage\022\n\n\002id\030\001 \002(\003\022\021\n\tfrom_user\030\002 " + "\002(\t\"/\n\020BlackUserRequest\022\013\n\003uid\030\001 \002(\t\022\016\n\006" + "status\030\002 \002(\005\"\323\001\n\014RouteRequest\022\013\n\003app\030\001 \001" + "(\t\022\020\n\010platform\030\002 \001(\005\022\021\n\tpush_type\030\003 \001(\005\022" + "\023\n\013device_name\030\004 \001(\t\022\026\n\016device_version\030\005", " \001(\t\022\022\n\nphone_name\030\006 \001(\t\022\020\n\010language\030\007 \001" + "(\t\022\024\n\014carrier_name\030\010 \001(\t\022\023\n\013app_version\030" + "\t \001(\t\022\023\n\013sdk_version\030\n \001(\t\"D\n\rRouteRespo" + "nse\022\014\n\004host\030\001 \002(\t\022\021\n\tlong_port\030\002 \002(\005\022\022\n\n" + "short_port\030\003 \002(\005\"G\n\017GetTokenRequest\022\017\n\007u" + "ser_id\030\001 \002(\t\022\021\n\tclient_id\030\002 \002(\t\022\020\n\010platf" + "orm\030\003 \001(\005\"r\n\022LoadRemoteMessages\022#\n\014conve" + "rsation\030\001 \002(\0132\r.Conversation\022\022\n\nbefore_u" + "id\030\002 \002(\003\022\r\n\005count\030\003 \002(\005\022\024\n\014content_type\030" + "\004 \003(\005\"a\n\020MultiCastMessage\022\021\n\tfrom_user\030\001", " \002(\t\022 \n\007content\030\002 \002(\0132\017.MessageContent\022\n" + "\n\002to\030\003 \003(\t\022\014\n\004line\030\004 \002(\005\"E\n\035RecallMultiC" + "astMessageRequest\022\022\n\nmessage_id\030\001 \002(\003\022\020\n" + "\010receiver\030\002 \003(\t\"@\n\017AuthCodeRequest\022\021\n\tta" + "rget_id\030\001 \002(\t\022\014\n\004type\030\002 \002(\005\022\014\n\004host\030\003 \002(" + "\t\"o\n\030ApplicationConfigRequest\022\r\n\005appId\030\001" + " \002(\t\022\017\n\007appType\030\002 \002(\005\022\021\n\ttimestamp\030\003 \002(\003" + "\022\r\n\005nonce\030\004 \002(\t\022\021\n\tsignature\030\005 \002(\t\"(\n\nSt" + "ringPair\022\013\n\003key\030\001 \002(\t\022\r\n\005value\030\002 \001(\tB/\n\025" + "cn.wildfirechat.protoB\nWFCMessageZ\n./go;", "proto" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.Descriptors.FileDescriptor root) { descriptor = root; internal_static_AddFriendRequest_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_AddFriendRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_AddFriendRequest_descriptor, new java.lang.String[] { "TargetUid", "Reason", "Extra", }); internal_static_Conversation_descriptor = getDescriptor().getMessageTypes().get(1); internal_static_Conversation_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_Conversation_descriptor, new java.lang.String[] { "Type", "Target", "Line", }); internal_static_GroupInfo_descriptor = getDescriptor().getMessageTypes().get(2); internal_static_GroupInfo_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_GroupInfo_descriptor, new java.lang.String[] { "TargetId", "Name", "Portrait", "Owner", "Type", "MemberCount", "Extra", "UpdateDt", "MemberUpdateDt", "Mute", "JoinType", "PrivateChat", "Searchable", "MaxMemberCount", "HistoryMessage", "SuperGroup", "Deleted", }); internal_static_GroupMember_descriptor = getDescriptor().getMessageTypes().get(3); internal_static_GroupMember_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_GroupMember_descriptor, new java.lang.String[] { "MemberId", "Alias", "Type", "UpdateDt", "CreateDt", "Extra", }); internal_static_Group_descriptor = getDescriptor().getMessageTypes().get(4); internal_static_Group_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_Group_descriptor, new java.lang.String[] { "GroupInfo", "Members", }); internal_static_ChannelMenu_descriptor = getDescriptor().getMessageTypes().get(5); internal_static_ChannelMenu_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ChannelMenu_descriptor, new java.lang.String[] { "Type", "Name", "Key", "Url", "MediaId", "ArticleId", "AppId", "AppPage", "SubMenu", "MenuId", "Extra", }); internal_static_ChannelMenuList_descriptor = getDescriptor().getMessageTypes().get(6); internal_static_ChannelMenuList_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ChannelMenuList_descriptor, new java.lang.String[] { "Menu", }); internal_static_ChannelInfo_descriptor = getDescriptor().getMessageTypes().get(7); internal_static_ChannelInfo_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ChannelInfo_descriptor, new java.lang.String[] { "TargetId", "Name", "Portrait", "Owner", "Status", "Desc", "Extra", "UpdateDt", "Secret", "Callback", "Automatic", "Menu", }); internal_static_ModifyChannelInfo_descriptor = getDescriptor().getMessageTypes().get(8); internal_static_ModifyChannelInfo_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ModifyChannelInfo_descriptor, new java.lang.String[] { "ChannelId", "Type", "Value", }); internal_static_TransferChannel_descriptor = getDescriptor().getMessageTypes().get(9); internal_static_TransferChannel_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_TransferChannel_descriptor, new java.lang.String[] { "ChannelId", "NewOwner", }); internal_static_PullChannelInfo_descriptor = getDescriptor().getMessageTypes().get(10); internal_static_PullChannelInfo_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_PullChannelInfo_descriptor, new java.lang.String[] { "ChannelId", "Head", }); internal_static_PullChannelListener_descriptor = getDescriptor().getMessageTypes().get(11); internal_static_PullChannelListener_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_PullChannelListener_descriptor, new java.lang.String[] { "ChannelId", "Offset", "Count", }); internal_static_PullChannelListenerResult_descriptor = getDescriptor().getMessageTypes().get(12); internal_static_PullChannelListenerResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_PullChannelListenerResult_descriptor, new java.lang.String[] { "TotalCount", "Offset", "Listener", }); internal_static_ListenChannel_descriptor = getDescriptor().getMessageTypes().get(13); internal_static_ListenChannel_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ListenChannel_descriptor, new java.lang.String[] { "ChannelId", "Listen", }); internal_static_SearchChannelResult_descriptor = getDescriptor().getMessageTypes().get(14); internal_static_SearchChannelResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_SearchChannelResult_descriptor, new java.lang.String[] { "Channel", "Keyword", }); internal_static_MessageContent_descriptor = getDescriptor().getMessageTypes().get(15); internal_static_MessageContent_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_MessageContent_descriptor, new java.lang.String[] { "Type", "SearchableContent", "PushContent", "Content", "Data", "MediaType", "RemoteMediaUrl", "PersistFlag", "ExpireDuration", "MentionedType", "MentionedTarget", "Extra", "PushData", }); internal_static_AddGroupMemberRequest_descriptor = getDescriptor().getMessageTypes().get(16); internal_static_AddGroupMemberRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_AddGroupMemberRequest_descriptor, new java.lang.String[] { "GroupId", "AddedMember", "ToLine", "NotifyContent", "Extra", }); internal_static_CreateGroupRequest_descriptor = getDescriptor().getMessageTypes().get(17); internal_static_CreateGroupRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_CreateGroupRequest_descriptor, new java.lang.String[] { "Group", "ToLine", "NotifyContent", "MemberExtra", }); internal_static_DismissGroupRequest_descriptor = getDescriptor().getMessageTypes().get(18); internal_static_DismissGroupRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_DismissGroupRequest_descriptor, new java.lang.String[] { "GroupId", "ToLine", "NotifyContent", }); internal_static_FriendRequest_descriptor = getDescriptor().getMessageTypes().get(19); internal_static_FriendRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_FriendRequest_descriptor, new java.lang.String[] { "FromUid", "ToUid", "Reason", "Status", "UpdateDt", "FromReadStatus", "ToReadStatus", "Extra", }); internal_static_GeneralResult_descriptor = getDescriptor().getMessageTypes().get(20); internal_static_GeneralResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_GeneralResult_descriptor, new java.lang.String[] { "ErrorCode", }); internal_static_GetUploadTokenRequest_descriptor = getDescriptor().getMessageTypes().get(21); internal_static_GetUploadTokenRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_GetUploadTokenRequest_descriptor, new java.lang.String[] { "MediaType", "MediaPath", }); internal_static_GetUploadTokenResult_descriptor = getDescriptor().getMessageTypes().get(22); internal_static_GetUploadTokenResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_GetUploadTokenResult_descriptor, new java.lang.String[] { "Domain", "Token", "Server", "Port", }); internal_static_HandleFriendRequest_descriptor = getDescriptor().getMessageTypes().get(23); internal_static_HandleFriendRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_HandleFriendRequest_descriptor, new java.lang.String[] { "TargetUid", "Status", "Extra", }); internal_static_IDBuf_descriptor = getDescriptor().getMessageTypes().get(24); internal_static_IDBuf_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_IDBuf_descriptor, new java.lang.String[] { "Id", }); internal_static_IDListBuf_descriptor = getDescriptor().getMessageTypes().get(25); internal_static_IDListBuf_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_IDListBuf_descriptor, new java.lang.String[] { "Id", }); internal_static_Message_descriptor = getDescriptor().getMessageTypes().get(26); internal_static_Message_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_Message_descriptor, new java.lang.String[] { "Conversation", "FromUser", "Content", "MessageId", "ServerTimestamp", "ToUser", "To", }); internal_static_User_descriptor = getDescriptor().getMessageTypes().get(27); internal_static_User_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_User_descriptor, new java.lang.String[] { "Uid", "Name", "DisplayName", "Portrait", "Mobile", "Email", "Address", "Company", "Extra", "UpdateDt", "Gender", "Social", "Type", "Deleted", }); internal_static_Robot_descriptor = getDescriptor().getMessageTypes().get(28); internal_static_Robot_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_Robot_descriptor, new java.lang.String[] { "Uid", "State", "Owner", "Secret", "Callback", "Extra", }); internal_static_GetRobotsResult_descriptor = getDescriptor().getMessageTypes().get(29); internal_static_GetRobotsResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_GetRobotsResult_descriptor, new java.lang.String[] { "Entry", }); internal_static_UploadDeviceTokenRequest_descriptor = getDescriptor().getMessageTypes().get(30); internal_static_UploadDeviceTokenRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_UploadDeviceTokenRequest_descriptor, new java.lang.String[] { "Platform", "AppName", "DeviceToken", "PushType", }); internal_static_ModifyGroupInfoRequest_descriptor = getDescriptor().getMessageTypes().get(31); internal_static_ModifyGroupInfoRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ModifyGroupInfoRequest_descriptor, new java.lang.String[] { "GroupId", "Type", "Value", "ToLine", "NotifyContent", }); internal_static_SetGroupManagerRequest_descriptor = getDescriptor().getMessageTypes().get(32); internal_static_SetGroupManagerRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_SetGroupManagerRequest_descriptor, new java.lang.String[] { "GroupId", "Type", "UserId", "ToLine", "NotifyContent", }); internal_static_InfoEntry_descriptor = getDescriptor().getMessageTypes().get(33); internal_static_InfoEntry_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_InfoEntry_descriptor, new java.lang.String[] { "Type", "Value", }); internal_static_ModifyMyInfoRequest_descriptor = getDescriptor().getMessageTypes().get(34); internal_static_ModifyMyInfoRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ModifyMyInfoRequest_descriptor, new java.lang.String[] { "Entry", }); internal_static_NotifyMessage_descriptor = getDescriptor().getMessageTypes().get(35); internal_static_NotifyMessage_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_NotifyMessage_descriptor, new java.lang.String[] { "Type", "Head", "Target", }); internal_static_PullMessageRequest_descriptor = getDescriptor().getMessageTypes().get(36); internal_static_PullMessageRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_PullMessageRequest_descriptor, new java.lang.String[] { "Id", "Type", "Delay", }); internal_static_PullMessageResult_descriptor = getDescriptor().getMessageTypes().get(37); internal_static_PullMessageResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_PullMessageResult_descriptor, new java.lang.String[] { "Message", "Current", "Head", }); internal_static_PullGroupInfoResult_descriptor = getDescriptor().getMessageTypes().get(38); internal_static_PullGroupInfoResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_PullGroupInfoResult_descriptor, new java.lang.String[] { "Info", }); internal_static_PullGroupMemberRequest_descriptor = getDescriptor().getMessageTypes().get(39); internal_static_PullGroupMemberRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_PullGroupMemberRequest_descriptor, new java.lang.String[] { "Target", "Head", }); internal_static_PullGroupMemberResult_descriptor = getDescriptor().getMessageTypes().get(40); internal_static_PullGroupMemberResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_PullGroupMemberResult_descriptor, new java.lang.String[] { "Member", }); internal_static_UserRequest_descriptor = getDescriptor().getMessageTypes().get(41); internal_static_UserRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_UserRequest_descriptor, new java.lang.String[] { "Uid", "UpdateDt", }); internal_static_PullUserRequest_descriptor = getDescriptor().getMessageTypes().get(42); internal_static_PullUserRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_PullUserRequest_descriptor, new java.lang.String[] { "Request", }); internal_static_UserResult_descriptor = getDescriptor().getMessageTypes().get(43); internal_static_UserResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_UserResult_descriptor, new java.lang.String[] { "User", "Code", }); internal_static_PullUserResult_descriptor = getDescriptor().getMessageTypes().get(44); internal_static_PullUserResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_PullUserResult_descriptor, new java.lang.String[] { "Result", }); internal_static_QuitGroupRequest_descriptor = getDescriptor().getMessageTypes().get(45); internal_static_QuitGroupRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_QuitGroupRequest_descriptor, new java.lang.String[] { "GroupId", "ToLine", "NotifyContent", "KeepMsg", }); internal_static_RemoveGroupMemberRequest_descriptor = getDescriptor().getMessageTypes().get(46); internal_static_RemoveGroupMemberRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_RemoveGroupMemberRequest_descriptor, new java.lang.String[] { "GroupId", "RemovedMember", "ToLine", "NotifyContent", }); internal_static_TransferGroupRequest_descriptor = getDescriptor().getMessageTypes().get(47); internal_static_TransferGroupRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_TransferGroupRequest_descriptor, new java.lang.String[] { "GroupId", "NewOwner", "ToLine", "NotifyContent", }); internal_static_ModifyGroupMemberAlias_descriptor = getDescriptor().getMessageTypes().get(48); internal_static_ModifyGroupMemberAlias_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ModifyGroupMemberAlias_descriptor, new java.lang.String[] { "GroupId", "Alias", "ToLine", "NotifyContent", "MemberId", }); internal_static_ModifyGroupMemberExtra_descriptor = getDescriptor().getMessageTypes().get(49); internal_static_ModifyGroupMemberExtra_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ModifyGroupMemberExtra_descriptor, new java.lang.String[] { "GroupId", "ToLine", "NotifyContent", "Extra", "MemberId", }); internal_static_UserSettingEntry_descriptor = getDescriptor().getMessageTypes().get(50); internal_static_UserSettingEntry_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_UserSettingEntry_descriptor, new java.lang.String[] { "Scope", "Key", "Value", "UpdateDt", }); internal_static_ModifyUserSettingReq_descriptor = getDescriptor().getMessageTypes().get(51); internal_static_ModifyUserSettingReq_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ModifyUserSettingReq_descriptor, new java.lang.String[] { "Scope", "Key", "Value", }); internal_static_Version_descriptor = getDescriptor().getMessageTypes().get(52); internal_static_Version_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_Version_descriptor, new java.lang.String[] { "Version", }); internal_static_GetUserSettingResult_descriptor = getDescriptor().getMessageTypes().get(53); internal_static_GetUserSettingResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_GetUserSettingResult_descriptor, new java.lang.String[] { "Entry", }); internal_static_Friend_descriptor = getDescriptor().getMessageTypes().get(54); internal_static_Friend_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_Friend_descriptor, new java.lang.String[] { "Uid", "State", "UpdateDt", "Alias", "Blacked", "Extra", }); internal_static_GetFriendsResult_descriptor = getDescriptor().getMessageTypes().get(55); internal_static_GetFriendsResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_GetFriendsResult_descriptor, new java.lang.String[] { "Entry", }); internal_static_GetFriendRequestResult_descriptor = getDescriptor().getMessageTypes().get(56); internal_static_GetFriendRequestResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_GetFriendRequestResult_descriptor, new java.lang.String[] { "Entry", }); internal_static_ConnectAckPayload_descriptor = getDescriptor().getMessageTypes().get(57); internal_static_ConnectAckPayload_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ConnectAckPayload_descriptor, new java.lang.String[] { "MsgHead", "FriendHead", "FriendRqHead", "SettingHead", "NodeAddr", "NodePort", "ServerTime", }); internal_static_IMHttpWrapper_descriptor = getDescriptor().getMessageTypes().get(58); internal_static_IMHttpWrapper_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_IMHttpWrapper_descriptor, new java.lang.String[] { "Token", "ClientId", "Request", "Data", }); internal_static_SearchUserRequest_descriptor = getDescriptor().getMessageTypes().get(59); internal_static_SearchUserRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_SearchUserRequest_descriptor, new java.lang.String[] { "Keyword", "Fuzzy", "Page", "DomainId", "Type", }); internal_static_SearchUserResult_descriptor = getDescriptor().getMessageTypes().get(60); internal_static_SearchUserResult_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_SearchUserResult_descriptor, new java.lang.String[] { "Entry", }); internal_static_GetChatroomInfoRequest_descriptor = getDescriptor().getMessageTypes().get(61); internal_static_GetChatroomInfoRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_GetChatroomInfoRequest_descriptor, new java.lang.String[] { "ChatroomId", "UpdateDt", }); internal_static_ChatroomInfo_descriptor = getDescriptor().getMessageTypes().get(62); internal_static_ChatroomInfo_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ChatroomInfo_descriptor, new java.lang.String[] { "Title", "Desc", "Portrait", "MemberCount", "CreateDt", "UpdateDt", "Extra", "State", }); internal_static_GetChatroomMemberInfoRequest_descriptor = getDescriptor().getMessageTypes().get(63); internal_static_GetChatroomMemberInfoRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_GetChatroomMemberInfoRequest_descriptor, new java.lang.String[] { "ChatroomId", "MaxCount", }); internal_static_ChatroomMemberInfo_descriptor = getDescriptor().getMessageTypes().get(64); internal_static_ChatroomMemberInfo_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ChatroomMemberInfo_descriptor, new java.lang.String[] { "MemberCount", "Members", }); internal_static_INT64Buf_descriptor = getDescriptor().getMessageTypes().get(65); internal_static_INT64Buf_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_INT64Buf_descriptor, new java.lang.String[] { "Id", }); internal_static_NotifyRecallMessage_descriptor = getDescriptor().getMessageTypes().get(66); internal_static_NotifyRecallMessage_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_NotifyRecallMessage_descriptor, new java.lang.String[] { "Id", "FromUser", }); internal_static_BlackUserRequest_descriptor = getDescriptor().getMessageTypes().get(67); internal_static_BlackUserRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_BlackUserRequest_descriptor, new java.lang.String[] { "Uid", "Status", }); internal_static_RouteRequest_descriptor = getDescriptor().getMessageTypes().get(68); internal_static_RouteRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_RouteRequest_descriptor, new java.lang.String[] { "App", "Platform", "PushType", "DeviceName", "DeviceVersion", "PhoneName", "Language", "CarrierName", "AppVersion", "SdkVersion", }); internal_static_RouteResponse_descriptor = getDescriptor().getMessageTypes().get(69); internal_static_RouteResponse_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_RouteResponse_descriptor, new java.lang.String[] { "Host", "LongPort", "ShortPort", }); internal_static_GetTokenRequest_descriptor = getDescriptor().getMessageTypes().get(70); internal_static_GetTokenRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_GetTokenRequest_descriptor, new java.lang.String[] { "UserId", "ClientId", "Platform", }); internal_static_LoadRemoteMessages_descriptor = getDescriptor().getMessageTypes().get(71); internal_static_LoadRemoteMessages_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_LoadRemoteMessages_descriptor, new java.lang.String[] { "Conversation", "BeforeUid", "Count", "ContentType", }); internal_static_MultiCastMessage_descriptor = getDescriptor().getMessageTypes().get(72); internal_static_MultiCastMessage_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_MultiCastMessage_descriptor, new java.lang.String[] { "FromUser", "Content", "To", "Line", }); internal_static_RecallMultiCastMessageRequest_descriptor = getDescriptor().getMessageTypes().get(73); internal_static_RecallMultiCastMessageRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_RecallMultiCastMessageRequest_descriptor, new java.lang.String[] { "MessageId", "Receiver", }); internal_static_AuthCodeRequest_descriptor = getDescriptor().getMessageTypes().get(74); internal_static_AuthCodeRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_AuthCodeRequest_descriptor, new java.lang.String[] { "TargetId", "Type", "Host", }); internal_static_ApplicationConfigRequest_descriptor = getDescriptor().getMessageTypes().get(75); internal_static_ApplicationConfigRequest_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_ApplicationConfigRequest_descriptor, new java.lang.String[] { "AppId", "AppType", "Timestamp", "Nonce", "Signature", }); internal_static_StringPair_descriptor = getDescriptor().getMessageTypes().get(76); internal_static_StringPair_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_StringPair_descriptor, new java.lang.String[] { "Key", "Value", }); return null; } }; com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { }, assigner); } // @@protoc_insertion_point(outer_class_scope) } ================================================ FILE: distribution/pom.xml ================================================ 4.0.0 ../ wildfirechat-parent cn.wildfirechat 1.4.5 distribution pom Moquette - distribution ${project.groupId} moquette-broker ${project.version} ${basedir}/src/main/ pl.project13.maven git-commit-id-plugin 2.1.5 revision yyyyMMddHHmmss true ${project.basedir}/.git false true src/main/resources/git.properties false false false 7 -dirty false org.apache.maven.plugins maven-assembly-plugin 2.4 distribution-package package single ${basedir}/src/main/assembly/assembly.xml gnu jdeb org.vafer 1.8 package jdeb ${project.basedir}/src/main/deb/control false ${project.build.directory}/im-server-${project.version}.deb ${project.build.directory}/distribution-${project.version}-bundle-tar.tar.gz archive perm /opt/im-server ${project.basedir}/../systemd/im-server.service file perm /usr/lib/systemd/system ================================================ FILE: distribution/src/main/assembly/assembly.xml ================================================ bundle-tar tar.gz false ../broker/migrate/mysql/ /migrate/mysql ../broker/migrate/h2/ /migrate/h2 src/main/resources/ config/ ../systemd/ /systemd src/main/checker/ checker/ src/main/scripts/wildfirechat.sh bin 0755 src/main/scripts/stop.sh bin 0755 src/main/scripts/wildfirechat.bat bin src/main/files/README.txt ../release_note.md ../broker/target/moquette-broker-${project.version}.jar lib/ moquette-broker-${project.version}.jar ../sdk/target/sdk-${project.version}.jar server_sdk/ sdk-${project.version}.jar ../sdk/sdk_readme.txt server_sdk/ sdk_readme.txt ../common/target/common-${project.version}.jar server_sdk/ common-${project.version}.jar ../sdk/target/checker.jar checker/ ../docker/Dockerfile docker/ ../docker/README.md docker/ lib/ true io.moquette:moquette-broker ================================================ FILE: distribution/src/main/checker/README.md ================================================ 部署IM服务后,可以使用Server SDK通过API来检查服务的部署情况,可以执行: ```shell java -jar checker.jar http://127.0.0.1:18080 123456 http://127.0.0.1 false false ``` 来检查。检查之后会产生垃圾数据,请在检查之后停掉IM服务后,再删除掉IM服务数据库。此检查仅检查API,检查通过并不代表部署肯定成功,还需要客户端来验证。 ================================================ FILE: distribution/src/main/deb/control/control ================================================ Package: im-server Version: [[version]] Section: misc Priority: optional Architecture: all Maintainer: Wildfirechat Description: IM Server Distribution: development Depends: openjdk-8-jre-headless Homepage: https://wildfirechat.cn ================================================ FILE: distribution/src/main/deb/control/postinst ================================================ set -e sed -i 's/h2db.path .\/h2db\/wfchat/h2db.path \/var\/lib\/im-server\/h2db\/imdb/' /opt/im-server/config/wildfirechat.conf sed -i 's/local.media.storage.root .\/media/local.media.storage.root \/var\/lib\/im-server\/media/' /opt/im-server/config/wildfirechat.conf sed -i 's/.\/logs<\/Property>/\/var\/log\/im-server<\/Property>/' /opt/im-server/config/log4j2.xml sed -i 's/WILDFIRECHAT_CONFIG_PATH=$WILDFIRECHAT_HOME/WILDFIRECHAT_CONFIG_PATH=\/etc\/im-server/' /opt/im-server/bin/wildfirechat.sh if [ ! -d /etc/im-server ]; then mkdir /etc/im-server fi if [ ! -d /var/log/im-server ]; then mkdir /var/log/im-server fi mv -f /opt/im-server/config /etc/im-server systemctl daemon-reload echo "IM server folders:" echo "/etc/im-server/config config" echo "/opt/im-server binary files" echo "/var/log/im-server logs" echo "/var/lib/im-server/h2db embed db" echo "/var/lib/im-server/media embed media files" ================================================ FILE: distribution/src/main/deb/control/postrm ================================================ set -e rm -rf /opt/im-server rm -rf /etc/im-server rm -rf /var/log/im-server rm -rf /usr/lib/systemd/system/im-server.service if [ -d /var/lib/im-server/h2db ]; then echo "IM embed db file not deleted in path /var/lib/im-server/h2db, if you don't need it anymore, please remove it manually" fi if [ -d /var/lib/im-server/media ]; then echo "IM embed media files not deleted in path /var/lib/im-server/media, if you don't need it anymore, please remove it manually" fi systemctl daemon-reload ================================================ FILE: distribution/src/main/files/README.txt ================================================ 部署方法请参考野火IM开发文档 http://docs.wildfirechat.cn ================================================ FILE: distribution/src/main/resources/c3p0-config.xml ================================================ 10 30 100 10 200 com.mysql.cj.jdbc.Driver jdbc:mysql://localhost:3306/wfchat?useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8 root 123456 10 30 100 10 200 3000 2 0 1000 false false 60 oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:@localhost:1521:orcl scott liang 10 30 100 10 200 ================================================ FILE: distribution/src/main/resources/hazelcast.xml ================================================ slf4j 604800 LRU 1000000 10 io.moquette.persistence.MessageLoader 0 604800 LRU 1000000 10 io.moquette.persistence.GroupLoader 0 604800 LRU 1000000 10 io.moquette.persistence.UserLoader 0 604800 LRU 1000000 10 io.moquette.persistence.UserStatusLoader 0 86400 LRU 1000000 10 604800 LRU io.moquette.persistence.ChatroomLoader 0 604800 LRU 1000000 10 io.moquette.persistence.RobotLoader 0 604800 LRU 1000000 10 io.moquette.persistence.DeviceLoader 0 604800 LRU 1000000 10 io.moquette.persistence.ChannelLoader 0 ================================================ FILE: distribution/src/main/resources/log4j2.xml ================================================ ./logs UTF-8 %d %-5p [%t] %C{2} (%F:%L) - %m%n ================================================ FILE: distribution/src/main/resources/wildfirechat.conf ================================================ ## 注意事项: #1. 配置文件修改是不能直接生效的,需要重启后才能生效。 #2. Linux下使用windows格式配置文件会出错,包括本文件,c3p0文件,hz配置。常见于在windows系统上修改,然后上传到linux服务器,可以在linux服务器上直接修改或者上传到linux服务器后转换成unix格式,具体转换方法请百度。 #********************************************************************* # Server configuration #********************************************************************* #服务器的接入IP。给客户端提供是${server.ip}和${http_port}。 #客户端会从${http_port}端口获取到长链接端口。这个地址一定要改成客户端可以访问到的IP地址 #(如果您部署云服务器上或者具有独立公网出口的服务器上,请改为对应的公网IP;如果您部署在在内网环境下,在内网使用,这个地方改成内网地址) server.ip 0.0.0.0 ##原生客户端长链接端口。如果使用4层的反向代理或者类似组件,需要设置长链接保持时间为10分钟。不支持7层代理。 port 1883 ##客户端短链接端口,客户端固定使用80端口不能修改。 ##如果是国企事业单位等因为政策原因无法使用80端口,可以联系野火解决。 http_port 80 #管理端口 http.admin.port 18080 ##节点ID,当集群部署时,一定不能有重复。 node_id 1 ##绑定IP,不要打开,除非有特殊需求才可以打开 #host 0.0.0.0 ##本地绑定端口 local_port 80 ## 是否使用内置DB。0使用mysql;1使用h2db。 ## MySQL需要把事物隔离级别改成"Read committed",使用命令来修改"set global transaction_isolation='read-committed';",其他数据库默认已经是这个级别不用修改 ## 如果使用MySQL,请在c3p0.xml文件中配置JDBC信息。 ## 如果是MySQL5.7,需要开启长索引的支持,在数据库中执行命令:"set global innodb_large_prefix=on;"。其他版本默认支持,不用修改。 ## 如果使用MySQL 8.0.30以上版本,有个特性是创建表时如果没有主键将会自动创建一个主键"my_key_id",如果此功能打开,在执行mysql脚本V19__add_id_for_sensitive_word.sql时将会报错,提示不能2个主键。 ## 解决办法就是运行出错后删除掉系统自动创建的主键"my_key_id",然后继续执行。 embed.db 1 ## 是否自动清理历史消息记录,当为true时,IM服务会定时扫描t_messages_x和t_user_messages_x表,清除掉3年前的历史消息。 ## 如果不开启自动清理,需要手动清理t_messages_x和t_user_messages_x表内的历史数据,保存数据不能超过3年。 ## 如果需要消息保存更长时间,可以把临近销毁的消息转储到别的数据库,客户端在拉取不到服务器消息时,再去转储的数据库拉取。 ## 使用mongodb时次开关无效(因为mongodb设置了消息过期时间,会自动清理,仅专业版支持mongodb)。 db.auto_clean_history_messages true ## h2db数据库的路径,默认为程序目录下的,可以指定其他目录。如果使用MySQL,可以忽略此配置 h2db.path ./h2db/wfchat ##服务器管理接口密钥。如果修改此端口需要同步修改使用管理API的地方,比如应用服务。 http.admin.secret_key 123456 ##服务器API接口参数是否检查时间。当设置为false时,所有的请求会检查时间的有效性;当设置为true时,可以在http.admin.secret_key保持不变的情况下,使用固定的服务API签名 ##nonce = "76616", timestamp = "1558350862502", sign = "b98f9b0717f59febccf1440067a7f50d9b31bdde" http.admin.no_check_time false ##用来生产im token的私钥,只在服务器使用,客户端不用。正式使用时为了安全一定要修改这个值,切记切记 token.key testim ##token的过期时间,单位为毫秒,默认为无限期。如果需要设置无限期,客户端上一定需要加上token过期的处理。token过期的处理请参考文档的常见问题 ##token.expire_time 2592000000 ##客户端(目前只有android)的应用签名(一个应用最取第一个签名),如果有多个签名(多个客户端),用英文逗号分开。获取签名方法请参考文档:https://docs.wildfirechat.cn/blogs/签名验证.html #connect.client_signature_list eNkezQ1g9OsnhfLSFUY1vzKDzhs=,xykezQ1g9OsnhfLSFUY1vzKDzhs= ##是否拒绝空签名的android客户端, 默认为true。当有旧的客户端需要兼容时改成false,当所有都是新客户端时,改成true。 #connect.reject_empty_signature true ##是否使用AES256加密。默认客户端和服务器都是AES128加密,如果需要开启AES256,需要客户端和IM服务同时开通。 #encrypt.use_aes256 true ##当创建一个对象时(用户,群组,频道,机器人等),如果没有传入ID,野火会为这个对象生成一个ID。如果id.use_uuid为true,会使用uuid作为对象ID,否则会使用野火短ID,默认为false。 ## 短ID有个很大的风险是容易被人穷举进行攻击。建议用UUID。 id.use_uuid true ##首次登录,是否接收之前的历史消息。 ##0 不接收历史消息,只接收${message.compensate_time_limit}毫秒以内的消息,由于服务器没有保存已经收取记录,所以如果有超过${message.compensate_time_limit}毫秒之前未收取的消息也不会收取下拉; ##1接收,会接收 message.max_queue 配置的条数的历史消息 message.roaming 0 ## 消息补偿时限,当${message.roaming}为0时,会同步时限以内且小于${message.max_queue}的消息,默认时限为5分钟。当${message.roaming}为1时,会接收 message.max_queue 配置的条数的历史消息。 message.compensate_time_limit 300000 ##是否开启拉取远程历史消息。如果为1,客户端在会话内如果本地消息读取完了,可以下拉继续加载在服务器上的该会话的消息;如果为0则不能。 message.remote_history_message 0 ##服务器为每个用户缓存的消息数量。这个值改得太大,拉取消息时间变长,另外会占用大量内存。 message.max_queue 1024 ##是否开启拉取聊天室远程历史消息。如果为1,可以下拉继续加载在服务器上的该聊天室的消息;如果为0则不能。默认为1 message.chatroom_remote_history_message 1 ##是否禁止陌生人聊天 message.disable_stranger_chat false ##当禁止陌生人聊天时,允许聊天的用户id,比如管理员或者文件传输助手等。用户id以英文逗号分割。 message.allow_stranger_chat_list admin,FireRobot,wfc_file_transfer ##当禁止陌生人聊天时,允许聊天的线路。 #message.allow_stranger_line 100,101 ##黑名单策略,0 发送失败,返回被拉黑的错误码;1 发送成功但消息被服务器直接丢弃 message.blacklist.strategy 0 ##是否禁止服务器端消息搜索,该功能暂未实现。目前的影响是如果打开,则存储消息时不单独保存_searchable_content字段 message.disable_remote_search false ##是否数据库中加密消息内容。注意这个开关在服务运行起来后不能改变了,避免读取数据库时无法恢复历史消息。 ##如果要避免数据库中明文存储消息内容,请打开这个开关和message.disable_remote_search开关 message.encrypt_message_content false ##允许客户端撤回用户自己发送的消息时限,单位是秒。0是不允许撤回;-1是无限制撤回。 ##Server API不受此限制,可以撤回任意时限内的消息 ##群组管理员或群主撤回群成员消息不受此限制,可以撤回任意时限内的消息。但管理员或群主撤回自己的消息还是需要准守此时间限制。 ##修改此参数需要同步修改客户端UI,客户端UI代码有判断撤回是否显示的逻辑。 message.recall_time_limit 120 ##禁止群主/群管理员撤回群内消息,关闭时群主/群管理员可以撤回任意时间段内群内成员的消息。 message.disable_group_manager_recall false ##禁止客户端发送消息类型,消息类型以逗号分开,下面3个值为示例,可以删除。 ##一般用于重要类型消息,比如交易、充值等,禁止客户端发送,仅限于服务器发送,提高安全性。 #message.forbidden_client_send_types 3999,4000,4001 ## 当禁止发送消息时,允许例外发送的消息。这种一般用户需要被动回应的消息。比如群中被禁言的用户,他无法主动发起音视频,但可以接听未被禁言用户的音视频 ## 因为音视频使用了消息作为信令,所以就需要允许发送音视频信令。如果开发了其它场景也需要被动回应消息,可以加在这里。 ## 黑名单时允许发送的消息类型 message.blacklist_exception_types 401,402,403,404,405,407,408,410,411 ## 群禁言或者聊天室或者频道禁言时允许发送的消息类型 message.group_mute_exception_types 401,402,403,404,405,407,408,410,411 ## 用户被全局禁言时允许发送的消息类型 message.global_mute_exception_types 401,402,403,404,405,407,408,410,411 ## 离线用户推送过期天数,0是永不过期,建议配置为7天。 message.push_expired_days 7 ## 当会话静音/全局静音/PC在线静音时,普通消息都不会有推送,如果有某些消息类型需要此时保持推送,可以配置到这里。此配置对消息免打扰时段无效。 ## 此配置只影响远程推送,需要客户端处理客户端在线且在后台收到此消息的处理,需要针对这些消息类型加上本地通知。 ## 强制推送消息的MessagePayload中pushContent和pushData至少要存在一个才可以推送。 ## 消息类型以英文逗号分割。 #message.force_push_types 401,402 ## 群发消息(包括server api群发和全局频道群发)时,目标用户是否来自于t_user表。如果使用野火托管用户信息,请设置为true,否则设置为false。 message.broadcast.target_from_user_table true ## 消息转发功能开启时,开关是否不转发server api接口消息。 ## 当为true时,不转发server api发送的消息;当为false时,转发server api发送的消息。 message.no_forward_admin_message false ## 消息转发功能开启时,转发信息是否带上用户clientId和平台类型。 message.forward_with_client_info false ## 消息转发功能开启时,转发信息是否带上发送者的用户信息 message.forward_with_sender_info false ## 消息转发功能开启时,转发信息是否带上目标的信息,单聊时是对方用户信息,群聊时是群组信息,频道时是频道信息 message.forward_with_target_info false ## 允许发送单聊消息给被封禁用户 message.allow_send_to_forbidden_user false ## 机器人回调信息是否带上用户clientId和平台类型。 robot.callback_with_client_info false ## 机器人回调信息是否带上发送者的用户信息 robot.callback_with_sender_info false ## 机器人回调信息是否带上目标的信息,单聊时是对方用户信息,群聊时是群组信息,频道时是频道信息 robot.callback_with_target_info false ## 是否允许@会话外的机器人。如果为true,单聊或者群聊时,可以@不在会话中的机器人。当机器人收到消息后,可以回复消息。 ## 如果为false,不能@不在会话中的机器人。机器人不在会话中时,也不能回复消息。 robot.mention_external_robot true ## 机器人获取信息允许的字段,可以获取userId/displayName/portrait,其他需要这里配置允许。 ## 第一位(1)是name, 第二位(2)是mobile,第三(4)位是email,第四位(8)是address,第五位(16)是company,第六位(32)是extra, ## 第七位(64)是updateDt,第八位(128)是gender,第九位(256)是social,第十位(512)是type。 ## 比如允许获取name和email就是5(1+4),允许获取name和mobile和company和type就是531(1+2+16+512),允许全部是1023(1+2+...+512) #robot.get_user_info_mask 1023 ## 频道回调信息是否带上用户clientId和平台类型。 channel.callback_with_client_info false ## 频道回调信息是否带上发送者的用户信息。 channel.callback_with_sender_info false ## 频道回调信息是否带上频道信息 channel.callback_with_target_info false ## 频道回调新方式,在新方式下,如果有callback地址就会总是回调客户端发送的消息(包括owner和订阅者)。automatic属性控制订阅者发送的消息是否发给owner, 0发,1不发。 ## 旧的方式是,automatic为0时,订阅者的消息发给owner,不转发消息到callback地址。为1时,把订阅者的消息转发给callback地址,不发给owner。 channel.new_callback_feature true ##禁止搜索用户 friend.disable_search false ##禁止按照昵称搜索用户。 friend.disable_nick_name_search false ##禁止按照用户id搜索用户,默认为false。 friend.disable_user_id_search false ##禁止发送好友邀请,通过server api添加好友不受此限制(force参数需要为true) friend.disable_friend_request false ##好友请求重复发送的间隔,单位是毫秒,默认是7天,0为无限长期限。 friend.repeat_request_duration 604800000 ##好友请求被拒绝后再次发送的间隔,单位是毫秒,默认是30天,0为不限制。不能小于friend.repeat_request_duration。 friend.reject_request_duration 2592000000 ##好友请求过期时间,单位是毫秒,默认是7天,0为无限长期限。 friend.request_expiration_duration 604800000 ##好友请求限制频率,一个用户24小时之内允许请求好友的次数,默认不限频。 friend.request_rate_limit 30 ##如果搜索电话号码,24小时内搜索错误号码几次就不再允许电话号码搜素。防止有人遍历搜索电话号码 friend.search_mobile_empty_rate_limit 5 ##如果搜索用户,24小时内搜索次数。防止有人遍历用户名或者用户ID乱加好友。另外可以禁止ID搜索friend.disable_user_id_search friend.search_rate_limit 100 ##请求添加机器人为好友时,机器人是否自动接受,默认为true friend.robot_auto_accept true ## 聊天室观众空闲退出时间,单位为毫秒,默认为15分钟,0为永远不退出 chatroom.participant_idle_time 900000 ## 用户向聊天室发送消息,自动加入聊天室 chatroom.rejoin_when_active true ## 当一个聊天室不存在时,如果有用户加入就自动创建 chatroom.create_when_not_exist true ## 一个用户同一时刻只能加入一个聊天室。 ## 当一个客户端加入一个聊天室时,如果这个客户端已经加入另外一个聊天室了,会自动退出之前的聊天室。 ## 当一个客户端加入一个聊天室时,如果这个用户的其他端已经加入一个聊天室了,kickoff_other_platform为true时会自动退出之前的聊天室,为false时会返回225的错误码。 ## 当自动退出聊天室时,客户端不会收到任何通知,只是不会再收到消息。 chatroom.kickoff_other_platform true ## 是否允许群主不受限制地撤回自己发送的消息。false可以${message.recall_time_limit}撤回自己的消息;true可以撤回任意时间自己的消息。默认为true。 group.allow_owner_recall_self_msg true ## 是否允许群管理员不受限制地撤回自己发送的消息。false可以${message.recall_time_limit}撤回自己的消息;true可以撤回任意时间自己的消息。默认为false。 group.allow_manager_recall_self_msg false ## 是否允许客户端发送操作群的自定义群通知消息 group.allow_client_custom_operation_notification true ## 是否允许机器人发送操作群的自定义群通知消息 group.allow_robot_custom_operation_notification true ## 当群成员退出或者被移除时,是否同时给管理员和相关人员发送显式通知消息。 ## 0 不发送,1 退群时发送,2 踢人时发送,3 退群和踢人时都发送。 ## 如果应用需要退群或者踢人不通知普通成员,请设置此参数为3,然后修改客户端踢人或退群消息的flag为not_presist。 group.visible_quit_or_kickoff_notification 0 ## 禁止客户端群操作。第1位是禁止创建群组,第2位是禁止销毁群组,3位禁止加入群,4位禁止退出群,5位禁止邀请群成员,6位禁止移出群成员,7位禁止转移群,8位禁止设置群管理员,9位禁止白名单处理,10位禁止群禁言,11位禁止修改群组信息,12位禁止群成员禁言。 ## 如果有客户端有被破解的风险,可以禁止客户端群操作,然后通过Server API操作。Server API不受限制。 #group.forbidden_client_operation 0xFFF ## 是否禁止陌生人拉人入群,默认为false group.disable_stranger_invite false ## 创建群组或者加人时。可能会有成员加入失败(黑名单,或者不允许陌生人拉入群)。当出现有成员失败时,如果此开关为关,操作会失败。 ## 如果此开关打开,操作会返回成功,另外在群里发送一条通知消息 XXX 拒绝加入群组。默认为开。 group.add_member_allow_part_success true ## 群组信息是否标记删除 group.enable_mark_deletion true ## 隐藏用户信息属性类型,2是性别,3是电话号码,4是邮箱,5是地址,6是公司信息,7是社交账号,8是Extra信息。当需要隐藏多个时以英文逗号分开; ## 本配置是为了提高安全性,避免把对应信息同步到客户端,这样就能防止程序被破解从而拿到用户关键信息。仅对客户端有效,server api不受影响。 ## 注意,修改本配置不会对已经同步的信息产生影响。 #user.hide_properties 3,4 ## 销毁用户时,用户信息会被清空,deleted字段设置为1,这个开关控制是否保留用户昵称,默认为true。 user.keep_display_name_when_destroy true ## 销毁用户时deleted字段设置为1,这个开关控制是否保留其他信息,默认是false。 user.keep_full_info_when_destroy false ## 销毁用户时,如果user.keep_full_info_when_destroy为true,会保留所有信息,这个开关控制是否保留这个用户信息的电话号码,默认为false。 ## 当保留所有信息且保留电话号码时,用户如果再注册会用到原来的UID,能够看到原来用户的消息,需要考虑一下是否让已删除用户再次注册登录看到之前的消息。 user.keep_mobile_when_destroy false ## 销毁用户时是否保留归属于这个用户的所有消息记录,默认为false。 user.keep_messages_when_destroy false # 好友/好友请求/用户设置 这三类数据同步的最大条目数。之前是客户第一次登录时,会把所有的对应数据一次下载到客户端,但如果有特别多的信息,会导致无法同步到客户端, # 因此需要分段多次同步,此开关定义了每次同步的数据的条数。此需要客户端支持,客户端SDK在2021.5.25日后支持此功能。如果确认所有客户端都在这个日志之后才可以打开此设置。 #sync.data_part_size 1000 ## 是否关闭api/version接口。api/version方法可以用来检查IM服务版本,上线确认无问题后,可以关掉这个接口。 #http.close_api_version false #********************************************************************* # 限频配置 #********************************************************************* ##API接口限频设置,时间是10秒内允许的请求次数。 ##管理api频率限制,默认是10秒10000次。 http.admin.rate_limit 10000 ##机器人api频率限制,默认是10秒1000次,按照机器人ID区分。 http.robot.rate_limit 1000 ##频道api频率限制,默认是10秒1000次,按照频道ID区分。 http.channel.rate_limit 1000 ##客户端请求频率限制,默认是5秒100次。通常情况下不要修改这个值。 client.request_rate_limit 100 #********************************************************************* # Media server configuration #********************************************************************* ##是否使用七牛云存储。1使用七牛;0使用内存文件服务器。默认的七牛账户信息不可用,请在七牛官网申请账户并配置 ##专业版另外支持阿里云存储和野火私有存储,关于野火私有存储请参考:https://github.com/wildfirechat/WF-minio ##关于对象存储的详细信息请参考:https://docs.wildfirechat.cn/server/oss.html media.server.use_qiniu 0 # qiniu media server configuration ## 上传地址,不同的区域,上传地址也不同,请注意现在正确的地址 qiniu.server_url http://up.qbox.me qiniu.access_key tU3vdBK5BL5j4N7jI5N5uZgq_HQDo170w5C9Amnn qiniu.secret_key YfQIJdgp5YGhwEw14vGpaD2HJZsuJldWtqens7i5 ## bucket名字及Domain qiniu.bucket_general_name media qiniu.bucket_general_domain http://cdn.wildfirechat.cn qiniu.bucket_image_name media qiniu.bucket_image_domain http://cdn.wildfirechat.cn qiniu.bucket_voice_name media qiniu.bucket_voice_domain http://cdn.wildfirechat.cn qiniu.bucket_video_name media qiniu.bucket_video_domain http://cdn.wildfirechat.cn qiniu.bucket_file_name media qiniu.bucket_file_domain http://cdn.wildfirechat.cn qiniu.bucket_sticker_name media qiniu.bucket_sticker_domain http://cdn.wildfirechat.cn qiniu.bucket_moments_name media qiniu.bucket_moments_domain http://cdn.wildfirechat.cn qiniu.bucket_portrait_name storage qiniu.bucket_portrait_domain http://cdn2.wildfirechat.cn qiniu.bucket_favorite_name storage qiniu.bucket_favorite_domain http://cdn2.wildfirechat.cn ## custom的桶是给客户预留的,客户可以上传自己的文件到这3个桶中,野火不会用到这几个桶。如果不需要,可以忽略这几个配置 qiniu.bucket_custom1_name temp1 qiniu.bucket_custom1_domain http://temp1.wildfirechat.cn qiniu.bucket_custom2_name temp2 qiniu.bucket_custom2_domain http://temp2.wildfirechat.cn qiniu.bucket_custom3_name temp3 qiniu.bucket_custom3_domain http://temp3.wildfirechat.cn ## 如果配置网盘服务,需要配置这个 qiniu.bucket_pan_name pan qiniu.bucket_pan_domain http://pan.wildfirechat.cn ##媒体类型分类 #Media_Type_GENERAL = 0, #Media_Type_IMAGE = 1, #Media_Type_VOICE = 2, #Media_Type_VIDEO = 3, #Media_Type_FILE = 4, #Media_Type_PORTRAIT = 5, #Media_Type_FAVORITE = 6, #Media_Type_STICKER = 7, #Media_Type_MOMENTS = 8 # local media server configuration # 本地媒体服务器配置。 local.media.storage.root media # 如果使用内置文件存储,文件上传后地址默认为 http://server.ip:http_port/fs/5/2021/03/27/08/filename。fs目录下按照类型存放文件,媒体类型见上面注释,比如5就是Media_Type_PORTRAIT,是客户端的头像文件。 # 如果需要使用nginx添加https支持,请打开下面配置,这样客户端得到的文件地址为 https://example.com/media/fs/5/2021/03/27/08/filename。 # 需要nginx把请求从https://example.com/media/fs 转到 http://server.ip:http_port/fs。注意需要带上所有header。 # 尽管内置文件存储可以使用,但是我们还是建议使用专业级别的对象存储服务,社区版可以使用七牛,专业版另外支持阿里云和也是私有对象存储。详情请参考 https://docs.wildfirechat.cn/server/oss.html # local.media.storage.remote_server_url https://example.com/media # 是否支持任意多端登陆,为true时支持任意平台任意多个客户端同时登录;为false时每个平台只支持一个端登录,但不同平台可以同时登录。 # Android/iOS为移动平台,windows/mac/linux为pc平台,web为web平台,小程序为小程序平台。 # 建议使用false server.multi_endpoint false ## 是否支持PC多端登陆,当server.multi_endpoint为true时,此开关无意义,当为false时,可以单独打开PC端多端登录。 server.multi_pc_endpoint false ## 是否支持PAD多端登陆,当server.multi_endpoint为true时,此开关无意义,当为false时,可以单独打开PAD端多端登录。 server.multi_pad_endpoint false ## 是否支持可穿戴设备多端登陆,当server.multi_endpoint为true时,此开关无意义,当为false时,可以单独打开可穿戴设备多端登录。 server.multi_wearable_endpoint false ## 是否支持TV设备多端登陆,当server.multi_endpoint为true时,此开关无意义,当为false时,可以单独打开TV多端登录。 server.multi_tv_endpoint false # 多平台连接状态通知(仅当multi_endpoint为false时有效),true时移动端可以收到pc或pad或web端登录的通知。 server.multi_platform_notification true # 当pc或者web在线时,手机是否默认静音,默认为true。注意仅影响默认值,用户可以手动切换是否静音。 # 如果这里改为false,客户端那边需要同步修改pc在线默认通知状态,方法是client的setDefaultSilentWhenPcOnline函数。 server.mobile_default_silent_when_pc_online true ## 客户端是否支持kickoff事件。当客户端被其他端登录踢出时,如果此开关为false时,客户端协议栈上报secret_mismatch。如果此开关为ture时,客户端协议栈上报kicked_off。 ## 客户端被踢时上报kicked_off是在2021.9.15之后才加上的。如果客户端协议栈全部为此日期之后的版本才可以打开此开关。 server.client_support_kickoff_event true #********************************************************************* # Push server configuration #********************************************************************* ##推送服务项目地址:https://github.com/wildfirechat/push_server。 ##安卓推送服务器地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! push.android.server.address http://localhost:8085/android/push ##苹果推送服务器地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! push.ios.server.address http://localhost:8085/ios/push ##鸿蒙推送服务器地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! push.harmony.server.address http://localhost:8085/harmony/push #********************************************************************* # 监控配置 #********************************************************************* ##异常事件产生回调 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #monitor.exception_event_address http://localhost:8888/im_exception_event/ #********************************************************************* # 各种事件回调 #********************************************************************* ##用户在线状态事件回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #user.online_status_callback http://localhost:8888/im_event/user/online ##用户信息变动事件回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #relation.relation_update_callback http://localhost:8888/im_event/user/relation ##用户信息变动事件回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #user.user_info_update_callback http://localhost:8888/im_event/user/info ##消息转发地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #message.forward.url http://localhost:8888/im_event/message ##需要转发的消息类型,当有多个时以英文逗号分割,可以用-来指定区间,注意区间不能太大,因为要把区间内的所有数字都放入到Set中。如果转发所有消息,请注释掉配置或者设置为空 #message.forward.types 1,2,3,5-10 ##需要转发的消息类型,当有多个时以英文逗号分割,可以用-来指定区间,注意区间不能太大,因为要把区间内的所有数字都放入到Set中。 #message.forward.exclude_types 1,2,3,5-10 ##敏感消息转发地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #message.sensitive.forward.url http://localhost:8888/im_event/message ##提醒消息转发地址,@全体用户和@某个用户消息会回调此地址。 ##此转发不受${message.forward.types}和${message.forward.exclude_types}限制。 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #message.mentionmsg.forward.url http://localhost:8888/im_event/message ##撤回消息转发地址,当用户撤回消息会回调此地址。 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #message.recallmsg.forward.url http://localhost:8888/im_event/recall_message ##设备信息转发地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #things_message.forward.url http://localhost:8087/im_event/things/message ##群组信息变动事件回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #group.group_info_update_callback http://localhost:8888/im_event/group/info ##群组信息变动事件回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #group.group_member_update_callback http://localhost:8888/im_event/group/member ##频道信息变动回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #channel.channel_info_update_callback http://localhost:8888/im_event/channel/info ##聊天室信息变动回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #chatroom.chatroom_info_update_callback http://localhost:8888/im_event/chatroom/info ##聊天室成员变动回调地址 ##注意回调是单线程回调,接收服务必须在同一内网,且异步处理快速返回,否则会有延迟问题!! #chatroom.chatroom_member_update_callback http://localhost:8888/im_event/chatroom/member #********************************************************************* # Netty Configuration # # Linux systems can use epoll instead of nio. To get a performance # gain and reduced GC. # http://netty.io/wiki/native-transports.html for more information #********************************************************************* # 如果是linux系统,一定要打开下面这个参数,能大幅度提高性能。默认只支持x86_64架构。如果是arm64架构,可以按照项目说明来更新epoll SDK。其他架构不支持epoll。 #netty.epoll true #********************************************************************* # Sensitive configuration #********************************************************************* ## 内置文本敏感词过滤处理方法,当命中敏感词后,消息会被记录到t_sensitive_messages表中,然后根据type类型做不同的处理,处理方式如下: ## 0 发送失败;1 发送成功但消息被服务器直接丢弃;2 命中的敏感词被替换成***然后正常发送;3 正常发送。 ## 如果开启 message.sensitive.forward.url 配置,命中敏感词的消息还会被回调到这个地址 sensitive.filter.type 2 ## 敏感词是否只处理消息。如果为true,只过滤消息;如果为false,会同时过滤用户昵称、群组名和群昵称。 ## 除了消息之外的信息只支持内部敏感词处理,不支持外置审核。 sensitive.only_message false ## 敏感词添加或者删除有2种方式,一种是通过Server API进行,这种方式会立即生效。另外一种方法是修改数据库,直接中数据库的t_sensitive_word表中处理 ## 修改数据库的方法不会立即生效,IM服务会2个小时重新加载一次敏感词。所以如果直接修改敏感词表,需要等2个小时,或者重启才能生效。 ## 如果内置敏感词库无法满足您的需求,可以开发部署独立敏感词审核服务。配置如下地址和消息类型,IM服务会把指定消息类型的消息回调到指定地址,内置的敏感词审核和敏感词转发功能就不再起作用了。 ## 审核服务返回状态码200表示继续发送,如果需要替换内容,返回状态码200并且内容为替换后的内容。返回403表示不允许发送。其它错误继续发送。 ## 独立审核服务地址,IM服务会post SendMessageData。如果需要修改消息内容,返回 MessagePayload。请参考应用服务中 "/message/censor" Mapping. #sensitive.remote_server_url http://192.168.3.202:8888/message/censor ## 需要进行敏感词审核的消息类型,当有多个时以英文逗号分割 #sensitive.remote_sensitive_message_type 1,2,3 ## 如果远程审核服务返回403,返回给发送端发送失败还是成功?实际上这个值影响发送响应是否等待审核结果,当为false时,消息发送给审核服务就立即返回成功给客户端。 ## 当为true时,消息发送给审核服务,等待审核结果,如果结果为继续发送就返回给客户端为成功,结果为禁止发送就返回失败给客户端。 ## 客户端操作的超时一般为10s左右,且考虑到复杂的网络情况,建议处理时间不要超过3s。建议这个值为false。 #sensitive.remote_fail_when_matched false ================================================ FILE: distribution/src/main/rpm/install.sh ================================================ set -e cd /opt/im-server tar -xzvf distribution*.tar.gz sed -i 's/h2db.path .\/h2db\/wfchat/h2db.path \/var\/lib\/im-server\/h2db\/imdb/' /opt/im-server/config/wildfirechat.conf sed -i 's/local.media.storage.root .\/media/local.media.storage.root \/var\/lib\/im-server\/media/' /opt/im-server/config/wildfirechat.conf sed -i 's/.\/logs<\/Property>/\/var\/log\/im-server<\/Property>/' /opt/im-server/config/log4j2.xml sed -i 's/WILDFIRECHAT_CONFIG_PATH=$WILDFIRECHAT_HOME/WILDFIRECHAT_CONFIG_PATH=\/etc\/im-server/' /opt/im-server/bin/wildfirechat.sh if [ ! -d /etc/im-server ]; then mkdir /etc/im-server fi if [ ! -d /var/log/im-server ]; then mkdir /var/log/im-server fi mv -f /opt/im-server/config /etc/im-server systemctl daemon-reload echo "IM server folders:" echo "/etc/im-server/config config" echo "/opt/im-server binary files" echo "/var/log/im-server logs" echo "/var/lib/im-server/h2db embed db" echo "/var/lib/im-server/media embed media files" ================================================ FILE: distribution/src/main/rpm/uninstall.sh ================================================ set -e rm -rf /opt/im-server rm -rf /etc/im-server rm -rf /var/log/im-server rm -rf /usr/lib/systemd/system/im-server.service if [ -d /var/lib/im-server/h2db ]; then echo "IM embed db file not deleted in path /var/lib/im-server/h2db, if you don't need it anymore, please remove it manually" fi if [ -d /var/lib/im-server/media ]; then echo "IM embed media files not deleted in path /var/lib/im-server/media, if you don't need it anymore, please remove it manually" fi systemctl daemon-reload ================================================ FILE: distribution/src/main/scripts/stop.sh ================================================ #!/bin/sh pid=`ps -ef | grep wildfirechat.server.Server | grep -v grep | awk '{print $2}'` if [ -z $pid ]; then echo "野火IM服务不存在" exit 0 fi kill -15 $pid for i in {1..30} do pid=`ps -ef | grep wildfirechat.server.Server | grep -v grep | awk '{print $2}'` if [ -z $pid ]; then echo "野火IM服务已结束" exit 0 else echo "正在结束中,请等待..." sleep 1 fi done echo "正常结束失败,强制结束!" kill -9 $pid ================================================ FILE: distribution/src/main/scripts/wildfirechat.bat ================================================ @ECHO OFF set "CURRENT_DIR=%cd%" set "WILDFIRECHAT_HOME=%CURRENT_DIR%" if exist "%WILDFIRECHAT_HOME%\bin\wildfirechat.bat" goto okHome cd .. set "WILDFIRECHAT_HOME=%cd%" set "CURRENT_DIR=%cd%" :gotHome if exist "%WILDFIRECHAT_HOME%\bin\wildfirechat.bat" goto okHome echo The WILDFIRECHAT_HOME environment variable is not defined correctly echo This environment variable is needed to run this program goto end :okHome rem Set JavaHome if it exists if exist [ "%JAVA_HOME%\bin\java" ] ( set "JAVA="%JAVA_HOME%\bin\java"" ) else ( set "JAVA="java"" ) echo Using JAVA_HOME: "%JAVA_HOME%" echo Using WILDFIRECHAT_HOME: "%WILDFIRECHAT_HOME%" rem set LOG_CONSOLE_LEVEL=info rem set LOG_FILE_LEVEL=fine set JAVA_OPTS= set JAVA_OPTS_SCRIPT=-XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true set WILDFIRECHAT_PATH=%WILDFIRECHAT_HOME% set LOG_FILE=%WILDFIRECHAT_HOME%\config\log4j2.xml set HZ_CONF_FILE=%WILDFIRECHAT_HOME%\config\hazelcast.xml set C3P0_CONF_FILE=%WILDFIRECHAT_HOME%\config\c3p0-config.xml rem Use the Hotspot garbage-first collector. set JAVA_OPTS=%JAVA_OPTS% -XX:+UseG1GC rem Have the JVM do less remembered set work during STW, instead rem preferring concurrent GC. Reduces p99.9 latency. set JAVA_OPTS=%JAVA_OPTS% -XX:G1RSetUpdatingPauseTimePercent=5 rem Main G1GC tunable: lowering the pause target will lower throughput and vise versa. rem 200ms is the JVM default and lowest viable setting rem 1000ms increases throughput. Keep it smaller than the timeouts. set JAVA_OPTS=%JAVA_OPTS% -XX:MaxGCPauseMillis=500 rem Optional G1 Settings rem Save CPU time on large (>= 16GB) heaps by delaying region scanning rem until the heap is 70% full. The default in Hotspot 8u40 is 40%. rem set JAVA_OPTS=%JAVA_OPTS% -XX:InitiatingHeapOccupancyPercent=70 rem For systems with > 8 cores, the default ParallelGCThreads is 5/8 the number of logical cores. rem Otherwise equal to the number of cores when 8 or less. rem Machines with > 10 cores should try setting these to <= full cores. rem set JAVA_OPTS=%JAVA_OPTS% -XX:ParallelGCThreads=16 rem By default, ConcGCThreads is 1/4 of ParallelGCThreads. rem Setting both to the same value can reduce STW durations. rem set JAVA_OPTS=%JAVA_OPTS% -XX:ConcGCThreads=16 rem rem GC logging options -- uncomment to enable rem set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDetails rem set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCDateStamps rem set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintHeapAtGC rem set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintTenuringDistribution rem set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintGCApplicationStoppedTime rem set JAVA_OPTS=%JAVA_OPTS% -XX:+PrintPromotionFailure rem set JAVA_OPTS=%JAVA_OPTS% -XX:PrintFLSStatistics=1 rem set JAVA_OPTS=%JAVA_OPTS% -XX:+UseGCLogFileRotation rem set JAVA_OPTS=%JAVA_OPTS% -XX:NumberOfGCLogFiles=10 rem set JAVA_OPTS=%JAVA_OPTS% -XX:GCLogFileSize=10M" rem If the JDK version is 9 or above, please open this configuration. rem set JAVA_OPTS=%JAVA_OPTS% --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED echo "Please set Xmx and Xms parameters!" echo "Please set Xmx and Xms parameters!" echo "Please set Xmx and Xms parameters!" rem set JAVA_OPTS=%JAVA_OPTS% -Xmx2G rem set JAVA_OPTS=%JAVA_OPTS% -Xms2G %JAVA% -server %JAVA_OPTS% %JAVA_OPTS_SCRIPT% -Dlog4j.configurationFile=%LOG_FILE% -Dcom.mchange.v2.c3p0.cfg.xml=%C3P0_CONF_FILE% -Dhazelcast.configuration=%HZ_CONF_FILE% -Dwildfirechat.path=%WILDFIRECHAT_PATH% -cp %WILDFIRECHAT_HOME%\lib\* cn.wildfirechat.server.Server ================================================ FILE: distribution/src/main/scripts/wildfirechat.sh ================================================ #!/bin/sh cd "$(dirname "$0")" # resolve links - $0 may be a softlink PRG="$0" while [ -h "$PRG" ]; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRGDIR=`dirname "$PRG"` cd $PRGDIR PRG="`pwd`"/"$link" fi done PRGDIR=`dirname "$PRG"` cd .. WILDFIRECHAT_HOME=`pwd` export WILDFIRECHAT_HOME echo $WILDFIRECHAT_HOME if [ -f "${JAVA_HOME}/bin/java" ]; then JAVA=${JAVA_HOME}/bin/java else JAVA=java fi export JAVA $JAVA -version WILDFIRECHAT_CONFIG_PATH=$WILDFIRECHAT_HOME LOG_FILE=$WILDFIRECHAT_CONFIG_PATH/config/log4j2.xml HZ_CONF_FILE=$WILDFIRECHAT_CONFIG_PATH/config/hazelcast.xml C3P0_CONF_FILE=$WILDFIRECHAT_CONFIG_PATH/config/c3p0-config.xml #LOG_CONSOLE_LEVEL=info #LOG_FILE_LEVEL=fine JAVA_OPTS_SCRIPT="-XX:+HeapDumpOnOutOfMemoryError -Djava.awt.headless=true" ## Use the Hotspot garbage-first collector. JAVA_OPTS="$JAVA_OPTS -XX:+UseG1GC" ## Have the JVM do less remembered set work during STW, instead ## preferring concurrent GC. Reduces p99.9 latency. JAVA_OPTS="$JAVA_OPTS -XX:G1RSetUpdatingPauseTimePercent=5" ## Main G1GC tunable: lowering the pause target will lower throughput and vise versa. ## 200ms is the JVM default and lowest viable setting ## 1000ms increases throughput. Keep it smaller than the timeouts. JAVA_OPTS="$JAVA_OPTS -XX:MaxGCPauseMillis=500" ## Optional G1 Settings # Save CPU time on large (>= 16GB) heaps by delaying region scanning # until the heap is 70% full. The default in Hotspot 8u40 is 40%. #JAVA_OPTS="$JAVA_OPTS -XX:InitiatingHeapOccupancyPercent=70" # For systems with > 8 cores, the default ParallelGCThreads is 5/8 the number of logical cores. # Otherwise equal to the number of cores when 8 or less. # Machines with > 10 cores should try setting these to <= full cores. #JAVA_OPTS="$JAVA_OPTS -XX:ParallelGCThreads=16" # By default, ConcGCThreads is 1/4 of ParallelGCThreads. # Setting both to the same value can reduce STW durations. #JAVA_OPTS="$JAVA_OPTS -XX:ConcGCThreads=16" ### GC logging options -- uncomment to enable #JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetails" #JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDateStamps" #JAVA_OPTS="$JAVA_OPTS -XX:+PrintHeapAtGC" #JAVA_OPTS="$JAVA_OPTS -XX:+PrintTenuringDistribution" #JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCApplicationStoppedTime" #JAVA_OPTS="$JAVA_OPTS -XX:+PrintPromotionFailure" #JAVA_OPTS="$JAVA_OPTS -XX:PrintFLSStatistics=1" #JAVA_OPTS="$JAVA_OPTS -XX:+UseGCLogFileRotation" #JAVA_OPTS="$JAVA_OPTS -XX:NumberOfGCLogFiles=10" #JAVA_OPTS="$JAVA_OPTS -XX:GCLogFileSize=10M" #如果JDK版本是9及以上,请打开这个配置 #JAVA_OPTS="$JAVA_OPTS --add-modules java.se --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.nio=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.management/sun.management=ALL-UNNAMED --add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED" echo "警告:没有设置JVM内存参数!" echo "请设置JVM参数Xmx和Xms,设置为您为IM服务预留的内存大小,注意需要刨除操作系统占用,如果有其它系统也需要相应去除占用,还需要减去堆外内存占用。" echo "建议设置为总内存的60%以下,比如16G总内存,Xmx可以设置为9G" echo "" #JAVA_OPTS="$JAVA_OPTS -Xmx2G" #JAVA_OPTS="$JAVA_OPTS -Xms2G" $JAVA -server $JAVA_OPTS $JAVA_OPTS_SCRIPT -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dlog4j.configurationFile="file:$LOG_FILE" -Dlog4j2.formatMsgNoLookups=true -Dcom.mchange.v2.c3p0.cfg.xml="$C3P0_CONF_FILE" -Dhazelcast.configuration=$HZ_CONF_FILE -Dwildfirechat.path="$WILDFIRECHAT_CONFIG_PATH" -cp "$WILDFIRECHAT_HOME/lib/*" cn.wildfirechat.server.Server ================================================ FILE: docker/Dockerfile ================================================ FROM openjdk:8-jre-alpine ADD distribution-*-bundle-tar.tar.gz /opt/im-server/ RUN sed -i 's/#JAVA_OPTS="$JAVA_OPTS -Xmx128M"/JAVA_OPTS="$JAVA_OPTS -Xmx$JVM_XMX"/g' /opt/im-server/bin/wildfirechat.sh RUN sed -i 's/#JAVA_OPTS="$JAVA_OPTS -Xms128M"/JAVA_OPTS="$JAVA_OPTS -Xms$JVM_XMS"/g' /opt/im-server/bin/wildfirechat.sh RUN chmod a+x /opt/im-server/bin/wildfirechat.sh WORKDIR /opt/im-server VOLUME /opt/im-server/config VOLUME /opt/im-server/logs VOLUME /opt/im-server/h2db VOLUME /opt/im-server/media EXPOSE 80/tcp 1883/tcp 8083/tcp 8084/tcp 18080/tcp ENV JVM_XMX 256M ENV JVM_XMS 256M CMD ./bin/wildfirechat.sh ================================================ FILE: docker/README.md ================================================ # 野火IM服务docker使用说明 ## 编译镜像 首先需要先编译IM服务,在项目根目录下使用下面命令编译 ``` mvn clean package ``` 生成的软件包在```distribution/target/distribution-XX-bundle-tar.tar.gz```,把此软件包拷贝到docker目录下。 然后进入到docker目录下,编译镜像 ``` sudo docker build -t im-server . ``` ## 运行 配置: 运行需要手动指定配置目录,手动指定配置目录的方法如下,其中$PATH_TO_CONFIG为im配置目录,需要为绝对路径,模版为```distribution/src/main/resources```目录。另外需要创建h2数据库目录(如果用mysql就不需要了)、日志目录、内置存储服务目录(如果使用其它对象存储服务就不需要了)。h2数据库目录/日志目录/内置存储服务目录需要有写权限,因为IM服务会写入文件。 ``` sudo docker run -it --name im-server -v $PATH_TO_CONFIG:/opt/im-server/config -v $PATH_TO_LOGS:/opt/im-server/logs -v $PATH_TO_H2DB:/opt/im-server/h2db -v $PATH_TO_MEDIA:/opt/im-server/media -e JVM_XMX=256M -e JVM_XMS=256M -p 80:80 -p 1883:1883 -p 8083:8083 -p 8084:8084 -p 18080:18080 im-server ``` ## 导出镜像 ``` sudo docker save -o im-server.tar im-server ``` ## 导入镜像 ``` sudo docker load -i im-server.tar ``` ================================================ FILE: flyway_repaire_migrate_38.sql ================================================ -- IM服务在2020.10.6-2020-11.2号之间的版本升级到最新版本时,可能会提示出现如下的错误: -- Exception in thread "main" org.flywaydb.core.api.FlywayException: Validate failed: Detected resolved migration not applied to database: 38 -- at org.flywaydb.core.Flyway.doValidate(Flyway.java:1482) -- at org.flywaydb.core.Flyway.access$100(Flyway.java:85) -- at org.flywaydb.core.Flyway$1.execute(Flyway.java:1364) -- at org.flywaydb.core.Flyway$1.execute(Flyway.java:1356) -- ... -- -- 当出现这个问题后,执行这个sql就可以修复了。 -- -- DROP TABLE IF EXISTS `t_file`; CREATE TABLE `t_file` ( `_mid` bigint(20) NOT NULL PRIMARY KEY, `_from` varchar(64) NOT NULL, `_type` tinyint NOT NULL DEFAULT 0, `_target` varchar(64) NOT NULL, `_line` int(11) NOT NULL DEFAULT 0, `_name` varchar(128) DEFAULT '', `_url` varchar(1024) NOT NULL DEFAULT '', `_size` int(11) NOT NULL DEFAULT 0, `_download_count` int(11) DEFAULT 0, `_dt` bigint(20) NOT NULL, INDEX `file_conv_index` (`_type`, `_line`, `_target`, `_mid`), INDEX `file_user_index` (`_from`, `_mid`) ) ENGINE = InnoDB DEFAULT CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci; alter table `t_group` modify column `_searchable` int(11) NOT NULL DEFAULT 0; update flyway_schema_history set installed_rank = 40 where version = 40; insert into flyway_schema_history values (38,'38','alter group searchable column','SQL','V38__alter_group_searchable_column.sql',-524664704,'root','2020-07-21 14:43:50',1126,1),(39,'39','create files table','SQL','V39__create_files_table.sql',1144437159,'root','2020-08-03 03:15:04',503,1); ================================================ FILE: license-eplv10-aslv20.html ================================================ Eclipse Public License - Version 1.0 / Apache License - Version 2.0

Eclipse Public License - v 1.0

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.

1. DEFINITIONS

"Contribution" means:

a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and
b) in the case of each subsequent Contributor:

i) changes to the Program, and

ii) additions to the Program;

where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program.

"Contributor" means any person or entity that distributes the Program.

"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program.

"Program" means the Contributions distributed in accordance with this Agreement.

"Recipient" means anyone who receives the Program under this Agreement, including all Contributors.

2. GRANT OF RIGHTS

a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form.

b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder.

c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program.

d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement.

3. REQUIREMENTS

A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that:

a) it complies with the terms and conditions of this Agreement; and

b) its license agreement:

i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose;

ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits;

iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and

iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange.

When the Program is made available in source code form:

a) it must be made available under this Agreement; and

b) a copy of this Agreement must be included with each copy of the Program.

Contributors may not remove or alter any copyright notices contained within the Program.

Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution.

4. COMMERCIAL DISTRIBUTION

Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense.

For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages.

5. NO WARRANTY

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement , including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.

6. DISCLAIMER OF LIABILITY

EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

7. GENERAL

If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.

If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed.

All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive.

Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved.

This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation.

 

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

1. Definitions.

"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.

"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.

"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.

"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.

"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.

"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.

"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).

"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.

"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."

"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.

2. Grant of Copyright License.

Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.

3. Grant of Patent License.

Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.

4. Redistribution.

You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:

  • (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and

  • (b) You must cause any modified files to carry prominent notices stating that You changed the files; and

  • (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and

  • (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.

You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.

5. Submission of Contributions.

Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.

6. Trademarks.

This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.

7. Disclaimer of Warranty.

Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.

8. Limitation of Liability.

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.

9. Accepting Warranty or Additional Liability.

While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.

END OF TERMS AND CONDITIONS

APPENDIX: How to apply the Apache License to your work.

To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.

Copyright [yyyy] [name of copyright owner]

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

================================================ FILE: license_moquette.txt ================================================ Copyright 2012-2013 (c) Andrea Selva Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ================================================ FILE: pom.xml ================================================ 4.0.0 UTF-8 4.1.68.Final 1.8 1.8 cn.wildfirechat wildfirechat-parent pom 1.4.5 Wildfire Chat Wildfire Chat Server 2019 https://www.wildfirechat.cn The Apache License, Version 2.0 http://www.apache.org/licenses/LICENSE-2.0.txt Eclipse Public License - Version 1.0 http://www.eclipse.org/org/documents/epl-v10.php broker common sdk distribution org.apache.maven.plugins maven-compiler-plugin ${source.version} ${target.version} org.apache.maven.plugins maven-checkstyle-plugin 2.17 checkstyle.xml checkstyle-suppressions.xml true true validate check release-sign-artifacts org.apache.maven.plugins maven-source-plugin attach-sources jar org.apache.maven.plugins maven-javadoc-plugin attach-javadocs jar ================================================ FILE: release_note.md ================================================ # 升级注意事项 1. *** 0.42 版本增加了群成员数限制,默认为2000。如果您想修改默认值,可以在升级版本之后,修改t_setting表,把默认的大小改为您期望的。另外修改t_group表,把已经存在的群组max_member_count改成您期望的,然后重启。*** 2. *** 0.46和0.47版本升级到0.48及以后版本时,可能会提示flyway migrate 38错误,请执行 [修复脚本](https://github.com/wildfirechat/server/blob/wildfirechat/flyway_repaire_migrate_38.sql) 进行修复。0.46和0.47版本之外的版本不会出现此问题。*** 3. *** 0.50版本添加了是否允许客户端发送群操作通知的配置。如果您在客户端自定义群通知,需要在服务器端配置允许,没有使用自定义群操作通知的不受影响。*** 4. *** 从0.54之前版本升级到0.54及以后版本时,会提示flyway migrate错误。因为0.54版本删除了sql脚本中默认敏感词的内容,flyway checksum失败。请执行```update flyway_schema_history set checksum = 0 where script = 'V17__add_default_sensitive_word.sql';```来修复。*** 5. *** 从0.59之前的版本升级到之后的版本执行数据库升级时间比较长,请耐心等待提示运行成功,避免中途中断。 *** 6. *** 0.62/0.63 版本有严重的问题,请使用0.64及以后版本,或者0.61版。 *** 7. *** 从0.68 版本起添加了pc在线是否默认手机接收推送的开关,默认为开,与以前版本作用相反,请注意兼容(可以关掉与之前保持一致或者升级客户端) *** 8. *** 从0.78 版本起把MySQL数据库中关键字都改为大小写敏感,另外生成id的方法也做了改变,只生成小写的id,避免出现id重复的问题,建议所有客户都升级 *** 9. *** 从0.79 版本起把log4j升级到log4j2,因为log4j已经不再维护而且还有已知的漏洞,建议所有客户都升级,升级时注意更新log4j2的配置文件 *** 10. *** 0.97版本更改了启动脚本```wildfirechat.sh```,如果是升级服务,请注意更新启动脚本。*** 11. *** 1.3.8版本添加了server api发送消息的限制,限制消息体最大内容不能超过64KB,如果升级请注意业务系统发送消息大小。*** # 更新记录 -------------- Release note 1.4.5: 1. 解决删除用户时保留信息错误问题。 2. Server API获取用户信息时,可以指定是否获取已删除用户。 3. 好友关系表添加一个索引。 4. 支持PC端锁定功能。 -------------- Release note 1.4.4: 1. Server SDK添加mesh相关修改 2. 添加设置好友Extra的接口。 3. 解决创建账户时,没有传昵称使用了账户的问题。 4. 添加获取用户机器人列表的Server API。 5. 机器人回调消息中加上目标机器人ID。 6. 机器人获取用户信息添加配置确定能获取哪些字段。 -------------- Release note 1.4.3: 1. 添加内置存储上传文件文件名有效性检查。 2. 接受好友请求通知的发送者改成接受者发送。 3. 对象存储添加预留类型供扩展使用。 4. 同步专业版数据库表格式。 5. 解决server sdk有轻微内存泄漏的问题。 -------------- Release note 1.4.2: 1. 解决部分情况下Server SDK没有解析出文本消息的问题。 -------------- Release note 1.4.1: 1. 解决移动端和PAD同时存在时推送计数错误问题。 2. 添加配置,当销毁用户时是否销毁用户信息和用户的消息。 3. 添加配置,现在搜索用户的次数。 -------------- Release note 1.4.0: 1. 添加对用户IP来源的记录。 2. 移除无用的plugin,可以在java8环境下编译通过。 3. Server SDK解决某些Java版本下消息没有注册的问题。 4. Server SDK解决解析图片缩略图不存在的错误问题。 5. Server SDK解决发送带引用的消息客户端无法解析的问题。 -------------- Release note 1.3.9: 1. 解决server sdk反复初始化内存泄漏的问题。 2. 群组支持用户@不在群组中的机器人。 3. 单聊会话支持@机器人。 4. 机器人支持回复消息,可以回复单聊或者群聊消息。 -------------- Release note 1.3.8: 1. 添加限制,server api发送消息,限制消息体不能大于64KB。 2. 添加配置敏感词是否过滤用户信息群组信息昵称等。 3. 配置文件可以设置不允许使用的用户名字群组名称群名片等。 4. server api发送消息添加参数,可以以用户权限发送消息。 5. server api添加群备注和收藏群组接口。 -------------- Release note 1.3.7: 1. 搜索用户可以指定搜索机器人、普通用户或者所有。 2. 添加群组成员时,允许部分失败。 3. 解决内置存储上传文件时可能内存泄漏。 4. 支持客户端上传本地角标,用于推送得到较为精确的角标数字。 5. 解决机器人回调配置携带发送者用户信息无效的问题。 -------------- Release note 1.3.6: 1. Server API创建频道时,返回频道ID和频道密钥。 2. 解决外置审核替换内容没有成功的问题。 3. 修改撤回消息限制,可以运行不限制撤回。 4. 创建/更新频道接口可以传菜单参数。 5. Server API支持修改群组类型。 -------------- Release note 1.3.5: 1. 转发消息回调中可以配置带上发送者和目标信息。 2. Server SDK中添加撤回和删除消息。 3. Server SDK中添加发送朋友圈接口。 4. 添加配置是否允许发送消息给被封禁用户。 5. 音视频通话挂断推送中带上发起消息的ID -------------- Release note 1.3.4: 1. 优化Server SDK中消息内容的处理方式。 2. Server SDK中添加注册消息接口,在使用自定义消息时,不需要修改Server SDK源码。 3. 用户撤回时间配置允许为负数,为负数时可以任意时间撤回。 4. Server SDK添加超时参数。 5. 解决当分段拉取消息时,可能丢失消息的问题。 -------------- Release note 1.3.3: 1. 转移群组时检查新群主是否在群中。 2. 机器人API添加定向消息接口。 -------------- Release note 1.3.2: 1. 机器人Server SDK添加朋友圈相关接口。 2. Server API添加批量获取用户接口。 3. 解决聊天室定向消息无效的问题。 4. 添加配置,可以在禁止私聊时添加例外聊天线路。 -------------- Release note 1.3.1: 1. 透传消息去掉消息ID,减少消息传输大小。 2. 修改添加好友策略,可以设置禁止加自己好友。 3. Server API创建群组时,检查是否设置operator。 4. SDK添加删除广播和组播消息接口 -------------- Release note 1.3.0: 1. 推送信息中添加republish参数,用于标识消息是重新发布的。 2. 添加好友请求限频功能,在IM服务配置中可以配置每天限制添加的好友数。 3. 添加配置,是否允许用户发送消息给被拉黑的用户。 4. 添加鸿蒙回调地址。 5. 创建群组或者添加群组成员时,群组成员的Extra会放到通知消息的extra中,这样便于业务处理通知消息。 -------------- Release note 1.2.9: 1. 解决server api获取群组信息不全的问题。 2. 添加配置使用uuid作为用户群组等ID。 -------------- Release note 1.2.8: 1. server api获取被封禁用户时,过滤掉正常用户。 2. 解决群组标记删除错误。 3. SDK中添加发送消息的示例。 4. 群解散后撤回群中的消息应该失败。 5. 解决某些时候http请求返回信息无法读取问题。 -------------- Release note 1.2.7: 1. 解决搜索频道时某些类型的频道无法被搜索的问题。 2. 添加频道回调新特性,方便使用。 3. 解决机器人API修改机器人用户信息客户端没有更新的问题。 4. Server SDK中关于频道的接口放到ChannelAdmin中。 5. 添加Mesh功能的SDK。 -------------- Release note 1.2.6: 1. 群主强制被退群时(销毁账号/server api强制退群),调整新群主选择,群管理优先,先加入群组优先。 2. 拉取远程消息时,过滤掉可能重复的消息。 3. 退群时添加是否保留消息的参数,可以退群后保留原有消息。 4. 如果不在群组中,当获取群组信息时不更新数据。 -------------- Release note 1.2.5: 1. Server API添加通过邮箱获取用户信息的接口。 2. 支持群组标记删除功能。 3. 添加配置,可以设置在静音时强制推送指定类型消息。 4. 支持用户设置添加好友是否验证功能 -------------- Release note 1.2.4: 1. 去掉用户的默认密码。 2. 去掉频道和机器人的默认头像。 3. 修改在线状态回调数据,返回此用户的所有端状态。 -------------- Release note 1.2.3: 1. 同步专业版IM服务server SDK。 2. 添加对鸿蒙平台的支持。 3. 解决server端音视频SDK信令支持问题。 4. 升级部分依赖,解决漏洞问题 -------------- Release note 1.2.2: 1. 解决搜索特殊字符时的转义问题。 2. SDK添加流式消息。 3. 添加配置,是否禁止拉陌生人入群。 4. 放被拉黑时禁止被拉入群 5. 群组信息变更回调时加上群组信息 6. 机器人sdk添加撤回和更新消息接口 -------------- Release note 1.2.1: 1. 添加获取在线用户功能。 2. 添加获取用户连接session信息的功能。 3. 优化按照用户id搜索用户的逻辑。 4. 解决广播消息没有发给未登录用户的问题。 -------------- Release note 1.2.0: 1. 添加配置开关,可以关掉api/version检查接口。 2. Server SDK会议事件中添加时间戳。 3. 禁止私聊时,如果一方在允许私聊列表中,允许私聊。 4. 解决某些特殊情况下获取网卡信息失败导致启动失败的问题。 5. 支持按照用户ID来搜索用户。 6. 添加获取某个用户是否在聊天室的接口。 7. 优化多端加入聊天室的处理。 -------------- Release note 1.1.9: 1. 解决服务器时间误差太大引起的问题。 2. 添加推送过期配置。 3. 支持发送好友请求后5分钟之内再次发送。 4. Server API支持根据群成员类型获取用户群列表。 5. 添加配置,是否允许群主和群管理员无限制撤回自己的消息。 -------------- Release note 1.1.8: 1. 解决可以把群主设置为管理员的问题。 2. 发送好友请求之后5分钟内可以再次发送。 3. 解决撤回消息中原消息二进制内容格式错误问题。 -------------- Release note 1.1.7: 1. 优化用户搜索功能。 2. 推送消息中使用群备注。 3. 推送消息中添加发送者和目标头像。 4. 优化撤回消息流程。 -------------- Release note 1.1.6: 1. 支持用户设置查找自己的方法。 2. 解决获取用户信息返回type无效的问题。 3. 添加用户获取频道的功能。 -------------- Release note 1.1.5: 1. 添加获取所有用户的Server API。 2. 解决添加好友时没有处理黑名单的问题。 -------------- Release note 1.1.4: 1. 添加PC客户端多端登录互踢时没有更新pc在线状态问题。 2. 添加支持使用AES256加密。 3. Server API添加获取单个群成员的接口。 4. 添加配置,添加机器人为好友时是否自动接受。 -------------- Release note 1.1.3: 1. 添加服务器和客户端时间检查功能。 2. 解决用户被block后session失效的问题。 3. 添加消息撤回回调。 4. 优化群组撤回逻辑。 5. 解决用户离开群组后还能修改群昵称的问题。 6. 修改server api修改好友关系回调数据错误问题。 7. 同步超级群组数据库和数据。 -------------- Release note 1.1.2: 1. 会议SDK添加查询会议是否存在的接口 2. 单聊会话定向消息分发包含发送者 -------------- Release note 1.1.1: 1. 当用户获取群组信息,可以根据返回信息判断是否在群中。 2. 搜索用户时,过滤掉已删除用户 3. 支持单聊消息的定向消息 4. 解决关闭roaming,且message.compensate_time_limit配置为-1时,首次消息无法同步的问题 5. 解决禁止客户端群操作flag 解析错误 -------------- Release note 1.1: 1. Channel API添加检查用户是否订阅接口 2. Server API发送消息时添加检查对象是否存在 3. Channel API添加修改频道菜单接口 4. 内置对象存储的优化 -------------- Release note 1.0: 1. SDK检查工具添加help命令 2. 去掉短连接端口被网络爬虫扫描输出的异常日志 3. API支持创建组织群 4. 添加配置禁止客户端进行某些群操作 5. 解决route请求时可能不能正确携带推送类型的问题 6. 会议成员离开加上离开原因 7. 添加停止程序的命令 8. 添加RTP Forward的API -------------- Release note 0.99: 1. API获取用户信息时,过滤掉已经删除用户。 2. 消息转发功能支持设置include/exclude功能,支持按区间过滤。 3. 添加新的群组类型:组织群。组织群适用于公司部门群场景。 4. 内置对象存储支持绝对路径和相对路径配置 5. 当开启禁止陌生人聊天时,可以添加例外人员 6. 解决user setting并发问题 7. 添加可选的android平台签名验证功能。 -------------- Release note 0.98: 1. 解决linux多端登录错误问题 2. 添加获取用户群组和共同群组功能 3. 解决windows下脚本编码错误问题 -------------- Release note 0.97: 1. 升级部分依赖库到最新版本 2. 添加名片消息默认推送信息 3. 添加deb和rpm格式软件包 -------------- Release note 0.96: 1. 文章消息添加摘要字段 2. 单聊消息支持server api只发送给其中一方 3. Server api添加会议录制/停止录制接口 -------------- Release note 0.95: 1. 添加按照用户删除会话接口 2. 升级netty版本为4.1.68.Final 3. 公众号文章添加摘要字段 -------------- Release note 0.94: 1. Server SDK添加删除会话接口 2. 解决内置对象存储某些类型文件返回content-type错误问题 3. 添加server api检查是否订阅频道接口 4. 添加超频检查忽略信令 5. gson单例化,且关掉html转义。 -------------- Release note 0.93: 1. Server API添加订阅频道功能 2. 短链接端口添加HEAD方法处理 3. Server SDK的HTTP Client调整部分参数,解决出现连接错误问题 4. 添加敏感词回调功能 -------------- Release note 0.92: 1. SDK部分POJO对象添加无参数构造函数解决某些反序列化工具失败问题。 2. 频道只有在auto属性为1时,才会回调函数及订阅事件。 3. 添加配置,在关闭消息漫游时,客户端首次登录同步多久时间之内的消息。 4. 频道添加菜单属性。 --------------- Release note 0.91: 1. 创建群组时检查群组类型的有效性。 2. 添加配置消息回调时是否带上客户端信息。 3. 添加群组成员时,检查是否已经在群组中。 --------------- Release note 0.90: 1. mysql-connector-java版本升级到8.0.28 2. 配置文件中去掉绑定IP的配置,防止误操作 3. 解决客户端触发限频多调用一次callback的错误。 --------------- Release note 0.89: 1. gson依赖库升级到2.8.9 2. log4j升级到2.17.2 3. 解决SDK部分响应反序列化失败的问题 4. 添加配置允许PC多端 --------------- Release note 0.88: 1. 添加部分数据库表的索引。 2. 优化频道订阅关系的缓存处理。 3. 添加支持开放平台的接口。 4. 机器人和频道回调消息中添加缺失信息。 5. 频道automic状态为1时,都不发送消息给owner。 6. 机器人api添加获取机器人信息的接口。 7. 解决server api撤回单聊消息时发送方无法撤回的问题 --------------- Release note 0.87: 1. 优化pc在线状态逻辑。 2. 添加配置当删除用户时使用的用户昵称。 3. 添加获取单条消息接口。 --------------- Release note 0.86: 1. Server SDK获取在线用户结果的变量改成公开 --------------- Release note 0.85: 1. 消息只能撤回一次,不能重复撤回。 3. gzip压缩避免内存泄漏 --------------- Release note 0.84: 1. 定向消息,如果有多于一个收件人,只保存第一个收件人,避免定向消息被远程消息拉取下来。 3. 内置文件存储,是否内存避免内存泄漏。 --------------- Release note 0.83: 1. 解决多端登陆时,处理好友请求状态同步问题 2. SDK会议接口中添加permanent参数,可以创建永久保存会议。 --------------- Release note 0.82: 1. 修正PC在线状态逻辑错误问题 2. 销毁用户时,清理所有信息 4. SDK中添加更新消息的接口(仅专业版支持) 5. SDK中添加获取在线用户数据(仅专业版支持) --------------- Release note 0.81: 1. 修正PC在线状态某些特殊情况下错误问题 2. 写入用户信息关系表时带上会话信息 --------------- Release note 0.80: 1. 全局频道或者可以给非订阅用户发送消息的频道允许非订阅用户回复消息 2. Server API获取群组成员带上群组成员加入时间 4. 支持平板端接入 5. 解决有时PC在线状态错误问题 6. log4j2升级到2.17.1 --------------- Release note 0.79: 1. 频道API发送消息时,如果automic则不发送给频道主 2. 修改UserSetting表的key字段长度 3. 敏感词过滤跳过链接,链接内的词语不过滤敏感词 4. 销毁聊天室时,清理相关数据 6. 加入聊天室时判断是否聊天室已经清理 7. 升级log4j到log4j2 --------------- Release note 0.78: 1. 添加是否允许机器人自定义群通知的配置 2. 修正禁止存储searchablecontent时的错误问题 3. 解决API修改群组或用户为空时的异常问题 4. 当用户修改自己信息时,通知其他的更新自己的信息 5. MySQL数据字段中的关键字改为大小写敏感 7. 使用新的id生成方法,生成9为数字小写字母组成的id。 --------------- Release note 0.77: 1. Server API添加获取频道信息,销毁频道,销毁机器人功能。 2. 解决频道API发送中文乱码问题。 3. 解决频道拉取远程消息错乱问题。 4. 添加频道无密钥的错误码。 5. 解决频道和机器人API高压力下错乱问题。 --------------- Release note 0.76: 1. 为聊天室单独添加拉取远程消息开关。 2. 获取远程消息支持过滤消息类型。 3. 推送、消息、回调等事件HTTP请求失败打印提示信息。 --------------- Release note 0.75: 1. 修正有时欢迎语排序乱序问题。 2. 机器人禁止获取IM token。 --------------- Release note 0.74: 1. 发送好友请求时,如果已经是好友了,返回已经是好友的错误码 2. 修正通过server api修改用户昵称没有通知客户端的问题 3. 添加限频配置项 --------------- Release note 0.73: 1. 优化客户端断开连接功。 2. 解决双方同时添加好友,后接受的失败的问题。 --------------- Release note 0.72: 1. 添加提醒消息回调 2. 优化客户端断开连接功能 3. 支持客户端lite模式 --------------- Release note 0.71: 1. 添加多端登录被踢下线的错误码 2. 添加VOIP免打扰功能 3. 消息撤回推送功能 4. 推送只有pushData,没有pushContent也要推送 --------------- Release note 0.70: 1. 修改敏感词过滤问题 2. 添加修改好友附加信息的server api --------------- Release note 0.69: 1. 完善会议API 2. 解决配置文件中特殊字符的问题 3. 添加简单的健康检查API --------------- Release note 0.68: 1. 去掉脚本中GC日志输出,减少无效日志。 2. 添加配置是否加密存储消息。 3. 当接受好友请求时,如果请求原因为空,不发送消息。 4. 添加开关,当pc/web在线时移动端默认是否接收通知。 5. 解决文件不存在时的异常日志。 --------------- Release note 0.67: 1. Server API发送好友强制参数错误问题 2. 添加群组成员附加信息字段 3. 添加配置,允许加入聊天室不存在时自动创建 4. 解决Server API创建群组,部分参数无效问题 5. Server SDK链接复用问题修正 --------------- Release note 0.66: 1. Server SDK支持多个机器人账户 --------------- Release note 0.65: 1. 添加分段更新好友/好友请求/用户设置功能,防止相关数据太大无法更新下来 2. 同步Server SDK中关于会议的接口 3. 修正Server API设置好友请求被限制的问题 --------------- Release note 0.64: 1. 修正0.62版本重构引入的短链接错乱问题 2. 添加server api获取群组信息缺失字段 3. 添加配置项,可以为内置存储配置远程服务地址 --------------- Release note 0.63: 1. 实现频道权限功能 2. 配置文件中打开默认开启新好友欢迎语模式 3. 客户端更新用户设置时,不用再通知当前端 4. 群成员和好友请求中添加Extra字段 --------------- Release note 0.62: 1. 修改限频逻辑,server API,机器人api,频道api和客户端的限频要分开,避免server api超频导致客户端无法使用。 2. 添加关闭群主/群管理撤回用户权限的开关。 3. 对部分代码进行了重构。 --------------- Release note 0.61: 1. 升级缓存Hazelcast版本 --------------- Release note 0.60: 1. 解决server api修改群组信息失败问题 --------------- Release note 0.59: 1. 当server api未签名时,返回未签名的错误码 2. 当群成员离开群后再次加入群时,修改群成员createTime为最后一次加入时间 3. 解决自定义群组操作通知无效的问题 4. 群组修改extra时,发送通知给客户端 5. server api修改用户信息时添加修改name属性能力 6. 为user messages表添加会话信息及索引等 8. 内置测试存储文件上限提升到200MB --------------- Release note 0.58: 1. 多人音视频添加成员也需要推送消息 2. 添加禁言时允许发送的消息类型配置 3. 添加频道相关api --------------- Release note 0.57: 1. 修正某些情况下群组成员变更无法同步到客户端的问题 --------------- Release note 0.56: 1. 修正同一个设备登录多个用户的问题 2. 优化启动脚本,可以在bin目录下执行 --------------- Release note 0.55 1. 添加更新用户api接口 --------------- Release note 0.54: 1. 添加对接第三方敏感词处理接口 2. 添加消息转发类型过滤参数 3. 去掉对客户端最大版本号的限制,可以兼容未来版本客户端 4. 去掉默认敏感词 --------------- Release note 0.53: 1. 修正当敏感词策略为忽略时敏感词消息会从历史消息功能中拉取的问题 2. 修正创建群组时,如果没有把owner加入到群成员列表中,服务器自动加入群成员列表,但count计数时没有加入的问题 3. 添加获取两个用户之间用户关系的接口 4. 解决某些情况下群组成员计数不准确的问题 --------------- Release note 0.52: 1. 添加配置是否同步用户信息中敏感信息到客户端 2. SDK添加会话置顶功能 3. 屏蔽掉日志中消息内容的打印,防止日志泄漏聊天内容 4. 添加机器人进行群操作的功能 5. 添加机器人更改机器人回调地址的接口 6. 创建群组时,如果群主不在成员列表中自动加入群主 8. 禁止客户端直接修改自己的电话号码,只能通过server api修改自己的电话号码 9. 推送接听信息到客户端 10. 优化客户端被踢下线的逻辑 11. 内置存储下载时带上content-type字段 12. 添加历史消息自动清除功能,3年以上的历史消息自动删除 --------------- Release note 0.51: 1. 修改群成员昵称时,发送通知消息 2. 添加异常报警功能 3. 修正清除客户端清除掉数据库,无法获取自己发送消息的问题 4. 解决某些特殊情况下,用户session错误问题 5. 优化多端客户端被踢下线或者pc被手机踢下线的功能 --------------- Release note 0.50: 1. 解决分页查找用户或者频道,查找翻页错误问题 2. 添加是否允许客户端发送群操作通知的开关 3. 添加禁止客户端发送消息类型的配置,可以配置禁止客户端发送特定类型消息 4. 添加设置群成员昵称接口 5. 添加配置,当退群或者踢人时是否发送显式通知消息 --------------- Release note 0.48 1. 推送数据中加上用户id 2. server sdk发送消息接口添加定向用户参数 3. 状态消息改为可以同步到发送者其它端 4. 支持jdk15 5. 添加撤回组播和广播消息接口 6. 解决用户关系不存在时无法备注的问题 --------------- Release note 0.48 1. 同步专业版数据库 --------------- Release note 0.47: 1. 添加按照时间段免打扰功能 2. 解决服务器压力过大时消息id可能重复问题 3. 解决当拉取历史消息时,如果中间几个月没有发过消息无法拉取消息问题 4. 移除掉无用的fastjson库,避免系统安全警告 5. 添加群组/用户信息/频道信息变更通知 --------------- Release note 0.46: 1. Server api获取用户好友以好友状态时间排序 2. 增加Server api发送好友请求的功能 3. 解决server api删除好友时没有发送通知的问题 4. 添加PC在线时是否移动端推送的开关 5. 在频道或机器人没有密钥的情况下禁止使用api 6. 添加默认文件助手用户 7. 支持群主或群管理修改群成员昵称的功能 --------------- Release note 0.45: 1. 修正golang server api请求兼容问题。 2. 修改两个用户互相发送好友请求时,丢失其中一条的问题。 3. 解决server api删除好友失败的问题。 --------------- Release note 0.44: 1. 解决server api修改群成员昵称不生效的问题 2. 添加服务器端允许撤回时间最长限制,仅对普通用户有效,系统管理员/server api/群管理员可以任何时候撤回消息 3. 获取群成员接口检查权限,不在群组中成员无法获取群成员。 4. 撤回消息的extra中添加更多原始消息内容 5. 用户在线状态回调接口添加包名 6. 创建群组时,按照请求列表顺序对成员排序 7. 修正server SDK中的错误测试例 9. Server SDK中添加对专业版白名单的支持 10. 修正server api中设置好友状态不能实时同步到客户端的问题 11. 修正客户端创建群组时,群主的群成员状态错误问题 --------------- Release note 0.43: 1. 修改撤回消息,extra信息填写错误问题 2. 修正黑名单设置后无法取消问题 3. 推送信息添加push_data字段 4. 消息过期时间问题修正 5. server api创建群组时,添加更多的可选参数 6. 修正推送数据中计数不准确问题 > *** 0.42 版本增加了群成员数限制,默认为2000。如果您想修改默认值,可以在升级版本之后,修改t_setting表,把默认的大小改为您期望的。另外修改t_group表,把已经存在的群组max_member_count改成您期望的,然后重启。*** -------------- Release note 0.42: 1. 当接受好友请求时,如果已经时好友,返回已经是好友的错误码 2. 解决SDK中修改群信息缺少自定义通知内容的问题 3. Server api获取群成员过滤掉已经删除成员信息 4. SDK增加群内禁言功能(仅专业版支持) 5. 转发消息带上消息id和时间戳 6. 对拉黑server api添加参数校验 7. 群成员添加加入时间属性 8. 音视频电脑挂掉消息不增加未读消息计数 9. 添加对群成员最大限制控制,默认为2000 10. 普通成员可以修改群extra属性。 12. 修改使用server api操作群时通知错误 > *** 0.42 版本增加了群成员数限制,默认为2000。如果您想修改默认值,可以在升级版本之后,修改t_setting表,把默认的大小改为您期望的。另外修改t_group表,把已经存在的群组max_member_count改成您期望的,然后重启。*** -------------- Release note 0.41: 1. 添加手机控制PC下线功能 2. 添加是否保存searchable_content字段的配置 3. 增加移动端退出不清除session且不推送消息操作(现在移动端退出有3个可选参数,断开连接有消息就推送/断开连接清掉服务器session/断开连接不推送且保留session) 4. SDK添加对物联网设备的支持(物联网接入功能仅专业版有效) -------------- Release note 0.40: 1. 修正拒绝好友错误问题。 2. 添加聊天室API。 3. 添加禁止用户搜索和禁止添加好友的配置。 4. 升级mysql connector到8.0.19版本。 5. 添加PC在线状态通知。 6. 在撤回消息中加上被撤回的内容。 7. 修改设置黑名单失败的问题。 8. 添加sticker bucket的支持。 -------------- Release note 0.39: 1. 修正群内定向消息发送错误问题 2. 添加好友成功多语言处理 3. 修正拒绝好友请求的错误问题 4. 修正内置测试文件服务器部分错误问题 5. 添加机器人根据电话号码或用户名查询用户接口 6. 修正Server SDK中的用户关系错误问题 7. 修改获取用户在线状态错误问题 8. 修正用户信息中社交字段无法更新问题 9. 在好友关系中添加extra字段 10. 给token添加过期时间配置 11. 添加获取聊天室成员的api 13. 修改被封禁用户连接失败的错误码 14. 添加好友请求推送 -------------- Release note 0.38: 1. 添加好友请求过期时间配置,可以配置重复发起好友请求时间 2. 修正黑名单策略为1时发送消息仍失败的错误 3. 增加sdk中聊天室创建接口,增加sdk聊天室相关测试代码 4. 修改创建用户时不能指定用户类型的错误 5. 增加日志默认大小 6. 修改频道发送消息给指定用户错误问题 7. 添加检查token是否正确的api 8. 修正频道创建错误,修正频道发送消息错误 --------------- Release note 0.37-1: 1. 修复聊天室逻辑错误 --------------- Release note 0.37 1. 修正sdk中好友相关接口的错误。 2. 添加是否运行陌生人聊天的配置。 3. 增加获取备注的api。 4. 增加用户在线状态回调功能。 5. 优化聊天室逻辑,添加用户超时退出聊天室配置和是否发消息自动加入配置。 6. 禁止发送消息给被封禁用户。 7. 判断是否devicetoken重复时,加上包名条件。 8. 添加好友请求相关时间配置。 9. 添加频道SDK --------------- Release note 0.36 1. 修正某些特殊情况下群组操作不同步的问题 2. 优化用户的session管理 --------------- Release note 0.35 1. 修正0.34版本引入的无法拉取消息的严重问题 2. 修正单条消息大于512K时无法收取消息问题 3. 修改群主被添加进群状态错误问题 4. 添加新的搜索类型,新增加按照账户或按照电话号码搜索 --------------- Release note 0.34 1.,添加销毁用户server接口和功能 2,添加获取用户群组列表接口和功能 3,添加用户已删除状态 4,解决IM服务调用推送服务内存泄漏问题 5,添加服务器为用户缓存消息条数配置 -------------- Release note 0.33 1. 优化用户session逻辑 -------------- Release note 0.32: 1. 排除重复的device token 2. 添加关闭多端功能。 -------------- Release note 0.31: 1,解决了黑名单的同步的问题 2,解决了黑名单发送消息成功的问题 -------------- Release note 0.30: 1,重构了黑名单功能,好友关系和黑名单关系分开 2,添加敏感词后立即生效 3,转让群主后,群成员状态问题修复 4,修改离线消息包大小,从1M改为512K ================================================ FILE: sdk/README.md ================================================ # 野火IM Server Java SDK 野火IM Server Java SDK 是野火IM服务器的官方 Java 语言 SDK,提供了完整的 Admin API、Robot API 和 Channel API 接口封装。 ## 功能特性 - **用户管理**:创建用户、获取用户信息、更新用户信息、封禁/解封用户等 - **群组管理**:创建群组、添加/移除成员、转让群主、设置管理员等 - **消息管理**:发送消息、广播消息、撤回消息、删除消息等 - **好友关系**:添加好友、删除好友、获取好友列表、设置黑名单等 - **聊天室管理**:创建聊天室、获取聊天室信息、销毁聊天室等 - **频道管理**:创建频道、订阅/取消订阅、发送频道消息等 - **机器人服务**:机器人消息收发、用户信息查询、群组管理等 - **会议管理**:创建会议、查询会议信息、管理参会者等(高级音视频功能) - **朋友圈功能**:发布动态、评论、点赞等(需启用朋友圈功能) - **敏感词管理**:添加/删除敏感词、检查敏感词等 ## 安装 ### Maven 依赖 ```xml com.google.code.gson gson 2.8.9 commons-httpclient commons-httpclient 3.1 org.apache.httpcomponents httpclient 4.5.13 commons-codec commons-codec 1.15 com.google.protobuf protobuf-java 2.5.0 com.googlecode.json-simple json-simple 1.1.1 cn.wildfirechat sdk 1.2.2 system ${project.basedir}/lib/sdk.jar cn.wildfirechat common 1.2.2 system ${project.basedir}/lib/common.jar org.springframework.boot spring-boot-maven-plugin true ``` ### SDK 获取 1. 从源码编译:本项目位于 `server/sdk` 目录 2. 从发布包获取:在 release 包的 `server_sdk` 目录中 ## 快速开始 ### Admin 管理 API ```java import cn.wildfirechat.sdk.AdminConfig; import cn.wildfirechat.sdk.UserAdmin; import cn.wildfirechat.sdk.MessageAdmin; import cn.wildfirechat.pojos.InputOutputUserInfo; import cn.wildfirechat.pojos.Conversation; import cn.wildfirechat.sdk.messagecontent.TextMessageContent; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.sdk.model.IMResult; public class QuickStart { public static void main(String[] args) throws Exception { // 初始化配置 AdminConfig.initAdmin("http://localhost:18080", "123456"); // 创建用户 InputOutputUserInfo user = new InputOutputUserInfo(); user.setUserId("user1"); user.setName("user1"); user.setDisplayName("Test User"); user.setMobile("13900000000"); IMResult result = UserAdmin.createUser(user); if (result.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("创建用户成功: " + result.getResult().getUserId()); } // 获取用户 Token IMResult tokenResult = UserAdmin.getUserToken( "user1", "client1", ProtoConstants.Platform.Platform_Android ); if (tokenResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Token: " + tokenResult.getResult().getToken()); } // 发送消息 Conversation conversation = new Conversation(); conversation.setType(ProtoConstants.ConversationType.ConversationType_Private); conversation.setTarget("user2"); conversation.setLine(0); TextMessageContent content = new TextMessageContent("Hello, World!"); MessagePayload payload = content.encode(); IMResult msgResult = MessageAdmin.sendMessage("user1", conversation, payload); if (msgResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("消息发送成功,ID: " + msgResult.getResult().getMessageUid()); } } } ``` ### Robot 机器人服务 ```java import cn.wildfirechat.sdk.RobotService; import cn.wildfirechat.sdk.messagecontent.TextMessageContent; public class RobotExample { public static void main(String[] args) throws Exception { // 初始化机器人服务 RobotService robot = new RobotService("http://localhost", "robot1", "123456"); // 获取机器人信息 IMResult profile = robot.getProfile(); if (profile.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("机器人名称: " + profile.getResult().getDisplayName()); } // 发送消息给用户 TextMessageContent content = new TextMessageContent("Hello from robot!"); IMResult result = robot.sendMessage("user1", content); if (result.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("机器人消息发送成功"); } // 获取用户信息 IMResult userInfo = robot.getUserInfo("user1"); if (userInfo.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("用户显示名: " + userInfo.getResult().getDisplayName()); } } } ``` ### Channel 频道服务 ```java import cn.wildfirechat.sdk.ChannelServiceApi; import cn.wildfirechat.sdk.messagecontent.TextMessageContent; public class ChannelExample { public static void main(String[] args) throws Exception { // 初始化频道服务 ChannelServiceApi channel = new ChannelServiceApi("http://localhost", "channel1", "secret"); // 发送广播消息给订阅者 TextMessageContent content = new TextMessageContent("Channel broadcast message"); IMResult result = channel.broadcastMessage(content); if (result.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("频道广播消息发送成功"); } // 用户订阅频道 IMResult subscribeResult = channel.subscribe("user1"); if (subscribeResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("订阅成功"); } // 获取频道订阅者(商业版功能) IMResult subscribers = channel.getSubscriberList(); if (subscribers.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("订阅者数量: " + subscribers.getResult().getList().size()); } } } ``` ## 运行测试 SDK 提供了完整的测试示例 `Main.java`: ```bash # 编译 mvn compile # 运行测试(使用默认配置) mvn exec:java -Dexec.mainClass="cn.wildfirechat.sdk.Main" # 运行测试(自定义配置) mvn exec:java -Dexec.mainClass="cn.wildfirechat.sdk.Main" \ -Dexec.args="http://your-server:18080 your-secret http://your-server false false" ``` ### 命令行参数 ``` Usage: java -jar sdk.jar adminUrl adminSecret imUrl commercialServer advanceVoip 参数说明: adminUrl - 管理API地址,如 http://localhost:18080 adminSecret - 管理员密钥 imUrl - IM服务地址(机器人/频道使用),如 http://localhost commercialServer - 是否为商业版服务器 (true/false) advanceVoip - 是否启用高级音视频功能 (true/false) ``` ## 项目结构 ``` sdk/ ├── src/main/java/cn/wildfirechat/ │ ├── sdk/ │ │ ├── AdminConfig.java # 配置类 │ │ ├── UserAdmin.java # 用户管理 │ │ ├── GroupAdmin.java # 群组管理 │ │ ├── MessageAdmin.java # 消息管理 │ │ ├── RelationAdmin.java # 好友关系管理 │ │ ├── ChatroomAdmin.java # 聊天室管理 │ │ ├── ChannelAdmin.java # 频道管理 │ │ ├── GeneralAdmin.java # 通用管理 │ │ ├── SensitiveAdmin.java # 敏感词管理 │ │ ├── ConferenceAdmin.java # 会议管理 │ │ ├── MomentsAdmin.java # 朋友圈管理 │ │ ├── RobotService.java # 机器人服务 │ │ ├── ChannelServiceApi.java # 频道服务API │ │ ├── MeshAdmin.java # Mesh分布式管理 │ │ └── Main.java # 测试主程序 │ │ └── messagecontent/ # 消息内容类 │ │ ├── MessageContent.java │ │ ├── TextMessageContent.java │ │ ├── ImageMessageContent.java │ │ ├── SoundMessageContent.java │ │ ├── VideoMessageContent.java │ │ ├── FileMessageContent.java │ │ └── ... │ ├── common/ # 公共模块(依赖) │ └── proto/ # 协议常量 └── pom.xml # Maven配置 ``` ## 主要 API 说明 ### 用户管理 (UserAdmin) | 方法 | 说明 | |------|------| | `createUser()` | 创建用户 | | `getUserByName()` | 按用户名获取用户 | | `getUserByMobile()` | 按手机号获取用户 | | `getUserByUserId()` | 按用户ID获取用户 | | `updateUserInfo()` | 更新用户信息 | | `getUserToken()` | 获取用户IM Token | | `updateUserBlockStatus()` | 封禁/解封用户 | | `checkUserOnlineStatus()` | 检查用户在线状态 | ### 群组管理 (GroupAdmin) | 方法 | 说明 | |------|------| | `createGroup()` | 创建群组 | | `getGroupInfo()` | 获取群组信息 | | `addGroupMembers()` | 添加群成员 | | `kickoffGroupMembers()` | 踢出群成员 | | `transferGroup()` | 转让群主 | | `dismissGroup()` | 解散群组 | ### 消息管理 (MessageAdmin) | 方法 | 说明 | |------|------| | `sendMessage()` | 发送消息 | | `broadcastMessage()` | 广播消息 | | `multicastMessage()` | 群发消息 | | `recallMessage()` | 撤回消息 | | `deleteMessage()` | 删除消息 | ### 好友关系 (RelationAdmin) | 方法 | 说明 | |------|------| | `setUserFriend()` | 设置好友关系 | | `getFriendList()` | 获取好友列表 | | `setUserBlacklist()` | 设置黑名单 | | `getUserBlacklist()` | 获取黑名单列表 | ## 接口文档 - [Admin API 文档](https://docs.wildfirechat.cn/server/admin_api/) - 服务端管理接口,包括用户、群组、消息、频道等管理功能 - [Robot API 文档](https://docs.wildfirechat.cn/server/robot_api/) - 机器人服务接口,用于开发机器人应用 - [Channel API 文档](https://docs.wildfirechat.cn/server/channel_api/) - 频道服务接口,用于开发公众号/频道应用 - [IM 开发文档](https://docs.wildfirechat.cn/) - 野火IM完整开发文档 ## 其他语言 SDK | 语言 | GitHub | Gitee(码云) | |------|------------------------------------------------------------------|-------------| | Java SDK | [GitHub](https://github.com/wildfirechat/server/tree/master/sdk) | [Gitee](https://gitee.com/wfchat/im-server/tree/wildfirechat/sdk) | | Python SDK | [GitHub](https://github.com/wildfirechat/server-sdk-python) | [Gitee](https://gitee.com/wfchat/im-server/server-sdk-python) | | Go SDK | [GitHub](https://github.com/wildfirechat/server-sdk-go) | [Gitee](https://gitee.com/wfchat/server-sdk-go) | | Node.js SDK | [GitHub](https://github.com/wildfirechat/server-sdk.js) | [Gitee](https://gitee.com/wfchat/server-sdk.js) | ## 相关链接 - [野火IM 官网](https://wildfirechat.cn/) - [在线文档](https://docs.wildfirechat.cn/) - [服务端源码 - GitHub](https://github.com/wildfirechat/server) | [Gitee](https://gitee.com/wfchat/im-server) - [应用服务源码 - GitHub](https://github.com/wildfirechat/app-server) | [Gitee](https://gitee.com/wfchat/app-server) - [机器人服务源码 - GitHub](https://github.com/wildfirechat/robot-server) | [Gitee](https://gitee.com/wfchat/robot-server) - [推送服务源码 - GitHub](https://github.com/wildfirechat/push-server) | [Gitee](https://gitee.com/wfchat/push-server) - [论坛交流](https://bbs.wildfirechat.cn/) ## 注意事项 1. **Admin API** 使用 18080 端口,具有超级管理权限,理论上不应对外开放,也不应让非内部服务知悉密钥。 2. **Robot API** 和 **Channel API** 使用 IM 服务的公开端口(默认 80),第三方可以使用机器人或频道与 IM 系统进行对接。 3. 商业版服务器支持更多高级功能,如在线用户统计、设备管理等。 4. 高级音视频功能需要单独启用,支持会议管理相关 API。 ## 许可证 本项目采用与野火IM相同的许可证。 ================================================ FILE: sdk/pom.xml ================================================ wildfirechat-parent cn.wildfirechat 1.4.5 4.0.0 sdk com.google.code.gson gson 2.8.9 commons-io commons-io 2.7 com.googlecode.json-simple json-simple 1.1.1 org.slf4j slf4j-api 1.7.5 org.slf4j slf4j-log4j12 1.7.5 commons-httpclient commons-httpclient 3.1 uk.org.lidalia slf4j-test 1.0.0-jdk6 test org.mockito mockito-all 1.9.5 jar test org.apache.httpcomponents httpclient 4.5.13 org.apache.httpcomponents httpmime 4.5.13 commons-codec commons-codec 1.13 cn.wildfirechat common ${project.version} ${project.artifactId}-${version} install org.apache.maven.plugins maven-assembly-plugin jar-with-dependencies checker false cn.wildfirechat.sdk.Main assemble-all package single ================================================ FILE: sdk/sdk_readme.txt ================================================ SDK使用说明: 1. 把common.jar和sdk.jar 放到lib目录下(如没有需要手动建)。 2. 添加下属依赖,注意本地jar包的路径。 3. 修改build plugin,把common和sdk打包进去。 4. 使用方法请查看sdk.jar/cn.wildfirechat.sdk/Main.class(没有混淆,可以看到源码) com.google.code.gson gson 2.8.9 commons-httpclient commons-httpclient 3.1 org.apache.httpcomponents httpclient 4.5.13 commons-codec commons-codec 1.15 com.google.protobuf protobuf-java 2.5.0 com.googlecode.json-simple json-simple 1.1.1 cn.wildfirechat sdk 1.2.2 system ${project.basedir}/src/lib/sdk-1.1.9.jar cn.wildfirechat common 1.2.2 system ${project.basedir}/src/lib/common-1.1.9.jar org.springframework.boot spring-boot-maven-plugin true ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/AdminConfig.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; /** * 管理员配置类 *

* 用于初始化管理员SDK的配置,包括IM服务器URL和密钥。 * 在使用任何Admin功能之前,必须先调用initAdmin方法进行初始化。 *

*/ public class AdminConfig { /** * 初始化管理员配置 *

* 在使用任何Admin功能之前,必须先调用此方法进行初始化。 *

* @param url IM服务器地址,例如: http://your-im-server.com * @param secret 管理员密钥,在服务器配置中设置 */ public static void initAdmin(String url, String secret) { AdminHttpUtils.init(url, secret); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/ChannelAdmin.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.*; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; /** * 频道管理类 *

* 提供频道管理相关的功能,包括: *

    *
  • 创建和销毁频道
  • *
  • 获取频道信息
  • *
  • 用户订阅/取消订阅频道
  • *
  • 检查用户是否订阅频道
  • *
*

*/ public class ChannelAdmin { /** * 创建频道 * @param inputCreateChannel 频道创建信息 * @return 创建结果,包含频道ID * @throws Exception 请求失败时抛出异常 */ public static IMResult createChannel(InputCreateChannel inputCreateChannel) throws Exception { String path = APIPath.Create_Channel; return AdminHttpUtils.httpJsonPost(path, inputCreateChannel, OutputCreateChannel.class); } /** * 销毁频道 * @param channelId 频道ID * @return 销毁结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult destroyChannel(String channelId) throws Exception { String path = APIPath.Destroy_Channel; InputChannelId inputChannelId = new InputChannelId(channelId); return AdminHttpUtils.httpJsonPost(path, inputChannelId, Void.class); } /** * 获取频道信息 * @param channelId 频道ID * @return 频道信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getChannelInfo(String channelId) throws Exception { String path = APIPath.Get_Channel_Info; InputChannelId inputChannelId = new InputChannelId(channelId); return AdminHttpUtils.httpJsonPost(path, inputChannelId, OutputGetChannelInfo.class); } /** * 订阅频道 * @param channelId 频道ID * @param userId 用户ID * @return 订阅结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult subscribeChannel(String channelId, String userId) throws Exception { String path = APIPath.Subscribe_Channel; InputSubscribeChannel input = new InputSubscribeChannel(channelId, userId, 1); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 取消订阅频道 * @param channelId 频道ID * @param userId 用户ID * @return 取消订阅结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult unsubscribeChannel(String channelId, String userId) throws Exception { String path = APIPath.Subscribe_Channel; InputSubscribeChannel input = new InputSubscribeChannel(channelId, userId, 0); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 检查用户是否订阅了频道 * @param userId 用户ID * @param channelId 频道ID * @return true-已订阅,false-未订阅 * @throws Exception 请求失败时抛出异常 */ public static IMResult isUserSubscribedChannel(String userId, String channelId) throws Exception { String path = APIPath.Check_User_Subscribe_Channel; InputSubscribeChannel input = new InputSubscribeChannel(channelId, userId, 0); return AdminHttpUtils.httpJsonPost(path, input, OutputBooleanValue.class); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/ChannelServiceApi.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.*; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; import cn.wildfirechat.sdk.utilities.ChannelHttpUtils; import com.google.gson.Gson; import org.apache.commons.codec.digest.DigestUtils; import java.io.Closeable; import java.io.IOException; import java.util.List; import static cn.wildfirechat.proto.ProtoConstants.ApplicationType.ApplicationType_Channel; /** * 频道服务类(仅专业版支持,社区版不支持) *

* 提供频道相关的功能,包括: *

    *
  • 获取用户信息
  • *
  • 修改频道信息
  • *
  • 发送和撤回消息
  • *
  • 用户订阅管理
  • *
  • 订阅者列表查询
  • *
*

*/ public class ChannelServiceApi implements Closeable { private final ChannelHttpUtils channelHttpUtils; /** * 创建频道服务实例 * @param imurl IM服务器地址 * @param channelId 频道ID * @param secret 频道密钥 */ public ChannelServiceApi(String imurl, String channelId, String secret) { channelHttpUtils = new ChannelHttpUtils(imurl, channelId, secret); } public IMResult getUserInfo(String userId) throws Exception { String path = APIPath.Channel_User_Info; InputGetUserInfo getUserInfo = new InputGetUserInfo(userId, null, null); return channelHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class); } public IMResult getUserInfoByName(String userName) throws Exception { String path = APIPath.Channel_User_Info; InputGetUserInfo getUserInfo = new InputGetUserInfo(null, userName, null); return channelHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class); } public IMResult getUserInfoByMobile(String mobile) throws Exception { String path = APIPath.Channel_User_Info; InputGetUserInfo getUserInfo = new InputGetUserInfo(null, null, mobile); return channelHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class); } public IMResult modifyChannelInfo(/*ProtoConstants.ModifyChannelInfoType*/int type, String value) throws Exception { String path = APIPath.Channel_Update_Profile; InputModifyChannelInfo modifyChannelInfo = new InputModifyChannelInfo(); modifyChannelInfo.setType(type); modifyChannelInfo.setValue(value); return channelHttpUtils.httpJsonPost(path, modifyChannelInfo, Void.class); } public IMResult getChannelInfo() throws Exception { String path = APIPath.Channel_Get_Profile; return channelHttpUtils.httpJsonPost(path, null, OutputGetChannelInfo.class); } public IMResult modifyChannelMenu(List menus) throws Exception { String menuStr = new Gson().toJson(menus); return modifyChannelInfo(ProtoConstants.ModifyChannelInfoType.Modify_Channel_Menu, menuStr); } public IMResult sendMessage(int line, List targets, MessagePayload payload) throws Exception { String path = APIPath.Channel_Message_Send; SendChannelMessageData messageData = new SendChannelMessageData(); messageData.setLine(line); messageData.setTargets(targets); messageData.setPayload(payload); return channelHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class); } public IMResult recallMessage(long messageUid) throws Exception { String path = APIPath.Channel_Msg_Recall; RecallMessageData messageData = new RecallMessageData(); messageData.setMessageUid(messageUid); return channelHttpUtils.httpJsonPost(path, messageData, String.class); } public IMResult republishMessage(long messageUid, List targets) throws Exception { String path = APIPath.Channel_Msg_Republish; RepublishChannelMessageData messageData = new RepublishChannelMessageData(); messageData.setMessageId(messageUid); messageData.setTargets(targets); return channelHttpUtils.httpJsonPost(path, messageData, Void.class); } public IMResult subscribe(String userId) throws Exception { String path = APIPath.Channel_Subscribe; InputChannelSubscribe input = new InputChannelSubscribe(); input.setTarget(userId); input.setSubscribe(1); return channelHttpUtils.httpJsonPost(path, input, Void.class); } public IMResult unsubscribe(String userId) throws Exception { String path = APIPath.Channel_Subscribe; InputChannelSubscribe input = new InputChannelSubscribe(); input.setTarget(userId); input.setSubscribe(0); return channelHttpUtils.httpJsonPost(path, input, Void.class); } public IMResult getSubscriberList() throws Exception { String path = APIPath.Channel_Subscriber_List; return channelHttpUtils.httpJsonPost(path, null, OutputStringList.class); } public IMResult isSubscriber(String userId) throws Exception { String path = APIPath.Channel_Is_Subscriber; InputUserId input = new InputUserId(userId); return channelHttpUtils.httpJsonPost(path, input, Boolean.class); } public IMResult applicationGetUserInfo(String authCode) throws Exception { String path = APIPath.Channel_Application_Get_UserInfo; InputApplicationGetUserInfo input = new InputApplicationGetUserInfo(); input.setAuthCode(authCode); return channelHttpUtils.httpJsonPost(path, input, OutputApplicationUserInfo.class); } public OutputApplicationConfigData getApplicationSignature() { int nonce = (int)(Math.random() * 100000 + 3); long timestamp = System.currentTimeMillis()/1000; String str = nonce + "|" + channelHttpUtils.getChannelId() + "|" + timestamp + "|" + channelHttpUtils.getChannelSecret(); String sign = DigestUtils.sha1Hex(str); OutputApplicationConfigData configData = new OutputApplicationConfigData(); configData.setAppId(channelHttpUtils.getChannelId()); configData.setAppType(ApplicationType_Channel); configData.setTimestamp(timestamp); configData.setNonceStr(nonce+""); configData.setSignature(sign); return configData; } @Override public void close() throws IOException { channelHttpUtils.close(); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/ChatroomAdmin.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.*; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; /** * 聊天室管理类 *

* 提供聊天室管理相关的功能,包括: *

    *
  • 创建和销毁聊天室
  • *
  • 获取聊天室信息
  • *
  • 聊天室成员管理
  • *
  • 聊天室黑名单管理(仅专业版)
  • *
  • 聊天室管理员设置
  • *
  • 聊天室全员禁言
  • *
*

*/ public class ChatroomAdmin { /** * 创建聊天室 * @param chatroomId 聊天室ID(为空时自动生成) * @param title 聊天室标题 * @param desc 聊天室描述 * @param portrait 聊天室头像 * @param extra 额外信息 * @param state 聊天室状态 * @return 创建结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult createChatroom(String chatroomId, String title, String desc ,String portrait, String extra, Integer state) throws Exception { String path = APIPath.Create_Chatroom; InputCreateChatroom input = new InputCreateChatroom(); input.setChatroomId(chatroomId); input.setTitle(title); input.setDesc(desc); input.setPortrait(portrait); input.setExtra(extra); input.setState(state); return AdminHttpUtils.httpJsonPost(path, input, OutputCreateChatroom.class); } /** * 销毁聊天室 * @param chatroomId 聊天室ID * @return 销毁结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult destroyChatroom(String chatroomId) throws Exception { String path = APIPath.Chatroom_Destroy; InputDestoryChatroom input = new InputDestoryChatroom(); input.setChatroomId(chatroomId); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 获取聊天室信息 * @param chatroomId 聊天室ID * @return 聊天室信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getChatroomInfo(String chatroomId) throws Exception { String path = APIPath.Chatroom_Info; InputGetChatroomInfo input = new InputGetChatroomInfo(chatroomId); return AdminHttpUtils.httpJsonPost(path, input, OutputGetChatroomInfo.class); } /** * 获取聊天室成员列表 * @param chatroomId 聊天室ID * @return 成员ID列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getChatroomMembers(String chatroomId) throws Exception { String path = APIPath.Chatroom_GetMembers; InputGetChatroomInfo input = new InputGetChatroomInfo(chatroomId); return AdminHttpUtils.httpJsonPost(path, input, OutputStringList.class); } /** * 获取用户所在的聊天室 * @param userId 用户ID * @return 用户所在的聊天室信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserChatroom(String userId) throws Exception { String path = APIPath.Chatroom_GetUserChatroom; InputUserId input = new InputUserId(userId); return AdminHttpUtils.httpJsonPost(path, input, OutputUserChatroom.class); } /** * 设置聊天室黑名单状态(仅专业版支持) *

status:0-正常;1-禁言;2-禁止加入

* @param chatroomId 聊天室ID * @param userId 用户ID * @param status 状态值 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setChatroomBlacklist(String chatroomId, String userId, int status) throws Exception { String path = APIPath.Chatroom_SetBlacklist; InputSetChatroomBlacklist input = new InputSetChatroomBlacklist(chatroomId, userId, status, 0); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 获取聊天室黑名单 * @param chatroomId 聊天室ID * @return 黑名单信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getChatroomBlacklist(String chatroomId) throws Exception { String path = APIPath.Chatroom_GetBlacklist; InputChatroomId input = new InputChatroomId(chatroomId); return AdminHttpUtils.httpJsonPost(path, input, OutputChatroomBlackInfos.class); } /** * 设置聊天室管理员 *

status:1-设置为管理员;0-取消管理员

* @param chatroomId 聊天室ID * @param userId 用户ID * @param status 状态值 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setChatroomManager(String chatroomId, String userId, int status) throws Exception { String path = APIPath.Chatroom_SetManager; InputSetChatroomManager input = new InputSetChatroomManager(chatroomId, userId, status); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 获取聊天室管理员列表 * @param chatroomId 聊天室ID * @return 管理员ID列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getChatroomManagerList(String chatroomId) throws Exception { String path = APIPath.Chatroom_GetManagerList; InputChatroomId input = new InputChatroomId(chatroomId); return AdminHttpUtils.httpJsonPost(path, input, OutputStringList.class); } /** * 设置聊天室全员禁言 * @param chatroomId 聊天室ID * @param mute true-全员禁言,false-取消全员禁言 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setChatroomMute(String chatroomId, boolean mute) throws Exception { String path = APIPath.Chatroom_MuteAll; InputChatroomMute input = new InputChatroomMute(chatroomId, mute ? 1 : 0); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/ConferenceAdmin.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.*; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; /** * 会议管理类 *

* 提供音视频会议管理相关的功能,包括: *

    *
  • 会议列表查询
  • *
  • 会议创建和销毁
  • *
  • 会议参与者管理
  • *
  • 会议录制控制
  • *
  • RTP转发管理
  • *
*

*/ public class ConferenceAdmin { /** * 获取会议列表(分页) * @param count 每页数量 * @param offset 偏移量 * @return 会议信息列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult listConferences(int count, int offset) throws Exception { String path = APIPath.Conference_List; InputCountOffset inputCountOffset = new InputCountOffset(); inputCountOffset.count = count; inputCountOffset.offset = offset; return AdminHttpUtils.httpJsonPost(path, inputCountOffset, PojoConferenceInfoList.class); } /** * 检查会议是否存在 * @param conferenceId 会议ID * @return true-存在,false-不存在 * @throws Exception 请求失败时抛出异常 */ public static IMResult existsConferences(String conferenceId) throws Exception { String path = APIPath.Conference_Exist; PojoConferenceRoomId data = new PojoConferenceRoomId(conferenceId, false); return AdminHttpUtils.httpJsonPost(path, data, Boolean.class); } /** * 获取会议参与者列表 * @param roomId 房间ID * @param advance 是否使用高级模式 * @return 参与者列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult listParticipants(String roomId, boolean advance) throws Exception { String path = APIPath.Conference_List_Participant; PojoConferenceRoomId data = new PojoConferenceRoomId(roomId, advance); return AdminHttpUtils.httpJsonPost(path, data, PojoConferenceParticipantList.class); } /** * 创建会议房间 * @param roomId 房间ID * @param description 描述 * @param pin 房间密码 * @param maxPublisher 最大推流数 * @param advance 是否使用高级模式 * @param bitrate 比特率 * @param recording 是否录制 * @param permanent 是否永久房间 * @return 创建结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult createRoom(String roomId, String description, String pin, int maxPublisher, boolean advance, int bitrate, boolean recording, boolean permanent) throws Exception { String path = APIPath.Conference_Create; PojoConferenceCreate create = new PojoConferenceCreate(); create.roomId = roomId; create.description = description; create.pin = pin; create.max_publishers = maxPublisher; create.advance = advance; create.bitrate = bitrate; create.recording = recording; create.permanent = permanent; return AdminHttpUtils.httpJsonPost(path, create, Void.class); } /** * 启用或禁用会议录制 * @param roomId 房间ID * @param advance 是否使用高级模式 * @param recording true-启用录制,false-禁用录制 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult enableRecording(String roomId, boolean advance, boolean recording) throws Exception { String path = APIPath.Conference_Recording; PojoConferenceRecording create = new PojoConferenceRecording(); create.roomId = roomId; create.recording = recording; create.advance = advance; return AdminHttpUtils.httpJsonPost(path, create, Void.class); } /** * 销毁会议房间 * @param roomId 房间ID * @param advance 是否使用高级模式 * @return 销毁结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult destroy(String roomId, boolean advance) throws Exception { String path = APIPath.Conference_Destroy; PojoConferenceRoomId conferenceRoomId = new PojoConferenceRoomId(roomId, advance); return AdminHttpUtils.httpJsonPost(path, conferenceRoomId, Void.class); } /** * RTP转发 * @param roomId 房间ID * @param userId 用户ID * @param rtpHost RTP主机地址 * @param audioPort 音频端口 * @param audioPt 音频Payload类型 * @param audioSSRC 音频SSRC * @param videoPort 视频端口 * @param videoPt 视频Payload类型 * @param videoSSRC 视频SSRC * @return 转发结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult rtpForward(String roomId, String userId, String rtpHost, int audioPort, int audioPt, long audioSSRC, int videoPort, int videoPt, long videoSSRC) throws Exception { String path = APIPath.Conference_Rtp_Forward; PojoConferenceRtpForwardReq req = new PojoConferenceRtpForwardReq(roomId, userId, rtpHost, audioPort, audioPt, audioSSRC, videoPort, videoPt, videoSSRC); return AdminHttpUtils.httpJsonPost(path, req, Void.class); } /** * 停止RTP转发 * @param roomId 房间ID * @param userId 用户ID * @param streamId 流ID * @return 停止结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult stopRtpForward(String roomId, String userId, long streamId) throws Exception { String path = APIPath.Conference_Stop_Rtp_Forward; PojoConferenceStopRtpForwardReq req = new PojoConferenceStopRtpForwardReq(roomId, userId, streamId); return AdminHttpUtils.httpJsonPost(path, req, Void.class); } /** * 获取RTP转发列表 * @param roomId 房间ID * @return RTP转发列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult listRtpForwarders(String roomId) throws Exception { String path = APIPath.Conference_List_Rtp_Forward; PojoConferenceRoomId req = new PojoConferenceRoomId(); req.roomId = roomId; return AdminHttpUtils.httpJsonPost(path, req, PojoConferenceRtpForwarders.class); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/GeneralAdmin.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.*; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.apache.http.entity.ContentType; import org.apache.http.entity.FileEntity; import org.apache.http.entity.InputStreamEntity; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.FileBody; import org.apache.http.entity.mime.content.InputStreamBody; import org.apache.http.util.EntityUtils; import java.io.File; import java.io.InputStream; import java.net.URLConnection; /** * 通用管理类 *

* 提供通用的系统管理功能,包括: *

    *
  • 系统设置管理
  • *
  • 文件管理(会话文件、用户文件)
  • *
  • 用户设置管理(会话置顶等)
  • *
  • 健康检查
  • *
  • 频道管理(已废弃,请使用ChannelAdmin)
  • *
*

*/ public class GeneralAdmin { /** * 获取系统设置 * @param id 设置项ID * @return 系统设置信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getSystemSetting(int id) throws Exception { String path = APIPath.Get_System_Setting; SystemSettingPojo input = new SystemSettingPojo(); input.id = id; return AdminHttpUtils.httpJsonPost(path, input, SystemSettingPojo.class); } /** * 设置系统设置 * @param id 设置项ID * @param value 设置值 * @param desc 设置描述 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setSystemSetting(int id, String value, String desc) throws Exception { String path = APIPath.Put_System_Setting; SystemSettingPojo input = new SystemSettingPojo(); input.id = id; input.value = value; input.desc = desc; return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * @deprecated 请使用 {@link cn.wildfirechat.sdk.ChannelAdmin#createChannel(InputCreateChannel inputCreateChannel)} 代替此方法,因为它将在未来的版本中被移除。 */ @Deprecated public static IMResult createChannel(InputCreateChannel inputCreateChannel) throws Exception { String path = APIPath.Create_Channel; return AdminHttpUtils.httpJsonPost(path, inputCreateChannel, OutputCreateChannel.class); } /** * @deprecated 请使用 {@link cn.wildfirechat.sdk.ChannelAdmin#destroyChannel(String channelId)} 代替此方法,因为它将在未来的版本中被移除。 */ @Deprecated public static IMResult destroyChannel(String channelId) throws Exception { String path = APIPath.Destroy_Channel; InputChannelId inputChannelId = new InputChannelId(channelId); return AdminHttpUtils.httpJsonPost(path, inputChannelId, Void.class); } /** * @deprecated 请使用 {@link cn.wildfirechat.sdk.ChannelAdmin#getChannelInfo(String channelId)} 代替此方法,因为它将在未来的版本中被移除。 */ @Deprecated public static IMResult getChannelInfo(String channelId) throws Exception { String path = APIPath.Get_Channel_Info; InputChannelId inputChannelId = new InputChannelId(channelId); return AdminHttpUtils.httpJsonPost(path, inputChannelId, OutputGetChannelInfo.class); } /** * @deprecated 请使用 {@link cn.wildfirechat.sdk.ChannelAdmin#subscribeChannel(String userId, String channelId)} 代替此方法,因为它将在未来的版本中被移除。 */ @Deprecated public static IMResult subscribeChannel(String channelId, String userId) throws Exception { String path = APIPath.Subscribe_Channel; InputSubscribeChannel input = new InputSubscribeChannel(channelId, userId, 1); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * @deprecated 请使用 {@link cn.wildfirechat.sdk.ChannelAdmin#unsubscribeChannel(String userId, String channelId)} 代替此方法,因为它将在未来的版本中被移除。 */ @Deprecated public static IMResult unsubscribeChannel(String channelId, String userId) throws Exception { String path = APIPath.Subscribe_Channel; InputSubscribeChannel input = new InputSubscribeChannel(channelId, userId, 0); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * @deprecated 请使用 {@link cn.wildfirechat.sdk.ChannelAdmin#isUserSubscribedChannel(String userId, String channelId)} 代替此方法,因为它将在未来的版本中被移除。 */ @Deprecated public static IMResult isUserSubscribedChannel(String userId, String channelId) throws Exception { String path = APIPath.Check_User_Subscribe_Channel; InputSubscribeChannel input = new InputSubscribeChannel(channelId, userId, 0); return AdminHttpUtils.httpJsonPost(path, input, OutputBooleanValue.class); } /** * 获取会话文件列表(仅专业版支持) *

* 如果是单聊会话,target和userId代表会话的2个用户;如果是其他会话userId无意义。 *

* @param conversationType 会话类型 * @param target 会话目标ID * @param line 线路 * @param userId 用户ID * @param offset 偏移量 * @param desc 是否降序 * @param count 每页数量 * @return 文件列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getConversationFiles(int conversationType, String target, int line, String userId, int offset, boolean desc, int count) throws Exception { String path = APIPath.Get_Conversation_Files; GetConversationFilesPojo input = new GetConversationFilesPojo(); input.conversationType = conversationType; input.target = target; input.line = line; input.userId = userId; input.offset = offset; input.desc = desc; input.count = count; return AdminHttpUtils.httpJsonPost(path, input, FilesPojo.class); } /** * 获取用户文件列表 * @param userId 用户ID * @param offset 偏移量 * @param desc 是否降序 * @param count 每页数量 * @return 文件列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserFiles(String userId, int offset, boolean desc, int count) throws Exception { String path = APIPath.Get_User_Files; GetUserFilesPojo input = new GetUserFilesPojo(); input.userId = userId; input.offset = offset; input.desc = desc; input.count = count; return AdminHttpUtils.httpJsonPost(path, input, FilesPojo.class); } /** * 根据消息ID获取文件信息 * @param messageId 消息ID * @return 文件信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getFile(long messageId) throws Exception { String path = APIPath.Get_Message_File; LongPojo input = new LongPojo(); input.value = messageId; return AdminHttpUtils.httpJsonPost(path, input, FilesPojo.FilePojo.class); } /** * 设置会话置顶 * @param userId 用户ID * @param conversationType 会话类型 * @param target 会话目标ID * @param line 线路 * @param isTop true-置顶,false-取消置顶 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setConversationTop(String userId, int conversationType, String target, int line, boolean isTop) throws Exception { String key = conversationType + "-" + line + "-" + target; String value = isTop?"1":"0"; return setUserSetting(userId, 3, key, value); } /** * 获取会话置顶状态 * @param userId 用户ID * @param conversationType 会话类型 * @param target 会话目标ID * @param line 线路 * @return true-已置顶,false-未置顶 * @throws Exception 请求失败时抛出异常 */ public static IMResult getConversationTop(String userId, int conversationType, String target, int line) throws Exception { String key = conversationType + "-" + line + "-" + target; IMResult result = getUserSetting(userId, 3, key); IMResult out = new IMResult(); out.code = result.code; out.msg = result.msg; out.result = result.result != null && "1".equals(result.result.getValue()); return out; } /** * 获取用户设置 * @param userId 用户ID * @param scope 设置范围 * @param key 设置键 * @return 用户设置信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserSetting(String userId, int scope, String key) throws Exception { String path = APIPath.User_Get_Setting; UserSettingPojo pojo = new UserSettingPojo(); pojo.setUserId(userId); pojo.setScope(scope); pojo.setKey(key); return AdminHttpUtils.httpJsonPost(path, pojo, UserSettingPojo.class); } /** * 设置用户设置 * @param userId 用户ID * @param scope 设置范围 * @param key 设置键 * @param value 设置值 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setUserSetting(String userId, int scope, String key, String value) throws Exception { String path = APIPath.User_Put_Setting; UserSettingPojo pojo = new UserSettingPojo(); pojo.setUserId(userId); pojo.setScope(scope); pojo.setKey(key); pojo.setValue(value); return AdminHttpUtils.httpJsonPost(path, pojo, Void.class); } /** * 健康检查 * @return 健康检查结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult healthCheck() throws Exception { return AdminHttpUtils.httpGet(APIPath.Health, HealthCheckResult.class); } /** * 获取客户信息 * @return 客户信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getCustomer() throws Exception { return AdminHttpUtils.httpJsonPost(APIPath.GET_CUSTOMER, null, String.class); } public static IMResult getPresignedUploadUrl(String fileName, int/*ProtoConstants.MessageMediaType*/ mediaType, String contentType) throws Exception { String path = APIPath.Get_Presigned_Upload_Url; InputGetPresignedUploadUrl requestPojo = new InputGetPresignedUploadUrl(); requestPojo.fileName = fileName; requestPojo.mediaType = mediaType; requestPojo.contentType = contentType; return AdminHttpUtils.httpJsonPost(path, requestPojo, OutputPresignedUploadUrl.class); } /** * 根据文件名获取Content-Type * * @param fileName 文件名 * @return Content-Type,如果无法识别则返回 "application/octet-stream" */ private static String getContentTypeByFileName(String fileName) { if (fileName == null || fileName.isEmpty()) { return "application/octet-stream"; } // 首先尝试使用 URLConnection 猜测 String contentType = URLConnection.guessContentTypeFromName(fileName); // 如果无法识别,使用常见扩展名映射 if (contentType == null) { String lowerName = fileName.toLowerCase(); if (lowerName.endsWith(".jpg") || lowerName.endsWith(".jpeg")) { contentType = "image/jpeg"; } else if (lowerName.endsWith(".png")) { contentType = "image/png"; } else if (lowerName.endsWith(".gif")) { contentType = "image/gif"; } else if (lowerName.endsWith(".bmp")) { contentType = "image/bmp"; } else if (lowerName.endsWith(".webp")) { contentType = "image/webp"; } else if (lowerName.endsWith(".mp4")) { contentType = "video/mp4"; } else if (lowerName.endsWith(".mov")) { contentType = "video/quicktime"; } else if (lowerName.endsWith(".avi")) { contentType = "video/x-msvideo"; } else if (lowerName.endsWith(".mp3")) { contentType = "audio/mpeg"; } else if (lowerName.endsWith(".wav")) { contentType = "audio/wav"; } else if (lowerName.endsWith(".pdf")) { contentType = "application/pdf"; } else if (lowerName.endsWith(".doc")) { contentType = "application/msword"; } else if (lowerName.endsWith(".docx")) { contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; } else if (lowerName.endsWith(".xls")) { contentType = "application/vnd.ms-excel"; } else if (lowerName.endsWith(".xlsx")) { contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; } else if (lowerName.endsWith(".ppt")) { contentType = "application/vnd.ms-powerpoint"; } else if (lowerName.endsWith(".pptx")) { contentType = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; } else if (lowerName.endsWith(".txt")) { contentType = "text/plain"; } else if (lowerName.endsWith(".html") || lowerName.endsWith(".htm")) { contentType = "text/html"; } else if (lowerName.endsWith(".json")) { contentType = "application/json"; } else if (lowerName.endsWith(".xml")) { contentType = "application/xml"; } else if (lowerName.endsWith(".zip")) { contentType = "application/zip"; } else if (lowerName.endsWith(".rar")) { contentType = "application/x-rar-compressed"; } else if (lowerName.endsWith(".7z")) { contentType = "application/x-7z-compressed"; } else if (lowerName.endsWith(".tar")) { contentType = "application/x-tar"; } else if (lowerName.endsWith(".gz")) { contentType = "application/gzip"; } else { contentType = "application/octet-stream"; } } return contentType; } /** * 上传文件 *

* 流程:先调用getPresignedUploadUrl获取预签名上传地址,然后直接上传文件。 * 上传成功后返回文件的下载地址等信息。 *

* * @param file 要上传的文件 * @return 上传结果,包含下载地址 * @throws Exception 上传失败时抛出异常 */ public static IMResult uploadFile(File file) throws Exception { return uploadFile(file, ProtoConstants.MessageMediaType.FILE, null); } /** * 上传文件 *

* 流程:先调用getPresignedUploadUrl获取预签名上传地址,然后直接上传文件。 * 上传成功后返回文件的下载地址等信息。 *

* * @param file 要上传的文件 * @param mediaType 媒体类型,参考{@link cn.wildfirechat.proto.ProtoConstants.MessageMediaType} * @param contentType 文件Content-Type,例如 "image/jpeg", "application/octet-stream" 等; * 如果为null或空,则根据文件名自动识别 * @return 上传结果,包含下载地址 * @throws Exception 上传失败时抛出异常 */ public static IMResult uploadFile(File file, int mediaType, String contentType) throws Exception { if (file == null || !file.exists()) { throw new IllegalArgumentException("文件不能为空或不存在"); } // 如果未指定Content-Type,根据文件名自动获取 if (contentType == null || contentType.isEmpty()) { contentType = getContentTypeByFileName(file.getName()); } return doUploadFile(file.getName(), mediaType, contentType, file, null); } /** * 执行文件上传的公共方法 *

* 根据服务器类型选择不同的上传方式: *

    *
  • type = 1(七牛云):使用 POST + multipart/form-data 表单上传
  • *
  • type = 其他(阿里云、Minio等):使用 PUT + 二进制流上传
  • *
*

* * @param fileName 文件名 * @param mediaType 媒体类型 * @param contentType Content-Type * @param file 文件对象(用于七牛云上传) * @param inputStream 输入流(用于其他类型上传,可为null) * @return 上传结果 * @throws Exception 上传失败时抛出异常 */ private static IMResult doUploadFile(String fileName, int mediaType, String contentType, File file, InputStream inputStream) throws Exception { // 1. 获取预签名上传地址 IMResult presignedResult = getPresignedUploadUrl( fileName, mediaType, contentType); if (presignedResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { IMResult imResult = new IMResult<>(); imResult.setCode(presignedResult.code); imResult.setMsg(presignedResult.msg); return imResult; } OutputPresignedUploadUrl presignedUrl = presignedResult.getResult(); if (presignedUrl == null || presignedUrl.uploadUrl == null) { throw new Exception("预签名上传地址为空"); } // 2. 根据服务器类型选择上传方式 if (presignedUrl.type == 1) { // 七牛云:使用 POST + multipart/form-data 表单上传 return uploadToQiniu(presignedUrl, file, inputStream, fileName, contentType); } else { // 其他(阿里云、Minio、腾讯云、华为云、AWS S3等):使用 PUT 上传 return uploadToOther(presignedUrl, file, inputStream, contentType); } } /** * 上传到七牛云(type = 1) * 使用 POST + multipart/form-data 表单格式 */ private static IMResult uploadToQiniu(OutputPresignedUploadUrl presignedUrl, File file, InputStream inputStream, String fileName, String contentType) throws Exception { // 解析七牛云上传地址:格式为 "https://host?token?key" String uploadUrl = presignedUrl.uploadUrl; String token; String key; int tokenStart = uploadUrl.indexOf('?'); int keyStart = uploadUrl.indexOf('?', tokenStart + 1); if (tokenStart == -1 || keyStart == -1) { throw new Exception("七牛云上传地址格式错误"); } String baseUrl = uploadUrl.substring(0, tokenStart); token = uploadUrl.substring(tokenStart + 1, keyStart); key = uploadUrl.substring(keyStart + 1); HttpPost httpPost = new HttpPost(baseUrl); try { MultipartEntityBuilder builder = MultipartEntityBuilder.create(); // 添加 token 和 key 字段 builder.addTextBody("token", token); builder.addTextBody("key", key); // 添加文件字段 if (file != null) { builder.addPart("file", new FileBody(file, ContentType.create(contentType), fileName)); } else if (inputStream != null) { builder.addPart("file", new InputStreamBody(inputStream, ContentType.create(contentType), fileName)); } httpPost.setEntity(builder.build()); HttpResponse response = AdminHttpUtils.getHttpClient().execute(httpPost); int statusCode = response.getStatusLine().getStatusCode(); // 消耗响应体 if (response.getEntity() != null) { EntityUtils.consumeQuietly(response.getEntity()); } // 七牛云返回 200 表示成功 if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_CREATED) { throw new Exception("文件上传到七牛云失败,HTTP状态码:" + statusCode); } IMResult imResult = new IMResult<>(); imResult.setCode(0); imResult.setResult(presignedUrl.downloadUrl); return imResult; } finally { httpPost.releaseConnection(); } } /** * 上传到其他对象存储(type != 1) * 使用 PUT + 二进制流 */ private static IMResult uploadToOther(OutputPresignedUploadUrl presignedUrl, File file, InputStream inputStream, String contentType) throws Exception { HttpPut httpPut = new HttpPut(presignedUrl.uploadUrl); try { // 设置请求实体 if (file != null) { FileEntity fileEntity = new FileEntity(file); fileEntity.setContentType(contentType); httpPut.setEntity(fileEntity); } else if (inputStream != null) { InputStreamEntity streamEntity = new InputStreamEntity(inputStream); streamEntity.setContentType(contentType); httpPut.setEntity(streamEntity); } HttpResponse response = AdminHttpUtils.getHttpClient().execute(httpPut); int statusCode = response.getStatusLine().getStatusCode(); // 消耗响应体,确保连接可以被复用 if (response.getEntity() != null) { EntityUtils.consumeQuietly(response.getEntity()); } if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_CREATED) { throw new Exception("文件上传失败,HTTP状态码:" + statusCode); } IMResult imResult = new IMResult<>(); imResult.setCode(0); imResult.setResult(presignedUrl.downloadUrl); return imResult; } finally { httpPut.releaseConnection(); } } /** * 上传文件(通过输入流) *

* 流程:先调用getPresignedUploadUrl获取预签名上传地址,然后直接上传文件。 * 上传成功后返回文件的下载地址等信息。 *

* * @param inputStream 文件输入流 * @param fileName 文件名 * @return 上传结果,包含下载地址 * @throws Exception 上传失败时抛出异常 */ public static IMResult uploadFile(InputStream inputStream, String fileName) throws Exception { return uploadFile(inputStream, fileName, ProtoConstants.MessageMediaType.FILE, null); } /** * 上传文件(通过输入流) *

* 流程:先调用getPresignedUploadUrl获取预签名上传地址,然后直接上传文件。 * 上传成功后返回文件的下载地址等信息。 *

*

* 注意:无论上传成功还是失败,此方法都会关闭输入流。 *

* * @param inputStream 文件输入流(此方法会关闭该流) * @param fileName 文件名 * @param mediaType 媒体类型,参考{@link cn.wildfirechat.proto.ProtoConstants.MessageMediaType} * @param contentType 文件Content-Type,例如 "image/jpeg", "application/octet-stream" 等; * 如果为null或空,则根据文件名自动识别 * @return 上传结果,包含下载地址 * @throws Exception 上传失败时抛出异常 */ public static IMResult uploadFile(InputStream inputStream, String fileName, int mediaType, String contentType) throws Exception { if (inputStream == null) { throw new IllegalArgumentException("输入流不能为空"); } // 如果未指定Content-Type,根据文件名自动获取 if (contentType == null || contentType.isEmpty()) { contentType = getContentTypeByFileName(fileName); } return doUploadFile(fileName, mediaType, contentType, null, inputStream); // 注意:正常流程下的流关闭在 uploadToQiniu 或 uploadToOther 的 finally 块中处理 } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/GenerateTestData.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.*; import cn.wildfirechat.sdk.model.IMResult; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.util.*; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentSkipListSet; import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicInteger; /** * 生成测试数据。本应用生成以下数据: * 1. 创建${totalUserCount}个用户 * 2. 每个用户同其他${friendCount}个用户建立好友关系 * 3. 确保每个人都加入${smallGroupCount}个群组成员数为${smallGroupMemberSize}的小群组 * 4. 确保每个人都加入${middleGroupCount}个群组成员数为${middleGroupMemberSize}的中群组 * 5. 确保每个人都加入${bigGroupCount}个群组成员数为${bigGroupMemberSize}的大群组 * 6. 把数据分片${splitFileCount}个保存在文件中 * * 好友关系和群组关系都是随机生成,有可能会出现最后几个用户无法满足精确好友数或者群组数的问题,但绝大部分数据都能满足需求。 */ public class GenerateTestData { //IM服务Server API private static String AdminUrl = "http://10.206.0.5:18080"; private static String AdminSecret = "123456"; private static int totalUserCount = 20000; //每个用户的好友数 private static int friendCount = 100; //每个用户拥有的小群数,和小群的大小。 private static int smallGroupCount = 100; private static int smallGroupMemberSize = 20; //每个用户拥有的中群数,和中群的大小。 private static int middleGroupCount = 100; private static int middleGroupMemberSize = 100; //每个用户拥有的大群数,和大群的大小。 private static int bigGroupCount = 20; private static int bigGroupMemberSize = 1000; //数据文件分割成几个文件存储。 private static int splitFileCount = 1; //统计添加好友数和创建群组数。 private static AtomicInteger addFriendCount = new AtomicInteger(0); private static AtomicInteger createGroupCount = new AtomicInteger(0); public static void main(String[] args) throws Exception { AdminConfig.initAdmin(AdminUrl, AdminSecret); int addFriendRequestCount = friendCount*totalUserCount/2; int createSmallGroupCount = smallGroupCount * totalUserCount / smallGroupMemberSize; int createMiddleGroupCount = middleGroupCount * totalUserCount / middleGroupMemberSize; int createBigGroupCount = bigGroupCount * totalUserCount / bigGroupMemberSize; System.out.println("根据当前的参数,将创建 " + totalUserCount + " 名用户"); System.out.println("添加大概 " + addFriendRequestCount + " 次好友请求"); System.out.println("创建大概 " + createSmallGroupCount + " 个小型群组"); System.out.println("创建大概 " + createMiddleGroupCount + " 个中等群组"); System.out.println("创建大概 " + createBigGroupCount + " 个大型群组"); System.out.println("等待10秒开始"); Thread.sleep(10*1000); List userIds = generateUserIds(totalUserCount); CountDownLatch latch = new CountDownLatch(5); new Thread(() -> { createUsers(userIds); latch.countDown(); }).start(); Map unfulfilledFriendMap = new HashMap<>(); new Thread(() -> { addFriends(userIds, friendCount, unfulfilledFriendMap); latch.countDown(); }).start(); Map> userSmallGroupMap = new HashMap<>(); Map unfulfilledSmallMap = new HashMap<>(); new Thread(() ->{ for (String userId : userIds) { createGroup(userId, userIds, userSmallGroupMap, smallGroupCount, smallGroupMemberSize, unfulfilledSmallMap); } latch.countDown(); }).start(); Map> userMiddleGroupMap = new HashMap<>(); Map unfulfilledMiddleMap = new HashMap<>(); new Thread(() ->{ for (String userId : userIds) { createGroup(userId, userIds, userMiddleGroupMap, middleGroupCount, middleGroupMemberSize, unfulfilledMiddleMap); } latch.countDown(); }).start(); Map> userBigGroupMap = new HashMap<>(); Map unfulfilledBigMap = new HashMap<>(); new Thread(() ->{ for (String userId : userIds) { createGroup(userId, userIds, userBigGroupMap, bigGroupCount, bigGroupMemberSize, unfulfilledBigMap); } latch.countDown(); }).start(); latch.await(); System.out.println("数据初始化结束,实际建立好友关系: " + addFriendCount.get() + " 条。"); if (!unfulfilledFriendMap.isEmpty()) { System.out.println("有部分用户没有建立" + friendCount + "个好友关系,分别是:"); printUnfulfilledMap(unfulfilledFriendMap); } System.out.println("数据初始化结束,创建群组: " + createGroupCount.get() + " 个。"); if (!unfulfilledSmallMap.isEmpty()) { System.out.println("有部分用户没有建立" + smallGroupMemberSize + "个群组成员的群,分别是:"); printUnfulfilledMap(unfulfilledSmallMap); } if (!unfulfilledMiddleMap.isEmpty()) { System.out.println("有部分用户没有建立" + middleGroupMemberSize + "个群组成员的群,分别是:"); printUnfulfilledMap(unfulfilledMiddleMap); } if (!unfulfilledBigMap.isEmpty()) { System.out.println("有部分用户没有建立" + bigGroupMemberSize + "个群组成员的群,分别是:"); printUnfulfilledMap(unfulfilledBigMap); } System.out.println("保存数据到" + splitFileCount + "个文件中。"); for (int i = 0; i < splitFileCount; i++) { String filePath = "data"+i+".csv"; // 文件路径 BufferedWriter writer = new BufferedWriter(new FileWriter(filePath)); int partSize = totalUserCount/splitFileCount; for (int j = 0; j < partSize; j++) { String userId = userIds.get(i*partSize+j); writeDeviceInfo(writer, userId, 3); Set smallGroupIds = userSmallGroupMap.get(userId); writeGroupIds(writer, smallGroupIds); Set middleGroupIds = userMiddleGroupMap.get(userId); writeGroupIds(writer, middleGroupIds); Set bigGroupIds = userBigGroupMap.get(userId); writeGroupIds(writer, bigGroupIds); } writer.close(); } System.out.println("保存结束。"); } private static void printUnfulfilledMap(Map map) { if(map.isEmpty()) return; map.forEach((s, integer) -> System.out.print(s + ":" + integer + " ")); System.out.println(); } private static void writeDeviceInfo(BufferedWriter writer, String userId, int platform) throws IOException { writer.write(userId); writer.write(","); writer.write(UUID.randomUUID().toString()); writer.write(","); writer.write(""+platform); writer.write("\n"); } private static void writeGroupIds(BufferedWriter writer, Set groupIds) throws IOException { int writeCount = 0; for (String bigGroupId : groupIds) { writer.write(bigGroupId); writeCount++; if(writeCount < groupIds.size()) { writer.write(","); } else { writer.write("\n"); } } } private static void createGroup(String userId, List userIds, Map> userGroupMap, int groupCount, int memberSize, Map unfulfilledUserMap) { Set groupIds = userGroupMap.computeIfAbsent(userId, s -> new HashSet<>()); int i = 0; while (groupIds.size() < groupCount){ PojoGroupInfo groupInfo = new PojoGroupInfo(); groupInfo.setTarget_id(UUID.randomUUID().toString()); groupInfo.setOwner(userId); groupInfo.setName("Group_"+userId+i++); groupInfo.setType(2); groupIds.add(groupInfo.getTarget_id()); List memberCandidates = new ArrayList<>(userIds); List memberIds = new ArrayList<>(); memberIds.add(userId); while (!memberCandidates.isEmpty() && memberIds.size() < memberSize) { String memberId = memberCandidates.get((int)(Math.random()*memberCandidates.size())); memberCandidates.remove(memberId); if(memberId.equals(userId)) { continue; } if (memberIds.contains(memberId)) { continue; } Set memberGroupIds = userGroupMap.computeIfAbsent(memberId, s -> new HashSet<>()); if(memberGroupIds.contains(groupInfo.getTarget_id()) || memberGroupIds.size() >= groupCount) { continue; } memberGroupIds.add(groupInfo.getTarget_id()); memberIds.add(memberId); } List members = new ArrayList<>(); for (String memberId : memberIds) { PojoGroupMember member1 = new PojoGroupMember(); member1.setMember_id(memberId); members.add(member1); } try { IMResult resultCreateGroup = GroupAdmin.createGroup(groupInfo.getOwner(), groupInfo, members, null, null, null); if (resultCreateGroup != null && resultCreateGroup.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("create group success"); } else { System.out.println("create group failure"); System.exit(-1); } } catch (Exception e) { System.out.println("create group failure:" + e); System.exit(-1); } createGroupCount.incrementAndGet(); if(memberIds.size() < memberSize) { unfulfilledUserMap.put(userId + "'s group " + groupInfo.getTarget_id(), memberIds.size()); System.out.println("Error, can not find enough user to create group for user:" + userId); } } } private static void addFriends(List userIds, int count, Map unfulfilledFriendMap) { ConcurrentLinkedQueue> toAddSet = new ConcurrentLinkedQueue<>(); Map> userFriends = new HashMap<>(); for (String userId : userIds) { List candidates = new ArrayList<>(userIds); Set currentUserFriends = userFriends.computeIfAbsent(userId, s -> new HashSet<>()); while (!candidates.isEmpty() && currentUserFriends.size() < count) { String friendId = candidates.get((int) (Math.random()*candidates.size())); candidates.remove(friendId); if(friendId.equals(userId)) { continue; } if(!currentUserFriends.contains(friendId)) { Set targetUserFriends = userFriends.computeIfAbsent(friendId, s -> new HashSet<>()); if(targetUserFriends.size() < count) { currentUserFriends.add(friendId); targetUserFriends.add(userId); toAddSet.add(new Pair<>(userId, friendId)); } } } if (currentUserFriends.size() < count) { unfulfilledFriendMap.put(userId, currentUserFriends.size()); System.out.println("Error, can not find enough user to add friend for user:" + userId); } } int threadNum = 5; CountDownLatch latch = new CountDownLatch(threadNum); for (int i = 0; i < threadNum; i++) { new Thread(() -> { while (true) { Pair pair = toAddSet.poll(); if(pair == null) { latch.countDown(); break; } try { IMResult result = RelationAdmin.setUserFriend(pair.first, pair.second, true, null); if (result != null && (result.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS || result.getErrorCode() == ErrorCode.ERROR_CODE_ALREADY_FRIENDS)) { System.out.println("add friend success"); addFriendCount.incrementAndGet(); } else { System.out.println("failure"); System.exit(-1); } } catch (Exception e) { System.out.println("failure:" + e); System.exit(-1); } } }).start(); } try { latch.await(); } catch (InterruptedException e) { System.out.println("failure:" + e); System.exit(-1); } } private static String generateUserId(int index) { return UUID.randomUUID().toString().replace("-", ""); } private static List generateUserIds(int count) { List userIds = new ArrayList<>(); for (int i = 0; i < count; i++) { userIds.add(generateUserId(i)); } return userIds; } private static void createUsers(List userIds) { for (int i = 0; i < userIds.size(); i++) { InputOutputUserInfo userInfo = generateUserInfo(userIds.get(i), i); try { IMResult resultCreateUser = UserAdmin.createUser(userInfo); if (resultCreateUser != null && resultCreateUser.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Create user " + resultCreateUser.getResult().getName() + " success"); } else { System.out.println("Create user failure"); System.exit(-1); } } catch (Exception e) { System.out.println("Create user failure"); System.exit(-1); } } } private static InputOutputUserInfo generateUserInfo(String userId, int index) { InputOutputUserInfo userInfo = new InputOutputUserInfo(); //用户ID,必须保证唯一性 userInfo.setUserId(userId); //用户名,一般是用户登录帐号,也必须保证唯一性。也就是说所有用户的userId必须不能重复,所有用户的name必须不能重复,但可以同一个用户的userId和name是同一个,一般建议userId使用一个uuid,name是"微信号"且可以修改, userInfo.setName(userId); userInfo.setMobile((11000000000L+index) + ""); userInfo.setDisplayName("User"+index); return userInfo; } static class Pair { K first; V second; public Pair() { } public Pair(K first, V second) { this.first = first; this.second = second; } } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/GroupAdmin.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.*; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; import java.util.List; /** * 群组管理类 *

* 提供群组管理相关的功能,包括: *

    *
  • 群组的创建、解散、转移
  • *
  • 群组信息修改
  • *
  • 群组成员管理(添加、移除、踢出)
  • *
  • 群组管理员设置
  • *
  • 群组成员禁言
  • *
  • 用户群组查询
  • *
*

*/ public class GroupAdmin { /** * 创建群组 * @param operator 操作者用户ID * @param group_info 群组信息 * @param members 群组成员列表 * @param member_extra 成员额外信息 * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 创建结果,包含群组ID * @throws Exception 请求失败时抛出异常 */ public static IMResult createGroup(String operator, PojoGroupInfo group_info, List members, String member_extra, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Create_Group; PojoGroup pojoGroup = new PojoGroup(); pojoGroup.setGroup_info(group_info); pojoGroup.setMembers(members); InputCreateGroup createGroup = new InputCreateGroup(); createGroup.setGroup(pojoGroup); createGroup.setOperator(operator); createGroup.setMember_extra(member_extra); createGroup.setTo_lines(to_lines); createGroup.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, createGroup, OutputCreateGroupResult.class); } /** * 获取群组信息 * @param groupId 群组ID * @return 群组信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getGroupInfo(String groupId) throws Exception { String path = APIPath.Group_Get_Info; InputGetGroup input = new InputGetGroup(); input.setGroupId(groupId); return AdminHttpUtils.httpJsonPost(path, input, PojoGroupInfo.class); } /** * 批量获取群组信息 * @param groupIds 群组ID列表 * @return 群组信息列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult batchGroupInfos(List groupIds) throws Exception { String path = APIPath.Group_Batch_Info; return AdminHttpUtils.httpJsonPost(path, groupIds, PojoGroupInfoList.class); } /** * 解散群组 * @param operator 操作者用户ID * @param groupId 群组ID * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 解散结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult dismissGroup(String operator, String groupId, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Dismiss; InputDismissGroup dismissGroup = new InputDismissGroup(); dismissGroup.setOperator(operator); dismissGroup.setGroup_id(groupId); dismissGroup.setTo_lines(to_lines); dismissGroup.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, dismissGroup, Void.class); } /** * 转让群组 * @param operator 操作者用户ID * @param groupId 群组ID * @param newOwner 新群主用户ID * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 转让结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult transferGroup(String operator, String groupId, String newOwner, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Transfer; InputTransferGroup transferGroup = new InputTransferGroup(); transferGroup.setGroup_id(groupId); transferGroup.setNew_owner(newOwner); transferGroup.setOperator(operator); transferGroup.setTo_lines(to_lines); transferGroup.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, transferGroup, Void.class); } /** * 修改群组信息 * @param operator 操作者用户ID * @param groupId 群组ID * @param type 修改信息类型(ModifyGroupInfoType) * @param value 新值 * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 修改结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult modifyGroupInfo(String operator, String groupId, /*ModifyGroupInfoType*/int type, String value, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Modify_Info; InputModifyGroupInfo modifyGroupInfo = new InputModifyGroupInfo(); modifyGroupInfo.setGroup_id(groupId); modifyGroupInfo.setOperator(operator); modifyGroupInfo.setTo_lines(to_lines); modifyGroupInfo.setType(type); modifyGroupInfo.setValue(value); modifyGroupInfo.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, modifyGroupInfo, Void.class); } /** * 获取群组成员列表 * @param groupId 群组ID * @return 群组成员列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getGroupMembers(String groupId) throws Exception { String path = APIPath.Group_Member_List; InputGetGroup input = new InputGetGroup(); input.setGroupId(groupId); return AdminHttpUtils.httpJsonPost(path, input, OutputGroupMemberList.class); } /** * 获取群组成员信息 * @param groupId 群组ID * @param memberId 成员用户ID * @return 群组成员信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getGroupMember(String groupId, String memberId) throws Exception { String path = APIPath.Group_Member_Get; InputGetGroupMember input = new InputGetGroupMember(); input.setGroupId(groupId); input.setMemberId(memberId); return AdminHttpUtils.httpJsonPost(path, input, PojoGroupMember.class); } /** * 添加群组成员 * @param operator 操作者用户ID * @param groupId 群组ID * @param groupMembers 要添加的成员列表 * @param member_extra 成员额外信息 * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 添加结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult addGroupMembers(String operator, String groupId, List groupMembers, String member_extra, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Member_Add; InputAddGroupMember addGroupMember = new InputAddGroupMember(); addGroupMember.setGroup_id(groupId); addGroupMember.setMembers(groupMembers); addGroupMember.setOperator(operator); addGroupMember.setMemberExtra(member_extra); addGroupMember.setTo_lines(to_lines); addGroupMember.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, addGroupMember, Void.class); } /** * 设置或取消群组管理员 * @param operator 操作者用户ID * @param groupId 群组ID * @param groupMemberIds 成员用户ID列表 * @param isManager true-设置为管理员,false-取消管理员 * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setGroupManager(String operator, String groupId, List groupMemberIds, boolean isManager, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Set_Manager; InputSetGroupManager addGroupMember = new InputSetGroupManager(); addGroupMember.setGroup_id(groupId); addGroupMember.setMembers(groupMemberIds); addGroupMember.setIs_manager(isManager); addGroupMember.setOperator(operator); addGroupMember.setTo_lines(to_lines); addGroupMember.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, addGroupMember, Void.class); } /** * 禁言或解禁群组成员 * @param operator 操作者用户ID * @param groupId 群组ID * @param groupMemberIds 成员用户ID列表 * @param isMute true-禁言,false-解禁 * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 禁言结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult muteGroupMemeber(String operator, String groupId, List groupMemberIds, boolean isMute, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Mute_Member; InputMuteGroupMember addGroupMember = new InputMuteGroupMember(); addGroupMember.setGroup_id(groupId); addGroupMember.setMembers(groupMemberIds); addGroupMember.setIs_manager(isMute); addGroupMember.setOperator(operator); addGroupMember.setTo_lines(to_lines); addGroupMember.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, addGroupMember, Void.class); } /** * 允许或禁止群组成员发言 * @param operator 操作者用户ID * @param groupId 群组ID * @param groupMemberIds 成员用户ID列表 * @param isAllow true-允许,false-禁止 * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult allowGroupMemeber(String operator, String groupId, List groupMemberIds, boolean isAllow, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Allow_Member; InputMuteGroupMember addGroupMember = new InputMuteGroupMember(); addGroupMember.setGroup_id(groupId); addGroupMember.setMembers(groupMemberIds); addGroupMember.setIs_manager(isAllow); addGroupMember.setOperator(operator); addGroupMember.setTo_lines(to_lines); addGroupMember.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, addGroupMember, Void.class); } /** * 踢出群组成员 * @param operator 操作者用户ID * @param groupId 群组ID * @param groupMemberIds 要踢出的成员用户ID列表 * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 踢出结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult kickoffGroupMembers(String operator, String groupId, List groupMemberIds, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Member_Kickoff; InputKickoffGroupMember kickoffGroupMember = new InputKickoffGroupMember(); kickoffGroupMember.setGroup_id(groupId); kickoffGroupMember.setMembers(groupMemberIds); kickoffGroupMember.setOperator(operator); kickoffGroupMember.setTo_lines(to_lines); kickoffGroupMember.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, kickoffGroupMember, Void.class); } /** * 退出群组 * @param operator 操作者用户ID * @param groupId 群组ID * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 退出结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult quitGroup(String operator, String groupId, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Member_Quit; InputQuitGroup quitGroup = new InputQuitGroup(); quitGroup.setGroup_id(groupId); quitGroup.setOperator(operator); quitGroup.setTo_lines(to_lines); quitGroup.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, quitGroup, Void.class); } /** * 设置群组成员别名 * @param operator 操作者用户ID * @param groupId 群组ID * @param memberId 成员用户ID * @param alias 别名 * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setGroupMemberAlias(String operator, String groupId, String memberId, String alias, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Set_Member_Alias; InputSetGroupMemberAlias input = new InputSetGroupMemberAlias(); input.setGroup_id(groupId); input.setOperator(operator); input.setMemberId(memberId); input.setAlias(alias); input.setTo_lines(to_lines); input.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 设置群组成员额外信息 * @param operator 操作者用户ID * @param groupId 群组ID * @param memberId 成员用户ID * @param extra 额外信息 * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setGroupMemberExtra(String operator, String groupId, String memberId, String extra, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Set_Member_Extra; InputSetGroupMemberExtra input = new InputSetGroupMemberExtra(); input.setGroup_id(groupId); input.setOperator(operator); input.setMemberId(memberId); input.setExtra(extra); input.setTo_lines(to_lines); input.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 设置群组备注(用户个性化设置) * @param userId 用户ID * @param groupId 群组ID * @param remark 备注内容 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setGroupRemark(String userId, String groupId, String remark) throws Exception { return GeneralAdmin.setUserSetting(userId, 26, groupId, remark); } /** * 获取群组备注(用户个性化设置) * @param userId 用户ID * @param groupId 群组ID * @return 备注内容 * @throws Exception 请求失败时抛出异常 */ public static IMResult getGroupRemark(String userId, String groupId) throws Exception { IMResult imResult = GeneralAdmin.getUserSetting(userId, 26, groupId); IMResult result = new IMResult<>(); result.code = imResult.code;; result.msg = imResult.msg;; if(imResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { result.result = imResult.result.getValue(); } return result; } /** * 设置群组是否收藏(用户个性化设置) * @param userId 用户ID * @param groupId 群组ID * @param fav true-收藏,false-取消收藏 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setFavGroup(String userId, String groupId, boolean fav) throws Exception { return GeneralAdmin.setUserSetting(userId, 6, groupId, fav?"1":"0"); } /** * 检查群组是否收藏(用户个性化设置) * @param userId 用户ID * @param groupId 群组ID * @return true-已收藏,false-未收藏 * @throws Exception 请求失败时抛出异常 */ public static IMResult isFavGroup(String userId, String groupId) throws Exception { IMResult imResult = GeneralAdmin.getUserSetting(userId, 6, groupId); IMResult result = new IMResult<>(); result.code = imResult.code;; result.msg = imResult.msg;; if(imResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { result.result = "1".equals(imResult.getResult().getValue()); } return result; } /** * 获取用户的群组列表 * @param user 用户ID * @return 用户所属的群组ID列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserGroups(String user) throws Exception { String path = APIPath.Get_User_Groups; InputUserId inputUserId = new InputUserId(); inputUserId.setUserId(user); return AdminHttpUtils.httpJsonPost(path, inputUserId, OutputGroupIds.class); } /** * 根据成员类型获取用户的群组列表 * @param user 用户ID * @param groupMemberType 群组成员类型列表(GroupMemberType) * @return 用户所属的群组ID列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserGroupsByType(String user, List groupMemberType) throws Exception { String path = APIPath.Get_User_Groups_By_Type; InputGetUserGroupByType input = new InputGetUserGroupByType(user, groupMemberType); return AdminHttpUtils.httpJsonPost(path, input, OutputGroupIds.class); } /** * 获取两个用户的共同群组 * @param user1 用户1的ID * @param user2 用户2的ID * @return 共同群组ID列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getCommonGroups(String user1, String user2) throws Exception { String path = APIPath.Get_Common_Groups; StringPairPojo intput = new StringPairPojo(user1, user2); return AdminHttpUtils.httpJsonPost(path, intput, OutputGroupIds.class); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/Main.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.mesh.PojoDomainPingResponse; import cn.wildfirechat.pojos.mesh.PojoSearchUserRes; import cn.wildfirechat.pojos.mesh.PojoUserConferenceResponse; import cn.wildfirechat.pojos.moments.CommentPojo; import cn.wildfirechat.pojos.moments.FeedPojo; import cn.wildfirechat.pojos.moments.FeedsPojo; import cn.wildfirechat.pojos.moments.MomentProfilePojo; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.sdk.messagecontent.*; import cn.wildfirechat.pojos.*; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.sdk.model.IMResult; import com.google.gson.GsonBuilder; import io.netty.util.internal.StringUtil; import java.util.*; import static cn.wildfirechat.pojos.MyInfoType.Modify_DisplayName; import static cn.wildfirechat.proto.ProtoConstants.ChannelState.*; import static cn.wildfirechat.proto.ProtoConstants.SystemSettingType.Group_Max_Member_Count; /** * 野火IM Server SDK示例程序主类 *

* 提供SDK功能演示的示例代码,包括: *

    *
  • 用户管理操作
  • *
  • 群组管理操作
  • *
  • 消息发送操作
  • *
  • 好友关系管理
  • *
  • 朋友圈功能
  • *
  • 机器人功能
  • *
*

*/ public class Main { /** 是否为商业版服务器 */ private static boolean commercialServer = false; /** 是否启用高级音视频功能 */ private static boolean advanceVoip = false; /** 是否启用机器人朋友圈功能 */ private static boolean robotMomentsEnabled = false; /** 是否启用朋友圈功能 */ private static boolean momentsEnabled = false; /** 管理端口是18080 */ private static String AdminUrl = "http://localhost:18080"; /** 管理员密钥 */ private static String AdminSecret = "123456"; /** 机器人和频道使用IM服务的公开端口80,注意不是18080 */ private static String IMUrl = "http://localhost"; /** * 程序主入口 * @param args 命令行参数,包括:adminUrl、adminSecret、imUrl、commercialServer、advanceVoip * @throws Exception 当测试过程中发生错误时抛出异常 */ public static void main(String[] args) throws Exception { // 解析命令行参数 if (args.length == 5) { // 从命令行参数获取配置信息 AdminUrl = args[0]; AdminSecret = args[1]; IMUrl = args[2]; commercialServer = Boolean.parseBoolean(args[3]); advanceVoip = Boolean.parseBoolean(args[4]); } else { // 显示帮助信息或使用默认值 if(args.length == 1 && (args[0].equals("-h") || args[0].equals("--help") || args[0].equals("-help"))) { System.out.println("Usage: java -jar checker.jar adminUrl adminSecret imUrl commercialServer advanceVoip \n e.g. java -jar checker.jar http://192.168.1.80:18080 123456 http://192.168.1.80 false false"); return; } System.out.println("Usage: java -jar checker.jar adminUrl adminSecret imUrl commercialServer advanceVoip \n e.g. java -jar checker.jar http://192.168.1.80:18080 123456 http://192.168.1.80 false false"); System.out.println(); System.out.println(); System.out.println("Use default value: java -jar checker.jar http://127.0.0.1:18080 123456 http://127.0.0.1 false false"); } //admin使用的是18080端口,超级管理接口,理论上不能对外开放端口,也不能让非内部服务知悉密钥。 // 执行管理员API测试 testAdmin(); //测试解析数据库中消息内容 testReadMessageContentFromDB(); //计算消息分表 testMessageSharding(); //Robot和Channel都是使用的80端口,第三方可以创建或者为第三方创建,第三方可以使用robot或者channel与IM系统进行对接。 // 测试机器人功能 testRobot(); // 测试频道功能 testChannel(); //测试Mesh相关API,用于分布式IM。Mesh相关测试依赖环境,不具备测绘条件,注释掉。 //testMesh(); } /** * 管理员API测试总入口 *

* 测试所有管理员功能,包括: *

    *
  • 用户管理
  • *
  • 用户关系管理
  • *
  • 群组管理
  • *
  • 聊天室管理
  • *
  • 消息管理
  • *
  • 消息内容测试
  • *
  • 频道API测试
  • *
  • 通用API测试
  • *
  • 敏感词API测试
  • *
  • 设备管理测试(仅商业版)
  • *
  • 会议功能测试(仅高级音视频版)
  • *
  • 朋友圈功能测试(仅启用时)
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testAdmin() throws Exception { //初始化服务API,使用管理员URL和密钥 AdminConfig.initAdmin(AdminUrl, AdminSecret); // 执行各类管理员API测试 testUser(); // 用户管理测试 testUserRelation(); // 用户关系测试 testGroup(); // 群组管理测试 testChatroom(); // 聊天室测试 testMessage(); // 消息发送测试 testMessageContent(); // 消息内容编码测试 testChannelApi(); // 频道API测试 testGeneralApi(); // 通用API测试 testSensitiveApi(); // 敏感词API测试 // 商业版功能测试 if (commercialServer) { testDevice(); // 设备测试(仅商业版) } // 高级音视频功能测试 if(advanceVoip) { testConference(); // 会议功能测试(仅高级音视频版) } // 朋友圈功能测试 if (momentsEnabled) { testMomentsApi(); // 朋友圈API测试 } System.out.println("Congratulation, all admin test case passed!!!!!!!"); } //*********************************************** //**** 用户相关的API //*********************************************** /** * 用户管理API测试 *

* 测试以下功能: *

    *
  • 创建普通用户
  • *
  • 创建和删除机器人
  • *
  • 获取用户信息(按用户名、手机号、用户ID、邮箱)
  • *
  • 批量获取用户信息
  • *
  • 更新用户信息
  • *
  • 获取用户IM Token
  • *
  • 用户封禁/解封
  • *
  • 检查用户在线状态
  • *
  • 销毁用户(慎用)
  • *
  • 获取所有用户列表
  • *
  • 获取在线用户数量和列表(仅商业版)
  • *
  • 获取用户会话信息(仅商业版)
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testUser() throws Exception { // 创建用户信息对象 InputOutputUserInfo userInfo = new InputOutputUserInfo(); //用户ID,必须保证唯一性 userInfo.setUserId("userId1"); //用户名,一般是用户登录帐号,也必须保证唯一性。也就是说所有用户的userId必须不能重复,所有用户的name必须不能重复,但可以同一个用户的userId和name是同一个,一般建议userId使用一个uuid,name是"微信号"且可以修改, userInfo.setName("user1"); userInfo.setMobile("13900000000"); userInfo.setDisplayName("user 1"); // 调用SDK创建用户 IMResult resultCreateUser = UserAdmin.createUser(userInfo); if (resultCreateUser != null && resultCreateUser.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Create user " + resultCreateUser.getResult().getName() + " success"); } else { System.out.println("Create user failure"); System.exit(-1); } // 创建机器人信息对象 InputCreateRobot createRobot = new InputCreateRobot(); createRobot.setUserId("robot1"); createRobot.setName("robot1"); createRobot.setDisplayName("机器人"); createRobot.setOwner("userId1"); createRobot.setSecret("123456"); createRobot.setCallback("http://127.0.0.1:8883/robot/recvmsg"); // 调用SDK创建机器人 IMResult resultCreateRobot = UserAdmin.createRobot(createRobot); if (resultCreateRobot != null && resultCreateRobot.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Create robot " + resultCreateRobot.getResult().getUserId() + " success"); } else { System.out.println("Create robot failure"); System.exit(-1); } // 获取机器人信息 IMResult outputRobotIMResult = UserAdmin.getRobotInfo("robot1"); if(outputRobotIMResult != null && outputRobotIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Get robot success"); } else { System.out.println("Get robot failure"); System.exit(-1); } // 销毁机器人 IMResult destroyResult = UserAdmin.destroyRobot("robot1"); if(destroyResult != null && destroyResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("success"); } else { System.out.println("destroy user failure"); System.exit(-1); } // 通过用户名获取用户信息 IMResult resultGetUserInfo1 = UserAdmin.getUserByName(userInfo.getName()); if (resultGetUserInfo1 != null && resultGetUserInfo1.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { if (userInfo.getUserId().equals(resultGetUserInfo1.getResult().getUserId()) && userInfo.getName().equals(resultGetUserInfo1.getResult().getName()) && userInfo.getMobile().equals(resultGetUserInfo1.getResult().getMobile()) && userInfo.getDisplayName().equals(resultGetUserInfo1.getResult().getDisplayName())) { System.out.println("get user info success"); } else { System.out.println("get user info by name failure"); System.exit(-1); } } else { System.out.println("get user info by name failure"); System.exit(-1); } // 通过手机号获取用户信息 IMResult resultGetUserInfo2 = UserAdmin.getUserByMobile(userInfo.getMobile()); if (resultGetUserInfo2 != null && resultGetUserInfo2.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { if (userInfo.getUserId().equals(resultGetUserInfo2.getResult().getUserId()) && userInfo.getName().equals(resultGetUserInfo2.getResult().getName()) && userInfo.getMobile().equals(resultGetUserInfo2.getResult().getMobile()) && userInfo.getDisplayName().equals(resultGetUserInfo2.getResult().getDisplayName())) { System.out.println("get user info success"); } else { System.out.println("get user info by mobile failure"); System.exit(-1); } } else { System.out.println("get user info by mobile failure"); System.exit(-1); } // 通过用户ID获取用户信息 IMResult resultGetUserInfo3 = UserAdmin.getUserByUserId(userInfo.getUserId()); if (resultGetUserInfo3 != null && resultGetUserInfo3.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { if (userInfo.getUserId().equals(resultGetUserInfo3.getResult().getUserId()) && userInfo.getName().equals(resultGetUserInfo3.getResult().getName()) && userInfo.getMobile().equals(resultGetUserInfo3.getResult().getMobile()) && userInfo.getDisplayName().equals(resultGetUserInfo3.getResult().getDisplayName())) { System.out.println("get user info success"); } else { System.out.println("get user info by userId failure"); System.exit(-1); } } else { System.out.println("get user info by userId failure"); System.exit(-1); } // 通过邮箱获取用户信息(允许用户不存在) IMResult userInfoListIMResult = UserAdmin.getUserByEmail("13900000001@139.com"); if(userInfoListIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS || userInfoListIMResult.getErrorCode() == ErrorCode.ERROR_CODE_NOT_EXIST) { System.out.println("getUserByEmail success"); } else { System.out.println("getUserByEmail failure"); System.exit(-1); } // 批量获取用户信息 IMResult batchGetUsers = UserAdmin.getBatchUsers(Arrays.asList("userId1", "admin", "FireRobot", "TestUser")); if (batchGetUsers.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get batch user success"); } else { System.out.println("get batch user failure"); System.exit(-1); } // 准备更新用户信息(先测试不存在的用户ID) InputOutputUserInfo updateUserInfo = new InputOutputUserInfo(); updateUserInfo.setUserId(System.currentTimeMillis()+""); updateUserInfo.setDisplayName("updatedUserName"); updateUserInfo.setPortrait("updatedUserPortrait"); // 设置更新标志:更新显示名称和头像 int updateUserFlag = ProtoConstants.UpdateUserInfoMask.Update_User_DisplayName | ProtoConstants.UpdateUserInfoMask.Update_User_Portrait; IMResult result = UserAdmin.updateUserInfo(updateUserInfo, updateUserFlag); if(result != null && result.getErrorCode() == ErrorCode.ERROR_CODE_NOT_EXIST) { System.out.println("updateUserInfo success"); } else { System.out.println("updateUserInfo failure"); System.exit(-1); } // 更新存在的用户信息 updateUserInfo.setUserId(userInfo.getUserId()); result = UserAdmin.updateUserInfo(updateUserInfo, updateUserFlag); if(result != null && result.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("updateUserInfo success"); } else { System.out.println("updateUserInfo failure"); System.exit(-1); } // 验证用户信息是否更新成功 IMResult resultGetUserInfo4 = UserAdmin.getUserByUserId(userInfo.getUserId()); if (resultGetUserInfo4 != null && resultGetUserInfo4.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { if (userInfo.getUserId().equals(resultGetUserInfo4.getResult().getUserId()) && updateUserInfo.getDisplayName().equals(resultGetUserInfo4.getResult().getDisplayName()) && updateUserInfo.getPortrait().equals(resultGetUserInfo4.getResult().getPortrait())) { System.out.println("get user info success"); } else { System.out.println("get user info by userId failure"); System.exit(-1); } } else { System.out.println("get user info by userId failure"); System.exit(-1); } // 获取用户的IM Token,用于客户端登录 IMResult resultGetToken = UserAdmin.getUserToken(userInfo.getUserId(), "client111", ProtoConstants.Platform.Platform_Android); if (resultGetToken != null && resultGetToken.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get token success: " + resultGetToken.getResult().getToken()); } else { System.out.println("get user token failure"); System.exit(-1); } // 封禁用户(状态码:2表示封禁) IMResult resultVoid =UserAdmin.updateUserBlockStatus(userInfo.getUserId(), 2); if (resultVoid != null && resultVoid.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("block user done"); } else { System.out.println("block user failure"); System.exit(-1); } // 检查用户封禁状态 IMResult resultCheckUserStatus = UserAdmin.checkUserBlockStatus(userInfo.getUserId()); if (resultCheckUserStatus != null && resultCheckUserStatus.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { if (resultCheckUserStatus.getResult().getStatus() == 2) { System.out.println("check user status success"); } else { System.out.println("user status not correct"); System.exit(-1); } } else { System.out.println("block user failure"); System.exit(-1); } // 获取所有被封禁用户列表 IMResult resultBlockStatusList = UserAdmin.getBlockedList(); if (resultBlockStatusList != null && resultBlockStatusList.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { boolean success = false; for (InputOutputUserBlockStatus blockStatus : resultBlockStatusList.getResult().getStatusList()) { if (blockStatus.getUserId().equals(userInfo.getUserId()) && blockStatus.getStatus() == 2) { System.out.println("get block list done"); success = true; break; } } if (!success) { System.out.println("block user status is not expected"); System.exit(-1); } } else { System.out.println("block user failure"); System.exit(-1); } // 解封用户(状态码:0表示正常) resultVoid =UserAdmin.updateUserBlockStatus(userInfo.getUserId(), 0); if (resultVoid != null && resultVoid.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("block user done"); } else { System.out.println("block user failure"); System.exit(-1); } // 再次检查用户状态,确认已解封 resultCheckUserStatus = UserAdmin.checkUserBlockStatus(userInfo.getUserId()); if (resultCheckUserStatus != null && resultCheckUserStatus.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { if (resultCheckUserStatus.getResult().getStatus() == 0) { System.out.println("check user status success"); } else { System.out.println("user status not correct"); System.exit(-1); } } else { System.out.println("block user failure"); System.exit(-1); } // 检查用户在线状态 IMResult outputCheckUserOnline = UserAdmin.checkUserOnlineStatus(userInfo.getUserId()); if (outputCheckUserOnline != null && outputCheckUserOnline.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("check user online status success:" + outputCheckUserOnline.getResult().getSessions().size()); } else { System.out.println("block user online failure"); System.exit(-1); } //测试踢下线用户客户端 IMResult kickoffResult = UserAdmin.kickoffUserClient(userInfo.getUserId(), null); if (kickoffResult != null && kickoffResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("kickoff user client success"); } else { System.out.println("kickoff user client failure"); System.exit(-1); } //慎用,这个方法可能功能不完全,如果用户不在需要,建议使用block功能屏蔽用户 // 销毁用户(物理删除,不可恢复) IMResult voidIMResult = UserAdmin.destroyUser("user11"); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("destroy user success"); } else { System.out.println("destroy user failure"); System.exit(-1); } // 获取所有用户列表(分页:每页100条,第0页) IMResult getUserListIMResult = UserAdmin.getAllUsers(100, 0); if (getUserListIMResult != null && getUserListIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("getUserListIMResult success"); } else { System.out.println("getUserListIMResult failure"); System.exit(-1); } // 商业版专属功能 if (commercialServer) { // 获取在线用户总数 IMResult getOnlineUserCountResultIMResult = UserAdmin.getOnlineUserCount(); if (getOnlineUserCountResultIMResult != null && getOnlineUserCountResultIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get user online count success"); } else { System.out.println("get user online count failure"); System.exit(-1); } // 获取在线用户列表(分页:第1页,从0开始,每页100条) IMResult getOnlineUserResultIMResult = UserAdmin.getOnlineUser(1, 0, 100); if (getOnlineUserResultIMResult != null && getOnlineUserResultIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get user online success"); } else { System.out.println("get user online failure"); System.exit(-1); } // 获取指定用户的会话信息 IMResult getUserSessionResultIMResult = UserAdmin.getUserSession("hygqmws2k"); if (getUserSessionResultIMResult != null && getUserSessionResultIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get user session success"); } else { System.out.println("get user session failure"); System.exit(-1); } } } //*********************************************** //**** 用户关系相关的API //*********************************************** /** * 用户关系管理API测试 *

* 测试以下功能: *

    *
  • 发送好友请求
  • *
  • 设置好友关系
  • *
  • 获取好友列表
  • *
  • 解除好友关系
  • *
  • 黑名单管理
  • *
  • 好友备注(别名)管理
  • *
  • 好友额外信息管理
  • *
  • 获取好友关系详情
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testUserRelation() throws Exception { //先创建2个用户用于测试好友关系 InputOutputUserInfo userInfo = new InputOutputUserInfo(); userInfo.setUserId("ff1"); userInfo.setName("ff1"); userInfo.setMobile("13800000000"); userInfo.setDisplayName("ff1"); // 调用SDK创建第一个用户 IMResult resultCreateUser = UserAdmin.createUser(userInfo); if (resultCreateUser != null && resultCreateUser.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Create user " + resultCreateUser.getResult().getName() + " success"); } else { System.out.println("Create user failure"); System.exit(-1); } // 创建第二个用户 userInfo = new InputOutputUserInfo(); userInfo.setUserId("ff2"); userInfo.setName("ff2"); userInfo.setMobile("13800000001"); userInfo.setDisplayName("ff2"); // 调用SDK创建第二个用户 resultCreateUser = UserAdmin.createUser(userInfo); if (resultCreateUser != null && resultCreateUser.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Create user " + resultCreateUser.getResult().getName() + " success"); } else { System.out.println("Create user failure"); System.exit(-1); } // 发送好友请求:ff1向ff2发送好友请求,附带问候语"hello",直接设为好友 IMResult result = RelationAdmin.sendFriendRequest("ff1", "ff2", "hello", true); if (result != null && (result.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS || result.getErrorCode() == ErrorCode.ERROR_CODE_ALREADY_FRIENDS)) { System.out.println("send friend request success"); } else { System.out.println("failure"); System.exit(-1); } // 设置好友关系:ff1把ff2设为好友,并附带额外信息 IMResult updateFriendStatusResult = RelationAdmin.setUserFriend("ff1", "ff2", true, "{\"from\":1}"); if (updateFriendStatusResult != null && updateFriendStatusResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("update friend status success"); } else { System.out.println("update friend status failure"); System.exit(-1); } // 获取ff1的好友列表 IMResult resultGetFriendList = RelationAdmin.getFriendList("ff1"); if (resultGetFriendList != null && resultGetFriendList.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && resultGetFriendList.getResult().getList().contains("ff2")) { System.out.println("get friend status success"); } else { System.out.println("get friend status failure"); System.exit(-1); } // 解除好友关系:ff1删除ff2 updateFriendStatusResult = RelationAdmin.setUserFriend("ff1", "ff2", false, null); if (updateFriendStatusResult != null && updateFriendStatusResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("update friend status success"); } else { System.out.println("update friend status failure"); System.exit(-1); } // 再次获取好友列表,确认ff2已被删除 resultGetFriendList = RelationAdmin.getFriendList("ff1"); if (resultGetFriendList != null && resultGetFriendList.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && !resultGetFriendList.getResult().getList().contains("ff2")) { System.out.println("get friend status success"); } else { System.out.println("get friend status failure"); System.exit(-1); } // 将ff2加入黑名单:ff1把ff2加入黑名单 IMResult updateBlacklistStatusResult = RelationAdmin.setUserBlacklist("ff1", "ff2", true); if (updateBlacklistStatusResult != null && updateBlacklistStatusResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("update blacklist status success"); } else { System.out.println("update blacklist status failure"); System.exit(-1); } // 获取黑名单列表 resultGetFriendList = RelationAdmin.getUserBlacklist("ff1"); if (resultGetFriendList != null && resultGetFriendList.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && resultGetFriendList.getResult().getList().contains("ff2")) { System.out.println("get blacklist status success"); } else { System.out.println("get blacklist status failure"); System.exit(-1); } // 设置好友备注(别名) String alias = "hello" + System.currentTimeMillis(); IMResult updateFriendAlias = RelationAdmin.updateFriendAlias("ff1", "ff2", alias); if (updateFriendAlias != null && updateFriendAlias.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("update friend alias success"); } else { System.out.println("update friend alias failure"); System.exit(-1); } // 获取好友备注(别名) IMResult getFriendAlias = RelationAdmin.getFriendAlias("ff1", "ff2"); if (getFriendAlias != null && getFriendAlias.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && getFriendAlias.getResult().getAlias().equals(alias)) { System.out.println("get friend alias success"); } else { System.out.println("get friend alias failure"); System.exit(-1); } // 设置好友额外信息(可以存储自定义数据) String friendExtra = "hello friend extra"; IMResult setExtraResult = RelationAdmin.updateFriendExtra("ff1", "ff2", friendExtra); if (setExtraResult != null && setExtraResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set friend extra success"); } else { System.out.println("set friend extra failure"); System.exit(-1); } // 获取好友关系详情(包括额外信息等) IMResult getRelation = RelationAdmin.getRelation("ff1", "ff2"); if (getRelation != null && getRelation.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get friend relation success"); } else { System.out.println("get friend relation failure"); System.exit(-1); } // 验证好友额外信息是否正确 if(!friendExtra.equals(getRelation.getResult().extra)) { System.out.println("set friend extra failure"); System.exit(-1); } //测试获取用户的机器人列表 IMResult userRobotsResult = UserAdmin.getUserRobots("ff1"); if (userRobotsResult != null && userRobotsResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get user robots success"); } else { System.out.println("get user robots failure"); System.exit(-1); } } //*********************************************** //**** 群组相关功能 //*********************************************** /** * 群组管理API测试 *

* 测试以下功能: *

    *
  • 创建群组
  • *
  • 获取群组信息
  • *
  • 转移群主
  • *
  • 修改群组信息(名称、扩展字段)
  • *
  • 获取群成员列表
  • *
  • 添加群成员
  • *
  • 踢出群成员
  • *
  • 设置群成员别名和扩展信息
  • *
  • 设置/取消群管理员(仅商业版)
  • *
  • 退出群组
  • *
  • 获取用户的群组列表
  • *
  • 获取共同群组
  • *
  • 群成员禁言/白名单管理(仅商业版)
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testGroup() throws Exception { // 先解散可能存在的测试群组 IMResult voidIMResult1 = GroupAdmin.dismissGroup("user1", "groupId1", null, null); PojoGroupInfo groupInfo = new PojoGroupInfo(); groupInfo.setTarget_id("groupId1"); groupInfo.setOwner("user1"); groupInfo.setName("test_group"); groupInfo.setExtra("hello extra"); groupInfo.setType(2); groupInfo.setPortrait("http://portrait"); List members = new ArrayList<>(); PojoGroupMember member1 = new PojoGroupMember(); member1.setMember_id(groupInfo.getOwner()); members.add(member1); PojoGroupMember member2 = new PojoGroupMember(); member2.setMember_id("user2"); members.add(member2); PojoGroupMember member3 = new PojoGroupMember(); member3.setMember_id("user3"); members.add(member3); IMResult resultCreateGroup = GroupAdmin.createGroup(groupInfo.getOwner(), groupInfo, members, null, null, null); if (resultCreateGroup != null && resultCreateGroup.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("create group success"); } else { System.out.println("create group failure"); System.exit(-1); } IMResult resultGetGroupInfo = GroupAdmin.getGroupInfo(groupInfo.getTarget_id()); if (resultGetGroupInfo != null && resultGetGroupInfo.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { if (groupInfo.getExtra().equals(resultGetGroupInfo.getResult().getExtra()) && groupInfo.getName().equals(resultGetGroupInfo.getResult().getName()) && groupInfo.getOwner().equals(resultGetGroupInfo.getResult().getOwner())) { System.out.println("get group success"); } else { System.out.println("group info is not expected"); System.exit(-1); } } else { System.out.println("create group failure"); System.exit(-1); } IMResult voidIMResult = GroupAdmin.transferGroup(groupInfo.getOwner(), groupInfo.getTarget_id(), "user2", null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("transfer success"); } else { System.out.println("create group failure"); System.exit(-1); } voidIMResult = GroupAdmin.modifyGroupInfo(groupInfo.getOwner(), groupInfo.getTarget_id(), ProtoConstants.ModifyGroupInfoType.Modify_Group_Name,"HelloWorld", null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("transfer success"); } else { System.out.println("create group failure"); System.exit(-1); } voidIMResult = GroupAdmin.modifyGroupInfo(groupInfo.getOwner(), groupInfo.getTarget_id(), ProtoConstants.ModifyGroupInfoType.Modify_Group_Extra,"HelloWorld2", null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("modify group extra success"); } else { System.out.println("modify group extra failure"); System.exit(-1); } resultGetGroupInfo = GroupAdmin.getGroupInfo(groupInfo.getTarget_id()); if (resultGetGroupInfo != null && resultGetGroupInfo.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { if ("user2".equals(resultGetGroupInfo.getResult().getOwner())) { groupInfo.setOwner("user2"); } else { System.out.println("group info is not expected"); System.exit(-1); } } else { System.out.println("create group failure"); System.exit(-1); } IMResult resultGetMembers = GroupAdmin.getGroupMembers(groupInfo.getTarget_id()); if (resultGetMembers != null && resultGetMembers.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get group member success"); } else { System.out.println("create group failure"); System.exit(-1); } PojoGroupMember m = new PojoGroupMember(); m.setMember_id("user1"); m.setAlias("hello user1"); voidIMResult = GroupAdmin.addGroupMembers("user1", groupInfo.getTarget_id(), Arrays.asList(m), null, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("add group member success"); } else { System.out.println("add group member failure"); System.exit(-1); } IMResult groupMemberIMResult = GroupAdmin.getGroupMember(groupInfo.getTarget_id(), "user1"); if (groupMemberIMResult != null && groupMemberIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get group member success"); } else { System.out.println("get group member failure"); System.exit(-1); } voidIMResult = GroupAdmin.kickoffGroupMembers("user1", groupInfo.getTarget_id(), Arrays.asList("user3"), null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("kickoff group member success"); } else { System.out.println("kickoff group member failure"); System.exit(-1); } voidIMResult = GroupAdmin.setGroupMemberAlias("user1", groupInfo.getTarget_id(), "user2", "test user2", null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set group member alias success"); } else { System.out.println("set group member alias failure"); System.exit(-1); } voidIMResult = GroupAdmin.setGroupMemberExtra(groupInfo.getOwner(), groupInfo.getTarget_id(), groupInfo.getOwner(), "hello member extra2", null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set group member extra success"); } else { System.out.println("set group member extra failure"); System.exit(-1); } if(commercialServer) { PojoGroupMember m4 = new PojoGroupMember(); m4.setMember_id("user4"); m4.setAlias("hello user4"); PojoGroupMember m5 = new PojoGroupMember(); m5.setMember_id("user5"); m5.setAlias("hello user5"); voidIMResult = GroupAdmin.addGroupMembers("user1", groupInfo.getTarget_id(), Arrays.asList(m4, m5), null, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("add group member success"); } else { System.out.println("add group member failure"); System.exit(-1); } voidIMResult = GroupAdmin.setGroupManager("user1", groupInfo.getTarget_id(), Arrays.asList("user4", "user5"), true, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set group manager success"); } else { System.out.println("set group manager failure"); System.exit(-1); } voidIMResult = GroupAdmin.setGroupManager("user1", groupInfo.getTarget_id(), Arrays.asList("user4", "user5"), false, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("cancel group manager success"); } else { System.out.println("cancel group manager failure"); System.exit(-1); } } voidIMResult = GroupAdmin.quitGroup("user4", groupInfo.getTarget_id(), null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("quit group success"); } else { System.out.println("quit group failure"); System.exit(-1); } IMResult groupIdsIMResult = GroupAdmin.getUserGroups("user1"); if (groupIdsIMResult != null && groupIdsIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { if (groupIdsIMResult.getResult().getGroupIds().contains(groupInfo.getTarget_id())) { System.out.println("get user groups success"); } else { System.out.println("get user groups failure"); System.exit(-1); } } else { System.out.println("get user groups failure"); System.exit(-1); } groupIdsIMResult = GroupAdmin.getUserGroupsByType("user2", Arrays.asList(ProtoConstants.GroupMemberType.GroupMemberType_Manager, ProtoConstants.GroupMemberType.GroupMemberType_Owner)); if (groupIdsIMResult != null && groupIdsIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get user groups by type success"); } else { System.out.println("get user groups by type failure"); System.exit(-1); } groupIdsIMResult = GroupAdmin.getCommonGroups("user1", "user2"); if (groupIdsIMResult != null && groupIdsIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get user common groups success"); } else { System.out.println("get user common groups failure"); System.exit(-1); } //测试批量获取群组信息 IMResult batchGroupInfoResult = GroupAdmin.batchGroupInfos(Arrays.asList(groupInfo.getTarget_id())); if (batchGroupInfoResult != null && batchGroupInfoResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("batch get group info success"); } else { System.out.println("batch get group info failure"); System.exit(-1); } //测试群备注功能 String groupRemark = "test group remark"; IMResult setGroupRemarkResult = GroupAdmin.setGroupRemark("user1", groupInfo.getTarget_id(), groupRemark); if (setGroupRemarkResult != null && setGroupRemarkResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set group remark success"); } else { System.out.println("set group remark failure"); System.exit(-1); } IMResult getGroupRemarkResult = GroupAdmin.getGroupRemark("user1", groupInfo.getTarget_id()); if (getGroupRemarkResult != null && getGroupRemarkResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && groupRemark.equals(getGroupRemarkResult.getResult())) { System.out.println("get group remark success"); } else { System.out.println("get group remark failure"); System.exit(-1); } //测试收藏群功能 IMResult setFavGroupResult = GroupAdmin.setFavGroup("user1", groupInfo.getTarget_id(), true); if (setFavGroupResult != null && setFavGroupResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set fav group success"); } else { System.out.println("set fav group failure"); System.exit(-1); } Thread.sleep(1000); IMResult isFavGroupResult = GroupAdmin.isFavGroup("user1", groupInfo.getTarget_id()); if (isFavGroupResult != null && isFavGroupResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && isFavGroupResult.getResult()) { System.out.println("is fav group success"); } else { System.out.println("is fav group failure"); System.exit(-1); } //取消收藏 setFavGroupResult = GroupAdmin.setFavGroup("user1", groupInfo.getTarget_id(), false); if (setFavGroupResult != null && setFavGroupResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("cancel fav group success"); } else { System.out.println("cancel fav group failure"); System.exit(-1); } //仅专业版支持 if (commercialServer) { //开启群成员禁言 voidIMResult = GroupAdmin.muteGroupMemeber("user1", groupInfo.getTarget_id(), Arrays.asList("user5"), true, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mute group member success"); } else { System.out.println("mute group member failure"); System.exit(-1); } //关闭群成员禁言 voidIMResult = GroupAdmin.muteGroupMemeber("user1", groupInfo.getTarget_id(), Arrays.asList("user5"), false, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("unmute group member success"); } else { System.out.println("unmute group member failure"); System.exit(-1); } //开启群成员白名单,当群全局禁言时,白名单用户可以发言 voidIMResult = GroupAdmin.allowGroupMemeber("user1", groupInfo.getTarget_id(), Arrays.asList("user5"), true, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("allow group member success"); } else { System.out.println("allow group member failure"); System.exit(-1); } //关闭群成员白名单 voidIMResult = GroupAdmin.allowGroupMemeber("user1", groupInfo.getTarget_id(), Arrays.asList("user5"), false, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("unallow group member success"); } else { System.out.println("unallow group member failure"); System.exit(-1); } } //测试解散群组 IMResult dismissGroupResult = GroupAdmin.dismissGroup("user2", groupInfo.getTarget_id(), null, null); if (dismissGroupResult != null && dismissGroupResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("dismiss group success"); } else { System.out.println("dismiss group failure"); System.exit(-1); } //验证群组已被解散 resultGetGroupInfo = GroupAdmin.getGroupInfo(groupInfo.getTarget_id()); if (resultGetGroupInfo != null && resultGetGroupInfo.getErrorCode() == ErrorCode.ERROR_CODE_NOT_EXIST) { System.out.println("group dismissed verified"); } else { System.out.println("group dismiss verify failure"); System.exit(-1); } } //*********************************************** //**** 消息相关功能 //*********************************************** /** * 消息管理API测试 *

* 测试以下功能: *

    *
  • 发送单聊消息
  • *
  • 获取消息详情
  • *
  • 撤回消息
  • *
  • 删除消息(仅商业版)
  • *
  • 更新消息内容(仅商业版)
  • *
  • 广播消息(仅商业版)
  • *
  • 撤回广播消息(仅商业版)
  • *
  • 获取会话已读时间戳(仅商业版)
  • *
  • 获取消息投递状态(仅商业版)
  • *
  • 清除会话(仅商业版)
  • *
  • 群发消息
  • *
  • 撤回群发消息
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testMessage() throws Exception { // 创建会话对象:目标用户ff2,会话类型为私聊 Conversation conversation = new Conversation(); conversation.setTarget("ff2"); conversation.setType(ProtoConstants.ConversationType.ConversationType_Private); // 创建文本消息内容并编码为MessagePayload TextMessageContent textMessageContent = new TextMessageContent("Hello world"); MessagePayload payload = textMessageContent.encode(); IMResult resultSendMessage = MessageAdmin.sendMessage("ff1", conversation, payload, null); if (resultSendMessage != null && resultSendMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("send message success"); } else { System.out.println("send message failure"); System.exit(-1); } IMResult outputMessageDataIMResult = MessageAdmin.getMessage(resultSendMessage.result.getMessageUid()); if(outputMessageDataIMResult != null && outputMessageDataIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && outputMessageDataIMResult.getResult().getMessageId() == resultSendMessage.getResult().getMessageUid()) { System.out.println("get message success"); } else { System.out.println("get message failure"); System.exit(-1); } IMResult stringIMResult = MessageAdmin.recallMessage("user1", resultSendMessage.getResult().getMessageUid()); if (stringIMResult != null && stringIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("recall message success"); } else { System.out.println("recall message failure"); System.exit(-1); } if (commercialServer) { IMResult voidIMResult = MessageAdmin.deleteMessage(resultSendMessage.getResult().getMessageUid()); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("delete message success"); } else { System.out.println("delete message failure"); System.exit(-1); } payload.setSearchableContent("hello world2"); resultSendMessage = MessageAdmin.sendMessage("user1", conversation, payload, null); if (resultSendMessage != null && resultSendMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("send message success"); } else { System.out.println("send message failure"); System.exit(-1); } payload.setSearchableContent("hello world3"); voidIMResult = MessageAdmin.updateMessageContent("user1", resultSendMessage.getResult().getMessageUid(), payload, true); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("update message success"); } else { System.out.println("update message failure"); System.exit(-1); } IMResult resultBroadcastMessage = MessageAdmin.broadcastMessage("user1", 0, payload); if (resultBroadcastMessage != null && resultBroadcastMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("broad message success, send message to " + resultBroadcastMessage.getResult().getCount() + " users"); } else { System.out.println("broad message failure"); System.exit(-1); } voidIMResult = MessageAdmin.recallBroadCastMessage("user1", resultBroadcastMessage.result.getMessageUid()); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Success"); } else { System.out.println("failure"); } //测试删除广播消息 IMResult deleteBroadCastResult = MessageAdmin.deleteBroadCastMessage("user1", resultBroadcastMessage.result.getMessageUid()); if (deleteBroadCastResult != null && deleteBroadCastResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("delete broadcast message success"); } else { System.out.println("delete broadcast message failure"); } IMResult timestampResult = MessageAdmin.getConversationReadTimestamp("57gqmws2k", new Conversation(0, "admin", 0)); if(timestampResult != null && timestampResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Get conversation read time success"); } else { System.out.println("Get conversation read time failure"); } timestampResult = MessageAdmin.getMessageDelivery("57gqmws2k"); if(timestampResult != null && timestampResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Get message delivery success"); } else { System.out.println("Get message delivery failure"); } conversation = new Conversation(); conversation.setTarget("user1"); conversation.setType(ProtoConstants.ConversationType.ConversationType_Private); conversation.setLine(0); IMResult clearConversationResult = MessageAdmin.clearConversation("user2", conversation); if (clearConversationResult != null && clearConversationResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("clear conversation success"); } else { System.out.println("clear conversation failure"); } //测试清空用户消息 IMResult clearUserMessagesResult = MessageAdmin.clearUserMessages("user1", conversation, 0, System.currentTimeMillis()); if (clearUserMessagesResult != null && clearUserMessagesResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("clear user messages success"); } else { System.out.println("clear user messages failure"); } } List multicastReceivers = Arrays.asList("user2", "user3", "user4"); IMResult resultMulticastMessage = MessageAdmin.multicastMessage("user1", multicastReceivers, 0, payload); if (resultMulticastMessage != null && resultMulticastMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("multi message success, messageid is " + resultMulticastMessage.getResult().getMessageUid()); } else { System.out.println("multi message failure"); System.exit(-1); } IMResult voidIMResult = MessageAdmin.recallMultiCastMessage("user1", resultMulticastMessage.result.getMessageUid(), multicastReceivers); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Success"); } else { System.out.println("failure"); } //测试删除多播消息 IMResult deleteMultiCastResult = MessageAdmin.deleteMultiCastMessage("user1", resultMulticastMessage.result.getMessageUid(), multicastReceivers); if (deleteMultiCastResult != null && deleteMultiCastResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("delete multicast message success"); } else { System.out.println("delete multicast message failure"); } } //*********************************************** //**** 发送各种消息。 //*********************************************** /** * 消息内容编码测试 *

* 测试各种类型消息的编码和发送: *

    *
  • 文本消息
  • *
  • 语音消息
  • *
  • 图片消息
  • *
  • 视频消息
  • *
  • 位置消息
  • *
  • 文件消息
  • *
  • 动态表情消息
  • *
  • 链接消息
  • *
  • 名片消息
  • *
  • 提醒消息
  • *
  • 富通知消息
  • *
  • 流式文本消息
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testMessageContent() throws Exception { // 设置发送者 String sender = "userId2"; // 创建会话对象 Conversation conversation = new Conversation(); conversation.setTarget("3ygqmws2k"); conversation.setType(ProtoConstants.ConversationType.ConversationType_Private); //测试发送文本消息 TextMessageContent textMessageContent = new TextMessageContent("测试文本消息"); //消息转成Payload并发送 MessagePayload payload = textMessageContent.encode(); IMResult resultSendMessage = MessageAdmin.sendMessage(sender, conversation, payload, null); checkSendMessageResult(resultSendMessage); //测试发送语音消息 SoundMessageContent soundMessageContent = new SoundMessageContent(); //语音文件时长,单位秒 soundMessageContent.setDuration(7); //语音文件格式为amr或者mp3,需要先上传到对象存储服务。 soundMessageContent.setRemoteMediaUrl("https://media.wfcoss.cn/firechat/voice_message_sample.amr"); //消息转成Payload并发送 payload = soundMessageContent.encode(); resultSendMessage = MessageAdmin.sendMessage(sender, conversation, payload, null); checkSendMessageResult(resultSendMessage); //测试发送图片消息 ImageMessageContent imageMessageContent = new ImageMessageContent(); //base64edData为图片的缩略图。缩略图的生成规则是,把图片压缩到120X120大小的方框内,45%的质量压缩为JPG格式,再把二进制做base64编码得到字符串。 String thumbnailBase64edData = "/9j/4AAQSkZJRgABAQAASABIAAD/4QCARXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAKgAgAEAAAAAQAAAHigAwAEAAAAAQAAAFoAAAAA/+0AOFBob3Rvc2hvcCAzLjAAOEJJTQQEAAAAAAAAOEJJTQQlAAAAAAAQ1B2M2Y8AsgTpgAmY7PhCfv/AABEIAFoAeAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2wBDAAcHBwcHBwwHBwwRDAwMERcRERERFx4XFxcXFx4kHh4eHh4eJCQkJCQkJCQrKysrKysyMjIyMjg4ODg4ODg4ODj/2wBDAQkJCQ4NDhkNDRk7KCEoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/3QAEAAj/2gAMAwEAAhEDEQA/APaXJHFIiMTk1UN0EYBuM1Qn8QW9tM0EincpUDGCDuOPz9q9B6HGa15f2mnW7T3L4VcAgDJ59hXnLeMYU1K6lChInTAbd9/bgA+xxnFcN4r8RXUlzLJGS0BJ75Iz2bHTGQOvFcBcC/EIfnBPfnj8M1xznNv3eh006EppuKbtv5Hdvrs9vMs6KrYbKHOcAd8HgcelUzqlvIrvaB1kI4IPAPr07e1cBI928aKoY+oPXJPYd6tQ3D4lliHEZB2j0Oc4HcDvzXM0x2OtTWL+C38gzrIEbIKkknd1/D1qOe9d5knjkUM/8KcA9MkkVmwyXMjIiq0QXjO3+HqDk4GKoxTRvJ5NuCvJPzZ60khHR3FyyL84Ksx3FcYB/E1VeeJyN3yHGEzznPvWfdzmVCZo2ZsDbjJwe/1FZcPmXUirGCSvPHt9aajcpJvRHQtqd3a3Xkwncy/Kq5yDwfTrWfE8qXQilAUMpKsMEdP5djVZoYkzcSswlyMdAB7EYzWpbvaGNVbDSeWVZBwG+YtnkfT8quMW9EdEMJVm2lEtLEsEbLMzAHD5XJ49OeM+9Qx3cMFwqrGSoI+UH0z361l3V3cW8+wABZBkKeMA/WrEN3Ldh0gQhQPnYAYGPeoafUwaa0Ztf2hbeaPNUovLDyxlsnnk+vepP7Vs/wC/dfmP/iayBfSLK0ICyK4xjswNLtH/AD5r/n8aQj//0MhfFmvRTGSeTfESd0bYbg9s47VgnUme7a/kIaQ5+Y8feGO2M47Vjf6NNzE5jlPOATkfWoXgs4Iw967Su3ccfpXfJpo+z+q4e13SjZ9en+f4fMnuxErKr7iGHy4OFJxyc0tqgj6Ekd17VGk9nFASuXVjwCc/zppj0xQD5RVj/dJx/OslCKd00ONGjSd4cq+b/Prckms4ZkC7CFzwQeKhOm20GDEjsfXPenokGNolIB4K54/A4zVpBCytFltuMU1CLVrGscJRcb+zX4f195XiaI27RgtEoypAPOM9MnpVeM2lirMImO48ZIJHHTNSpbEPsll+Tk4LgZqG8sozhQ/l9gG5H5io5ZRV4o4J0ORe0pU1db3t+Ww19ZeNiV71Yt9T+1ht4SMKOST1zWeq2dupimTzDkZJ5HPpjGKvSw2caNGrRqrcjHHTpmnCU+sjTCTxC1c1pui20jPHutSJB3XA6/jVKTeylmCsxOMKDn8RUls0U6hreUxue3UGnz/bIwZGI8vGX9eKqUOeF2a4uEa9Lne3lr/wSQ2yRYjmQOV4O7BK57c1Ygt1tojDbq5DHJxk4PTtWT9oEkIWRtueg/8AsupoAuLVjJBKdvBbPPT2qeeL2RMuWMVONNSt100/X+uhpu/kqSZs7BglTnb36VW/tJP+ftv++azobpLgNLPIEMnynaB/KnfZ7P8A57t/3xRGSer/AK/EwhV54qWj9bf5n//R81axtSgjt3PmpyzA9c/Sq32a1ClLmUyYHG7ggfXvWlc6TpdzF5mn+fDMvDLtOB9ST/KsyHTJYDJvJlc7SCP4evXrx0zXTOKpPkSTflr+B9Iq9KhpGF7+d/wCOz2KRbmN4z/eHzE/XpS/2SqbZS7xlhymAxGfQg9PwqxpltYIry3d2YpQxMYAyOO+MdzVxpIYUFxcfPEASHQfMx7cZ/A1rTpc8HJq/wA9v1N4PDVqfM47bK/+WqKcVvbBRBcyCQdNpGxhjpUYew09jC6GTP8AE3zHjtmoWitNTj8mFtkiZID8ED69arR6XNiQTAEZ/h5NJxlFJxXz3NFWlOalRhd9916alz7Rp1xiN1A569MVE2mxXMRFrL15IasFAQz7QWAyoB4NWbM3MNyse7y3bsew9DXOqnM7TRxLGQry5K9O99LrQltY3sZzJcBUIONhzkj/AGcVbmntZHfy4DJ0zyMCtdrYylZZSX25x+NZ8ltbo+1m+UMSoA28n1IrWcHBWjsd31OtQiqdJJxv1tf1108tikbqZYAtqG2g8/L0/Gr1i2oSBmYlUzghhz64xRJOzDy4MJs54PAFNfUGyI5Q6NkkMemMVnezvcq6oyUpTdlpbp+ZLcW9tcnYYAW9QSKrQXF3atsmh2Rjjb2+uBVo3wkjw7nevHPWmSJNdw+T5m09QT1//VWz97WO5vJRk/aU/i8ra+pVu7WOVRdFGVWxt4/DNUfsy+r/AJCrIsL1oiqygtGBmNjx1/XNR/YNS/55Q/kKxlGTd0jxq/PUlzey/D/gn//S88sNclsj9kuQJywIU7iv51jXV/fSyyyxkgnoAMenX6c061RGu0mkbIC7sepHY1s6PDo5yb9s7+4yQCevAPNaRxFWclBztY64V6tXlhz2scqI7hkVmzmQkAgZHNKUu9OnUSYZ1yMZyOR/L3ro7q7ijlaGyV1RR0PTIJHFZ4njkvGnvMyBCAVHAIGe/XP49KyV4T0fzMVeE7X+ZltqtxLObkKufu4Udj6d62LYXtzulY+WTzg8Gpr+70UIjaZA0DAjd6cjn8qrzX9vEomjbcfvFSOfpXZopNzlc9/LqijzOrUul2f4lC4aSJzDMQgBz5mDyc+1SKIVeRiRcbssc/wmq2oXr6g6pCm0McFR79OuafFCtjI5KEqw2/NjjPsP51zzmlLTUxniF7VziuaK0T7fp95p3D3ctqJo/l2AYC9PX6fSsR7mK8j8olhJ1w3qK6C2sfOh3W7Ocg9MkKR6k8dPeq7W0VoyytCd46spyGHfNVCEWvd2R6MsNNxSg7R2fX+mY9taNG5aXDKwx9OnNdINs8JiuNvuO/4dQKgmksmAVImZpFHK8EZz2H0qIR3CLksdvXHce9XC0dYu6DDYanBy9m+ZPz/MtS3NskezyVQjAD425/Ko54HnGBOEZOduOR+NUtRlYLHCz7vMcAkjn8KmTULdIvK8hQVBJfOMjPAI7k1VSveT5rbf0tP1Mq2MhSqOjLb7vyJl8mbbBMG7KWX72TVn+yLH1uv8/wDAqzrLUIr35bgqhUgA8j8eOa1dlr/z8r+b/wCFTeNk/wCvyZ0wjSrRVRJO/ff9T//T8esX8mRH3ImCRx2IH5c+lW7q4Et/GGjAdXIO0cHt+ZOaoixaGF2Ygk7QrA9CT2Her0bXQgjYzfOxZQ7YIyOgrF1Wk430Y/aSUHFPRkf2oRXIS443AsDjnrnjFUDKyTOQcru/zn3q9PNdQxRB0xJtyz4554x+VQmM3aRRwKm6RwnXHJOM9M0RSS5mb0sLKpFtbpXt3RmMJriQx243FjwijmuuufBGp2FkdRupo9iIHdM4IGOe3PpXT6T4MutEv01AulyACJUxg4PdTz+PTitbxVYX+q2P2OxUNk/MoPbtk/WvDrZsnWhCjJcvVnbTwDhTlOotVsjyUXenKMRwjJq5HfWd3GI/KQsDyc447Vm3ej3enwTSXRSOSBgpiY4c7u4HcCse2/djeTzmvoYV+b3ovQuObVIe7OKt2tY9S0/xWdBtJLGZRIm8lCMHBPBBPpXOz34NzIWJdJc7eyjvj0rj5nmGVmPOcD8PSrtusrTLbqco/wB4kY7Z/SsKWHhTqyq0lZy/EmOZ1HWvS27GvHqUVsxVY8noSpyCKmF8rMrygqr7sY9uO9VW0o2qlySVdcg9OP8ACqxtJFZY/vjt7Cumc5RWp318VjKEFJrRboZeXcM0wQj5QnHsTWvoGm2V7b3U+ond5ATCAkN8x+9x1FMk0KCUC5dyOOSMYOOw96ptZxWMhubaVjxgg4zzWNam6kG4y+5nC8NWbeKqJSXWzX9aHc6f4G0iSFdRt7wvglkVwMD2YHritT/hH0/572f/AH6X/GuDnW4uIGM0xBYY2jjPHXAGMVi/2Wf+ex/KuGOX4uV3Gtp6I7pYbl+CkmvU/9Tze11H7JJ9khjAjkI+V0ByBjHHen6guizKpH7pmb+A4UH3Hb/61T+I4400awlRQHYnLAcnhepp3jK3t4I7byI1TkfdAH8q8yUbyjJO1xuRhNdGGJrYBX77/vfgPY1Whv4LNylpAFfPzTMNzZ9s8D8qpZOY/wDfSk1XjUZwOBvrrkvae7LY1q4qpUspPbY7i08cX1vqEb3W2aKNcOq8ZBHX3NaV547lEsdzp0DRRcgmQcN9MV5Y/UfSvSL1V/4RaE46JFj9K8jE4LDQnBuG+h2YbE1ZQm3LZXOY1vVk1OV55QJZXAwemMCuVKlMsa0JBgZHvUOAQQR/DmvZo01CCjHY8+Tcm5PqVchssRk8c0PNIJBLGfp6VpWgH2u046yL/MV1Xje3t4Vt5Io1RnJ3FQATwOtVe0khxhpzIhOmanHpSaj8ssbRCQgcttYc5B/u/wD16htPD99dpHeJLHEkynapJz7A+meua9BsgPIs17GJQR7FaoQACGADoEGP++RXl1cwnyyVtjWripygoSd0ctaaBqws2v3ysq7tsHO7aDg/j7d66Oy0G0uNJY3yfvlJDKRtZeOB71068zMTz8g/9Bp12ALqBRwDt4rlqYqdRcl7ddPyLp4qUKfK9VfY8VsxqCRiYRPNbglQDkg9emDnjrxVz7U//Pg35S//ABVes4CzOq8AR9B9ajrtWN1a5Tpoykly32P/2Q=="; imageMessageContent.setThumbnailBytes(Base64.getDecoder().decode(thumbnailBase64edData)); //图片地址,发送前需要先上传到对象存储服务。 imageMessageContent.setRemoteMediaUrl("https://media.wfcoss.cn/firechat/image_message_sample.jpg"); //消息转成Payload并发送 payload = imageMessageContent.encode(); resultSendMessage = MessageAdmin.sendMessage(sender, conversation, payload, null); checkSendMessageResult(resultSendMessage); //测试发送视频消息 VideoMessageContent videoMessageContent = new VideoMessageContent(); //base64edData为视频的首帧的缩略图。缩略图的生成规则是,把图片压缩到120X120大小的方框内,45%的质量压缩为JPG格式,再把二进制做base64编码得到字符串。 thumbnailBase64edData = "/9j/4AAQSkZJRgABAQAASABIAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAESgAwAEAAAAAQAAAHgAAAAA/8AAEQgAeABEAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/bAEMABwcHBwcHDAcHDBIMDAwSGBISEhIYHhgYGBgYHiQeHh4eHh4kJCQkJCQkJCwsLCwsLDMzMzMzOTk5OTk5OTk5Of/bAEMBCQkJDw4PGQ4OGTwpISk8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PP/dAAQABf/aAAwDAQACEQMRAD8Ab/wjfiDRJLuGK4g/0qFH8tS4LGPIwpXHIH8684vLq8ijktHBjcqVbqCcg/0r0PUo/NSy03cvmyKQ7uoXGRlRuyeB04pdW0HT4oWZ2NyjIkjbUwdpOfkbgZ7cc8GnuTY89sbu4l0xbdU3IVXocHKnGfrUV5aG6tnv0ZVmj5kTpuA7n3qnbyT+R5S/NHC+Adoz7e/StnUAzRRXEMYQOCCBn5vf0/KptqIyY3M0aEjBIAG0c/U4q7CDav58TKwKkYbjPqCK63R9HhuLhVtVMe+BXD8hA4z7Y5xitOPwp9p0qS8mBjlwCgYjB/2s8mnyhY8z+1AnZImAx6DjI9K257a50y1hitym53EiPGwLfMMYyPSruteGZdLtRI+DKMZAxgA/StDR7lYLuMX0ZEKYxsUFs9sfWhIDotEfUpLeR78M7mTgsMErtXFbOJP7h/IV0sMqXBkk8lfvY+Zueg681PiP/njH/wB9/wD16odj/9CK3jmaRL2Z40KyFRAqZViSOOhIzjPI4rZ1HTjdXsgMEayrH5zIpZ1LnjaDwAGznjkE1y8c1/FeGaNdsRbarKTgAnIXPr06Y9+9dde6xNb+HZjBGq3kTkkELkKMkNxnjjsaEScRoulylb+Zk3iGQAx5IyrnY+AOThuDg9q6u78K20a7NMdZpgwURHIQBiPmAPH1OcVT03R73SraLWplzDB5ZcHDCRJGy5b6cHFdxqGkTwpPqNhPsaTB3OSQFXsB04GcfWrA57SrSSNLq22iGaEArsZgGB+9kr1x6V29noVu0DsG2pcKCFUDC5Azg47motEhtElaZMMq5Eci8Ixb7+OfUd66Tzk42/yP6UAeeX+mWWmSSQy7bkzRkv52VRVQZGDzycetebrd3WmWyyLJsdsbR/Ft6gj2r2e9hvZ3kkuU3QK42oeSR7Y9feuQv9B0XT3dE3PcStuXJGEz228cfyoYEujWVxf28l40WDK+7o3PyjnrWv8A2NN/zz/8db/Gm6BfXt3YkyuqmNynT0A9a2/Muf8Anqv/AHyKQz//0b1zYsl5JHb3ZlwjSorqeCueOflyTz71gXh1y+Kx3Kr5lzgMMjPlgAnIHIGB1xirmk+KoLDZPbEtKqhJAUAyB2B/mT1xmuy8OWg1yW81yVfszTARIq8FQDk5xjqcfhimhG9o1rc3WlfYNTwrJ8pAxyuOPbGKtjw9AFMKTzLbnP7oMNo5zxkEgD0HFXbKxjtxyNzL/F+A6fiK0iaoDBtbafSwIConhGBG4AUr6hgB+oH1rZjJcbzx7U7NMOVJYdD1FADbhwifdLHPAHc1w96VtL6S7vjE7LHvKgY2nsMn/Gu9ODyaz73T7a+ieK5Xcrdun8qAM3QX1a4sjcC4OJHLYVeBkDgcVtbdW/5+G/75H+FZOjXMltaG1t7MskLlAQfT681q/b7v/nyb9P8AGgD/0syDwu0sctxbkCOMDiXClj3U84Iz3zycjtXp3hZpE0eK0mV0O3zAyAlSM8DPr6iuP0DSri9Z5bqEwqu1/MLEKCxyMDk5GSRk/X1r1jTraa0tzFNJ5nJIPPA7DnmmIuIW3MW74Ip5NNzTSaYCk01j8poNJ1FMB+ahmRpYyisUJ7in0ZoETQuqJtbk/hUvmp/nFRRRRMpLAZz6VJ5MP90flSGf/9P0Xw417JLdS3SL5YYCKQDaWHOcj8sGuqzXH6RqWi2FjHaw3OQvPzbifXnrituLWNOmTzEuEx05OD+RpiNTNJmsW513TbU7XlDH/Y+b+VTQatp9xtEU6kt0BOD+RoC5pE0ZrPudSsrZS00oGOCByfyFFtqNndpuhcH2PB/I0wuX80maz5NUsIpPKkmUN6VaeaKNd7uoHqTQIvw/c/GpqzbS/s5YtyyjGTVn7Va/89V/OgZ//9TDjmwfmrVtrK6vF3wKCAcZLAfzNUI0kZtwAH4f/Wrb09HiiIA6tVNmaRQkL2zNDIcFTyB0oW5IOetW7m3kM5l6Emnx2lxIevWgmxAbot1qY3LBVb1qZtNuFGdvT3qhcX1tazJY3ThWbnOen1pNjSbJTcsetL9oY9ya1JLG5jQFuFUZzU39lTyASDB3c565qtBWNLQZs2bnn/WH+Qrb8361U0WxmS1ZT/fP8hWx9jmqR2P/1eui023AG1MVejsoQuAtWVBHBxxUoyBTJKj2cRbO2rMVrGDnFSZGOetSqcc0CK13GI7eSRVB2qW59RzXzDLqiXV3DLdqeHzKVPLZbPHpgcV9QX2Xs5xnrG38q+Qm/wBcF9TVRQmz6luNY0v+wzq6fvLYrwO/pj61V8Iaomr6WzKhRInKKCckL1Az7dK52+Wy0nRE8O2+XR03sScnLHP4Vq+AYYYNMmEXTzOn4ClYo9J06JfJbj+L+grQ8pfSqVj/AKo/739BVykI/9b0IPx6GnhmHNQHrU/8NMgeGNSBgO+ahFC0ATz4aF19VI/SvkC5Hl3Deoavr6T7jfQ/yr5Dv/8Aj6f/AHquImfR15JDP4WhvZdit5Me5247Acmuf8Da3DJfXGmIQwI3Aj1GAcVb1T/knv8A2xj/AKVwnw4/5GFv91v6UlsUz6W05/3Lf739BV/dWZpv+pb/AHv6CtCkI//Z"; videoMessageContent.setThumbnailBytes(Base64.getDecoder().decode(thumbnailBase64edData)); //视频时长,单位秒 videoMessageContent.setDuration(3); //视频地址,发送前需要先上传到对象存储服务。 videoMessageContent.setRemoteMediaUrl("https://media.wfcoss.cn/firechat/video_message_sample.mov"); //消息转成Payload并发送 payload = videoMessageContent.encode(); resultSendMessage = MessageAdmin.sendMessage(sender, conversation, payload, null); checkSendMessageResult(resultSendMessage); //测试发送位置消息 LocationMessageContent locationMessageContent = new LocationMessageContent(); //base64edData为位置图片的缩略图。缩略图的生成规则是,把图片压缩到120X120大小的方框内,45%的质量压缩为JPG格式,再把二进制做base64编码得到字符串。 thumbnailBase64edData = "/9j/4AAQSkZJRgABAQAASABIAAD/4QCMRXhpZgAATU0AKgAAAAgABQESAAMAAAABAAEAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAABIAAAAAQAAAEgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAALSgAwAEAAAAAQAAAHgAAAAA/8AAEQgAeAC0AwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBAQEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEHYXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uLj5OXm5+jp6vLz9PX29/j5+v/bAEMAAwMDAwMDBQMDBQcFBQUHCQcHBwcJDAkJCQkJDA4MDAwMDAwODg4ODg4ODhERERERERQUFBQUFhYWFhYWFhYWFv/bAEMBAwQEBgUGCgUFChcQDRAXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXFxcXF//dAAQADP/aAAwDAQACEQMRAD8A/SGR0ZcRx7TkEHI7HPrUE5keJgeeD3qzG8boryksSAc7sD8BkcUxxB5MpJGcHbls9vrXJc2sPI+Y71UHP9//AOtRtT+6v/ff/wBaozLIufnQ89SB/jWbrGtWukWBvrpTJtdFVIgC7u52qqjPUk9zj1pt8qu3oOKcmoxWp0EewcIeB0qWuGtvFGkXKSTXoeykjkEEkNwgMiPwcHZuGMMpyDjB61JP4k8OxNKn2gfufvko+B8wUYwpzknt25rLmi9eY1dOaduU7GX7h9cH+VVYpNvy4+9iufj1zQ50jWG4w865RSHGeGPoOcKeDzT08Q6KwtpEuNwupPLiwj/M64yPu8Yz3q4uNtyHTl2OmJaKxjDYVlJHB+lUo3SPLIxBY5YgKcn6kVkS+NfDqRPH9r+aJyrBUdiGIOOAp/utz0rShvDcwpcQszJIodG8scg8g8pmtE4S0uQ4Sjq0WYEywKOzAIVw2MA8Y6ev9Kesc1upclD0HQ9yB61JGZfKPmYA6klVHHrwO1VZTCRIAzsNg25Zsbuf/rUn2Qjzrxxrer6LexR2sz28P2ZpYmS1+0fabkMdsPPC8Y7gnOQeKh1K8uZr+4W4vJYLp7eNns13lEd4jIUBQk4wpOQu7dxXp4ikBKg4xwfmYf1qg+l6dPcNcSpEZA/3nwTkJt6n2JH0rldKV22ztVeKily6rr3PJ9K1hra3sBcanJ8szblw/wC96R4YSYbGT/DwDn6U5dRktdPeEardEK8cbShGLZQyM45yMcE8nJxzgc16auiaPCAsdtERCpEZUcJkHOMdzgZpr6No0nMkETZ5O7acnk5I7k7jk9TnmkqT7luvBu9vyM3R9Nv21R9We9eezuogywuXAjLYIwrZHA6HIPJzXQSxp5VyM7go4P4CliEcUIt4yiogCKOOABgDJOTSSFzaT4YYC+nX8c11QXKcU5czuVdGk8uKY4J75AyPvN1rQz5rE+SrE8k7RWdo/KOh6M+0/TL1pxJuY+SxUbQfm7/qa0lbmZktiUoQpRUAIxwv19KjliieRgfvE7fmQHGecjNWQVViHIJHFKWQ4AI96zuUUBsT5fN6f7P/ANel3J/z2/8AHf8A69Wvs5PKlcf7oo+zN6r/AN8iquu4WP/Q/SqGMAHdGq/Tmo5olyGTBYHOCQOxpCzu2yTK4GcqAc5+mfSlQM6GQsuQTjKjscCuS3U2uMZdhXBXo3I7dPrVPWdNstXsm0++3NFIUJCMVYEMCGVgcqwPQirY+fZsBJbJOTjqM+9NZW2namMMFOW75HtSkk7qQ4yad4mLZeF/D1jaCwjgE6PKbh3nJlkeU4Jdnbkk7QPTAxTIfCGhxXFzdurSLcLsdWLEY3BiOuCMjpjpxXQshjQu0ecf7X/1qQyGLMTR55z97/61EYxS5Yr8EVKcpS5pSd/VmH/wjuiiVZYYnEiqEB3sPlAx2PbtUX/CN6KI4YxaqscLGSNASFVmAyQM8Zxn6810SyYUusYHb73/ANaodqoFAUfdB6e1NQjfYbqS/mM5vDeh3Ns7T2yMZnMrk5+Z9oXnB6YJ46c1eigS3t4bVGxEihUUksVVRgZ6n86vIEe0Vii8KxAxnsvrmqt9Pa2NkL+5AWOFS7lRzgKScYxUc0VLkS1E+Zxu3oOjjk2kqPlkU4x3GOCfTNRMyFWDZwV7g1g2/iS3jSYaik1p5CK+xiHJR87SNueeCCOxFTS+JtFgk+zvM+XiaUZjJyigk4xtOflPHXIrezMzdaOFbjy/l+93x9aEMDM7CPOW4PA4wPUiufj8V+HbiKNzJIRKxQAh/vL14PNdIZEQbUUH5sZyD+fWpdwK7ySFXQLgEkrx6+4P9K0DDGMfe5PY1AksjPsPAwSMH0/ClLyEhEJG4989hmiwHNeJPEv/AAjjxK9u8qSQzyB/NSMZhCnb855J3dv1rmtd8eGxv7LRpLBjNfRRum6Zesg4ThSN2SR15xkCu71HRrLU4ydSUy+WkiptkdCA4w4OxlyCAODWJfaFo9xILu4tUeaJNiu2SQoUqB1xwDgenXrVqxLuUdM1W4S5EYt3Fubv7MZQyffzIAdp525yK6yIYQoDyUHP4r/jXNaZoumtPJqJhHnRyecG3P8A6wlxu27tuce1dIVkA/dnJ2/h2Pc+1E92C2JiZFlMTFW+YDLDPX8aeFkYbgqnPov/ANehx5imcSAsibhhf/r08SiNVVScc/w5/rWdyiLy5v7v6H/Gjy5v7v6H/Gn+cys2OckHOD6Cl+0Seh/L/wCvVXA//9H9J5VAnwuB8g/iK9z6EVCqgRsxA4ZuS/oT7Gr7okn38H/vr/Cq4t7eNSzheCTnB6dfSuVGoiLMqxsyg7R0XGeR+FR73KSfuyMPuJJUdCCe9XQFXgH/ANC/wpjwr5ZRGHzryfm7/hS5b6juVXulcAYGNwJ+Zeg59ajkkR2Levuv+NXJl2Qu8Mau6qSicjcQOBnHGTXNLqOvtaCRtKRZzCz+XvJw4chV7cFec5qoxtsJs2PMG3aPXPVf/iqmj8qQAMMEKB94c4HsadZebNZxS3cKwzOil4+TtbHIz7GrXlxA/dB4ByFPfmk1Jp2Gmr6kYwI4l4CsSrD6gf1qrKkMkL2l6hdDkbT0KkYx9CKvSRq0YUkqpJBG3GRx3JqI+SATvZQpxnJxnGe7EVxyhJSTvqbRcWmraGJaaBosEc6pCWjkChg7s5I54yxJwM8DNOu9I0K6/eSWyNIFKBiCDtI2kcHpgnjtWwgQu+243A88Y6KPoafsjPV2P4n+gq2qrWjBOC3RyaeHtERfKS2QKhyAC2Mk59fUA1rkAsSc9s44P3hWgba1Lbgx5Vc4JHOOe1PjtoEbzFYkkEc5NTGlP2nNJ6IHOPLZIqxsiPlVYkgjlgcUpuAjodp6k/Mw9DVlzGZACwBQ8gjHUU0RRy7ZY5MAAnpnIPHfNdtrnPcZ5iyHaQqK33iDkn26DrWfOU8qXeMny+OM85FaRtywAMo5BP3R2/D0FV7iJRayOkhA2lTuGeM/hjmmlYLmVpW7yZgMYYgHPX7z1tMYhFtR0Jxnk+2OKoaKkZWRQwYFh1U/3m/rx+Fahtrdju5BHTA/POTVTXvMUXoVWMZV2EgxtPBPOcYqQloyUD7cds5/pUrW0JUjJGRjP+Wp+Iv75/P/AOyqLFFVfN2gJLwBj8v+A0v7/wD56/p/9jVnbH/eP5//AGVGI/7x/P8A+yosFz//0v0iDtuClQM9SM5/rRukkhcsexAX19qiJ2HKhEyOM9cfmK80l8PeJJ/FYv4YmZWvIpUvzcMFjtV/1kIhDjJbkfdKnOc5rgqVHBK0bnZSpqbak7aHpH9raarOWvYdkZAc+YnysTgBueCSDxST61piMqLdQ/NH5hIkThRzu69MHOeK8Q1CwgEOoJLY3CiS/iBO8YMmZHz/AKs52hhnr29KtCSzS/umTT5B5Nmzq5mB3/uUJUDyyemQMdTzjHFY+3fVHY8Muj/I9ohvrW4RJIJ/MWQkIUIYEr1AwTnHeokv7ectLZzLMEXDFTnB64O3OK8r0+4CxaU50t5MmUxtlf3e12EpI8vnKqc56Z4wea6DwPJa/Y7/AMmy+zMzq7gvk/OCRgFUwF6DGe/fNXGrzNIxqYflTl2/zPQDI6NhiTjrtBP5Upmlkj8xVcKox2/h4PGR6UFolY5UuPYY/ma4hb3Wv7XeFTOENwytCY/3AtiPvCTGN/Q/ezk4xXV6HDc7diGhKShs53cgHI6evvUI2gYXIH4D/wBmrj7bU/FxN0rWSb4yoiBRwGUglzkbgSMD8Tjqat22o+KpNRnha0Jt1jZoiY9hZwAQNz4GCc9QDWboRbbkXGo1ojrLdSZDk/LtYHv2PvTnht9wbIBJ4BUYz+dclqd540XRrubTLZY71IwYQ+05JiJYgAnJD9B6eteS/DTXPHB16+Pi6K5i05idiX3zuk68FVkYKcHJJyNvQDmsHUVKUaSi3e/oexh8ulicNVxntEuS2jeru7aLqfRDQIxyAg+mB/PFMlby2SIHam0kkc859vaooissYljQFeoICf40sCu0xQZCggkEDngfX+ddd0eJYVltjj595JwAMZ/XFIiSRShowUz8obA7kD6dKn8ozFtqqAG28g56CkBkgDKcYUKRjpySOlK7HYk3SspImyF4IAz+lZ1ww8iZjxlCDhSMkkdePbvUkxiLEna5yCeDuHHuMfrUDOFs5kCtjZ1xxyapNvcCvo4zBMPUgf8AjzVoi2VdwkZgFbaCSee471m6MT5cqhWPIPHszVoyyS5LSRlVJ9R/WnJ+8yVsKYtsZKMRz1bv/OmqjNhckn2I/wDiaebslxHBjByScE/oKVp59p2spbBwAvP86i7ZRAY5QAPmzgZ4HXv2pNk3q35D/CrNvHLLEH8x+fc/41P9nl/56P8Amf8AGq+YH//T/SaKQZJbrgdPQf8A66ebuAHac5J2j5TyarebL321AihwG8xVKvuwSOCDXM0upqmW3lhkZPmIwxONp/wqy0ieWHHQrkZ79azwoDFtwdQTgjHX8KmdmWKFCoOUHcjpn29qElYL6k9sSY8EYwSB7D0qSWISIy4GSCMmqKyPs8tlVh179STTJP8AVtiNQcHkE1FmVctuLgZYttA5/hwPzFVWdA4d3JJHUYOCPbjtT3TKNiMAgZ4J/rQ7+ZJkK2WPqPTPr7VaJsNwJB8hGMdX4zyPTPpUezkjarY4yMkfyp4ZVXYRyWJDZFOiXcwj4H3iW4PcYHt1ouFijPeQWCTXdyyQQW0Mks0jZ/dxqpLNjHIwK8a8P+J/CnxE1a7j0ua4862U3ZhnXZvgdgN6bS3TI3A4IzXsd9p8N4t1ZXUYnt7iFoJo243xurBlyOnHftXmfg74aeEvh9JfahoYufMuYykk946ERQAh2VNiqMHaMsecCvdwqwP1Wq8Q37TTltt8zycQ8X9Ypqglyfavv8j1SzUxQLDGQI1GMEnOPxFSExySNHtJIdRnjoQv41ylh4w0bULW5ksjIWtYfP2TIYTJGeFdPMwGUnjP6cjMMXibffWsUdsWF2FdmWQfuyDjB2hvT1B5AxnivnvawavGR7joVE7NWO4lEK+YixgEA8g45x1p0yW4jYD72PU9ua8+u/G32SwN/daXICJTGyGYk7Rn5yQPTqD0JGeoqxc+Lo0+3rHZ7hZIGJEuc7m2gYCMc+3NT7WHcv6vU7HaTPaWz7XYoTzyzc9qrXskb2LSRMSrHbnJx/niuKuvEyX+rQWRtyhljDK4fK4ZS/GVUnpg11DH/iTr/v4/U1zUq8pVXTa0OFucajpzVla6JdFYBJFbozYP4Fz/AErYcWwBwQxH8Oea5vRrq2cyRxyJIyuQyqwJHMgOcdPxrdlTbGZETkDcDuHUc9K9KbtJmkdh5YjaUUqVzg9evXingsku92dx/EoHByO3PFMX7SW5OPzxU6icfeOal6Mdhn2WLt8o7AquQPzo+zRf3l/75X/GobqGWR1IJHy47epqt9ll9T+lLm8gsf/U+5V1+5l1gBbqH7H5BdkBiWThC25QWYgdDyxwOtU5vEHiD/iXjTriMqXK3Cu0JZm8wKwG3PABI45yRW7F4F0aa4a4lmuJiqGA73U5QxeWckKCTgnJ7nrSweFrG3eF4muM28pkTDJjcG+X+HouMAdhx6V5dpy0Z6vPSVml+BiX3iDV5ra6ksby185Z1WMDZwh3AI+XbDjBZh2Hc843tPl8TnVj/aCpJpxt0MLqUALlRkjaS3JDnnjBFVF8F6V5MiB5lEjBXGV+YKG+98vJO85PXgV2m0rDDGSX2xcM3UkcZP1zWkIS3kzOpONrQX4BApd/mJX5ONpI6E9amlhHlONz/dP8R9PrVYPJHtZAvIIOc/3h/jUqtJPCzucLg8KMZ49ck4/Kre5yo4DxuNfSW1ew/tCW0MMmVsGCyfaePK8w4J8v8CufvdqyL67uLa/sf7ZZjfiyC3CADywxhkZ8HzEBJweAuB154r1QxxiNQikEAdM1DNY6fPIjzQJIckEuu7Pyn1z6Vg6Lu5X3OyNdKKi1seOaTq2m2mm2kdtC7hbp5P3sKuQyiNcZEgADbxt7lhjr1dDbafaLqtwXuHjldEnVMB/nkdiVZWHTnPXA4Iz09mj0/TymwW0IUNu2iNcZPU4x14pX0+xUNi3iG45bCKM855wPWpVJ7Mt4latL+rnmcGmWGseI5ImklSWezKFwQV+aIBmxubkqwABbPU8gcdnpOk2+n6INAmY3cbK6OzqUDCXO4cZwDk4reit7QXAmSBFl67wqhueOuM9OKhnYrIV27gyqTk46nHp7VvGmrXe+pzTrOVkttDhdN+H9joMV0NLuJku5oVhimkYP5UKNkRJtCEKemeT6GrtpoOsR6hZ3T6m/k2ykTKSQsjdQMHORzyScnA/Dqg6ryyEjjOD+XJ+tA+ZztXGSSB17D/69TGjGC5Yqw5Yicm3J3OLi0PXJXeSbUVUSIu3EjHb8i7hsJAO5wTkYIycVUk8O+IEu7SX+0hIkEQ8z946lpASw6Zz1AyTz1NejqgKhvMxUfkxFXO1Rlz1FN013Gq0vIadPWWOM3QDyqgVmHGTjk8epqK9t44NPZEGAGUj2O4U+SNVOMKeM9KZdKPskqRj+JDgD2HpVqmlJStqclo3cranj/wAO4oIPFmvKdLuLWQknzpJQySgysPlURIByc/ebgjr29icB0KqvJGBlv/rV5R4AvdOufEviKGzvri5dHBeKREWKIiVx8jIx39QASBwOO9ewLGXhXbgEE1vLe4I8p8a+Pta8Pa4NNtIo0VIopI43Qu940jkNHEwddpUD0bn8AesvvEz2d5eWi24ZraLemZAC7YUlAMHnnt6c9RXUCIfaleUBmC5UkZxj09OtXa4FTlGUnzaM7XUpyjFcu3nucGPGNwLaCWW0jRpY95VpGyPmYdk74zzzzSf8JnL/AM+0X/f1/wD43XZvcCNtm3djvTPtY/55it+WRnzR7H//1f0oigli3BWXDNu+6ep/GqqqduTgkkn7p7k/7VXUScqCzkHuCo4PcfhTBDcIAiScDpkDP8q4lvqdBVVSpwOhJOMYHP4mpmVHgifaGOwDOM8c1Myy7QHIPPWmBiIIQoYfKMlOvU9c1qnoQ9xhW2PWL9KVVt87Vj42kkd+o/xqDJZd5L53Eck9Bj0xTh5j/KozhQPwzU8vULkogEmWiYqAcYyRj9aiUhXVpHYgNjkkj7poR5I4mjJRM7vvdee/btTirjZ8uCSe/YDrn8aGtLATrLGv3WDfSpA3mj5e1VPOWJsueR2LCkNwjMWVgM9gy/40WQFm3yZ2BPAYAfTIqrNuklJRd67VXIOOhz2qzaAZ3bgSWyRkH+L2zUMituQ7COwxg9vqKpPQTRWIUOV38BxgM3PGOOtTgDzkUPjgZ2kH+99aVUkdWU527mypIGOen5e9SeSwkCAIQ6nIPTqPSpb0GhrQlMqgds45OP6CkPTkEje3SmqkzqGESkH/AGmP9ajljdFB8sD5gf4hn9aE3oBIVy2drgdqZdEi2lZSR8yg4OOgGajZnALeWnAzzk9PrT7ySIwvEjLgAEBSPr2qtboNLHlvgO8ubvxBrkdxewXBgCJ5UQcPGRLLw+5F+nBIyPxPrXPkLjPU9CR/KvJ/h9pmqQa7rFxqOmQ28Mh/dSJgPKRK5y2Hc8A+wzXr2XUKqjYOgyN3J/EU5vWwkVo1ZJlZtx+U9STxketXPNHpVWVpUm+8CcBeBjrk9z7UbrgfNsz342n+RrO1x3HvbGRt+cZ7U37Gf7wqi7tNIzkHqAPyHvSbD6foKq0guf/W+/dN8Sx61ZpqenXAlglZwrlAuSjFG4dAeGUjpV4anc5x5iE+m2P/AAFeX/Db/kR7D/rref8ApVLXYr/r61SRNzpP7SvO4Q/8AH9DUV1rDwWzzyrsihjLPsU/dQFiQASenaokqhq//IH1D/r1n/8ARRpOKGmzKt/HWjOtlIsk0bag5jhidJFkLbwhLLg7QCRnPqK1NC8Z6f4i+0S6U7ubZ1ilEimMqxG4DDIOx614i3/Id8M/9fE3/pRBW78Kfv8AiL/r9i/9FCo9nEttnoOv/ENNG1BdJSymupWiDsIwDjOF9upIxVXTPiYl7fW2mXOl3Ns11xE8owp2gZ/9CHcd+4IrkNf/AOR8/wC3aH/0ZHST/wDIe8O/WT+lfPzxE1WcU9D9Xw+R4OeXqvKHvcl73e9rntS3ygsWizuOf0x6077dAesP+fyqgOgpK9zkR+UXZqw39ssi4jKZYZPPTP0qFLuIOXldyckADgAduDVE/eX8P51DL/rG/CjlVhKTNk3dixyxOf8AaCn+dN8/Sc4LKD+Fc9L96qEn+srJotHeC3t9qlGUbgG6jv04JHao7iB4YHnKuViUuWUnOFGenIqt2i/3I/5Vv3n/ACCbr/rhJ/6BW0YptXIcnqea3/i4WEcQuLW48yd/LMeV3AYQ7sNgkYcdB1/Ona3rF0llfQWcKx3KTQQpJP5gRjNIq5I2pnarA8E5zXN+M/8AkP2H+f4beuh8W/cl/wCv6x/9Ct6+ojgqPNB8vX9TwKmLq2lr/VmVfBeo3Wp3N35kttdwiKKWCW2V1yJJJVbIYnoyHFehY/eIUVgRk4J64xXj3wT/AOPD/txg/wDSm6r2j/lvH9G/pXlZzRjSxUoU1Zafkd+W1JVMPGcnr/wSs7MzvvUYJHUnsBx0P1qLyo2OAq8+h/8AsRU8vf8A3/8A2QVFF94V46PUGQyxbMvCTk5ByOnapfNtv+eB/MVVj/1Uf+6KdRyom5//2Q=="; locationMessageContent.setThumbnailByte(Base64.getDecoder().decode(thumbnailBase64edData)); locationMessageContent.setTitle("中国北京市海淀区阜成路北二街131号"); //设置经纬度 locationMessageContent.setLatitude(39.926537312885166); locationMessageContent.setLongitude(116.32154022158235); //消息转成Payload并发送 payload = locationMessageContent.encode(); resultSendMessage = MessageAdmin.sendMessage(sender, conversation, payload, null); checkSendMessageResult(resultSendMessage); //测试发送文件消息 FileMessageContent fileMessageContent = new FileMessageContent(); //设置文件名 fileMessageContent.setName("野火产品简介.pptx"); //设置文件大小 fileMessageContent.setSize(38394); //设置文件链接 fileMessageContent.setRemoteMediaUrl("https://media.wfcoss.cn/firechat/file_message_sample.pptx"); //消息转成Payload并发送 payload = fileMessageContent.encode(); resultSendMessage = MessageAdmin.sendMessage(sender, conversation, payload, null); checkSendMessageResult(resultSendMessage); //测试动态表情消息 StickerMessageContent stickerMessageContent = new StickerMessageContent(); stickerMessageContent.setWidth(753); stickerMessageContent.setHeight(960); stickerMessageContent.setRemoteMediaUrl("https://media.wfcoss.cn/firechat/sticker_message_sample.jpg"); //消息转成Payload并发送 payload = stickerMessageContent.encode(); resultSendMessage = MessageAdmin.sendMessage(sender, conversation, payload, null); checkSendMessageResult(resultSendMessage); //测试链接消息 LinkMessageContent linkMessageContent = new LinkMessageContent(); linkMessageContent.setTitle("野火IM开发手册"); linkMessageContent.setUrl("https://docs.wildfirechat.cn"); linkMessageContent.setThumbnailUrl("https://docs.wildfirechat.cn/favicon.ico"); linkMessageContent.setContentDigest("野火IM开发手册,关于野火的所有知识都在这里!"); //消息转成Payload并发送 payload = linkMessageContent.encode(); resultSendMessage = MessageAdmin.sendMessage(sender, conversation, payload, null); checkSendMessageResult(resultSendMessage); //测试名片消息 CardMessageContent cardMessageContent = new CardMessageContent(); //类型:0,用户;1,群组;2,聊天室;3,频道 cardMessageContent.setType(0); cardMessageContent.setTarget("FireRobot"); cardMessageContent.setName("FireRobot"); cardMessageContent.setPortrait("https://cdn2.wildfirechat.net/robot.png"); cardMessageContent.setDisplayName("小火"); cardMessageContent.setFrom(sender); //消息转成Payload并发送 payload = cardMessageContent.encode(); resultSendMessage = MessageAdmin.sendMessage(sender, conversation, payload, null); checkSendMessageResult(resultSendMessage); //测试提醒消息 TipNotificationMessageContent tipNotificationMessageContent = new TipNotificationMessageContent(); tipNotificationMessageContent.setTip("这是一个提醒小灰条消息"); //消息转成Payload并发送 payload = tipNotificationMessageContent.encode(); resultSendMessage = MessageAdmin.sendMessage(sender, conversation, payload, null); checkSendMessageResult(resultSendMessage); //测试富通知消息 RichNotificationMessageContent richNotificationMessageContent = new RichNotificationMessageContent("产品审核通知", "您好,您的SSL证书以审核通过并成功办理,请关注", "https://www.wildfirechat.cn") .remark("谢谢惠顾") .exName("证书小助手") .appId("1234567890") .addItem("登陆账户", "野火IM", "#173177") .addItem("产品名称", "域名wildifrechat.cn申请的免费SSL证书", "#173177") .addItem("审核通过", "通过", "#173177") .addItem("说明", "请登陆账户查看处理", "#173177"); //消息转成Payload并发送 payload = richNotificationMessageContent.encode(); resultSendMessage = MessageAdmin.sendMessage(sender, conversation, payload, null); checkSendMessageResult(resultSendMessage); //测试流式文本消息 testStreamingText(sender, conversation); } //消息相关表分为2类,分表是:t_messages_x和t_user_messages_y,并且是分表存储的。表内存储数据和分表规则请参考 https://docs.wildfirechat.cn/faq/server.html 问题2 /** * 消息分表计算测试 *

* 演示如何计算消息存储的分表名称: *

    *
  • 用户消息表:t_user_messages_x (x为用户ID哈希值%128)
  • *
  • 消息表:t_messages_y (y为年份*12+月份)
  • *
*

*/ static void testMessageSharding() { String userId = "user1"; // 计算用户消息表:使用用户ID的哈希值对128取模 int hashId = Math.abs(userId.hashCode())%128; String userMessageTable = "t_user_messages_" + hashId; System.out.println("user:" + userId + " user messages table is " + userMessageTable); // 计算消息表:使用年份和月份 Calendar calendar = Calendar.getInstance(); Date date = new Date(); calendar.setTime(date); int month = calendar.get(Calendar.MONTH); int year = calendar.get(Calendar.YEAR); year %= 3; String messageTable = "t_messages_" + (year * 12 + month); System.out.println("This month save message to table " + messageTable); } /** * 从数据库读取消息内容测试 *

* 演示如何从数据库的二进制数据解析消息内容: *

    *
  • 从数据库读取_messageContent字段
  • *
  • 解析为协议栈MessageContent对象
  • *
  • 使用MessageContentFactory解码为具体消息类型
  • *
  • 处理不同类型的消息(文本、图片、语音等)
  • *
*

* @throws Exception 当解析过程中发生错误时抛出异常 */ static void testReadMessageContentFromDB() throws Exception { //从数据库t_messages_x表中读取到消息内容字段_data的二进制数据为 byte[] data = {8,1,18,5,72,101,108,108,111,64,3}; //1. 先把二进制数据转化为协议栈消息内容。 WFCMessage.MessageContent protoContent = WFCMessage.MessageContent.parseFrom(data); //2. 调用MessageContentFactory接口解析为消息内容。 MessageContent messageContent = MessageContentFactory.decodeMessageContent(protoContent); //3. 检查是哪种消息,如果没有定义,会回落到UnknownMessageContent。自定义消息看本函数最后的注释。 if(messageContent instanceof TextMessageContent) { TextMessageContent txt = (TextMessageContent)messageContent; System.out.println("读取到的是文本消息,内容为:" + txt.getText()); } else if(messageContent instanceof ImageMessageContent) { ImageMessageContent img = (ImageMessageContent) messageContent; System.out.println("读取到的是图片消息,图片链接为:" + img.getRemoteMediaUrl()); } else if(messageContent instanceof SoundMessageContent) { SoundMessageContent sound = (SoundMessageContent) messageContent; System.out.println("读取到的是声音消息,声音链接为:" + sound.getRemoteMediaUrl()); } byte[] data2 = {8,3,18,8,91,-27,-101,-66,-25,-119,-121,93,42,-106,33,-1,-40,-1,-32,0,16,74,70,73,70,0,1,1,0,0,72,0,72,0,0,-1,-31,0,-128,69,120,105,102,0,0,77,77,0,42,0,0,0,8,0,5,1,18,0,3,0,0,0,1,0,1,0,0,1,26,0,5,0,0,0,1,0,0,0,74,1,27,0,5,0,0,0,1,0,0,0,82,1,40,0,3,0,0,0,1,0,2,0,0,-121,105,0,4,0,0,0,1,0,0,0,90,0,0,0,0,0,0,0,72,0,0,0,1,0,0,0,72,0,0,0,1,0,2,-96,2,0,4,0,0,0,1,0,0,0,120,-96,3,0,4,0,0,0,1,0,0,0,90,0,0,0,0,-1,-19,0,56,80,104,111,116,111,115,104,111,112,32,51,46,48,0,56,66,73,77,4,4,0,0,0,0,0,0,56,66,73,77,4,37,0,0,0,0,0,16,-44,29,-116,-39,-113,0,-78,4,-23,-128,9,-104,-20,-8,66,126,-1,-64,0,17,8,0,90,0,120,3,1,34,0,2,17,1,3,17,1,-1,-60,0,31,0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,16,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125,1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,-127,-111,-95,8,35,66,-79,-63,21,82,-47,-16,36,51,98,114,-126,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-125,-124,-123,-122,-121,-120,-119,-118,-110,-109,-108,-107,-106,-105,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58,-57,-56,-55,-54,-46,-45,-44,-43,-42,-41,-40,-39,-38,-31,-30,-29,-28,-27,-26,-25,-24,-23,-22,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-1,-60,0,31,1,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,17,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,119,0,1,2,3,17,4,5,33,49,6,18,65,81,7,97,113,19,34,50,-127,8,20,66,-111,-95,-79,-63,9,35,51,82,-16,21,98,114,-47,10,22,36,52,-31,37,-15,23,24,25,26,38,39,40,41,42,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-126,-125,-124,-123,-122,-121,-120,-119,-118,-110,-109,-108,-107,-106,-105,-104,-103,-102,-94,-93,-92,-91,-90,-89,-88,-87,-86,-78,-77,-76,-75,-74,-73,-72,-71,-70,-62,-61,-60,-59,-58,-57,-56,-55,-54,-46,-45,-44,-43,-42,-41,-40,-39,-38,-30,-29,-28,-27,-26,-25,-24,-23,-22,-14,-13,-12,-11,-10,-9,-8,-7,-6,-1,-37,0,67,0,7,7,7,7,7,7,12,7,7,12,17,12,12,12,17,23,17,17,17,17,23,30,23,23,23,23,23,30,36,30,30,30,30,30,30,36,36,36,36,36,36,36,36,43,43,43,43,43,43,50,50,50,50,50,56,56,56,56,56,56,56,56,56,56,-1,-37,0,67,1,9,9,9,14,13,14,25,13,13,25,59,40,33,40,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,59,-1,-35,0,4,0,8,-1,-38,0,12,3,1,0,2,17,3,17,0,63,0,-10,-105,36,113,72,-120,-60,-28,-43,67,116,17,-128,110,51,84,39,-15,5,-67,-76,-51,4,-118,119,41,80,49,-126,14,-29,-113,-49,-38,-67,7,-95,-58,107,94,95,-38,105,-42,-19,61,-53,-31,87,0,-128,50,121,-10,21,-25,45,-29,24,83,82,-70,-108,40,72,-99,48,27,119,-33,-37,-128,15,-79,-58,113,92,55,-118,-4,69,117,37,-52,-78,70,75,64,73,-17,-110,51,-39,-79,-45,25,3,-81,21,-64,92,11,-15,8,126,112,79,126,120,-4,51,92,115,-100,-37,-9,122,29,52,-24,74,105,-72,-90,-19,-65,-111,-35,-66,-69,61,-68,-53,58,42,-74,27,40,115,-100,1,-33,7,-127,-57,-91,83,58,-91,-68,-118,-17,104,29,100,35,-126,15,0,-6,-12,-19,-19,92,4,-113,118,-15,-94,-88,99,-22,15,92,-109,-40,119,-85,80,-36,62,37,-106,33,-60,100,29,-93,-48,-25,56,29,-64,-17,-51,115,52,-57,99,-83,77,98,-2,11,127,32,-50,-78,4,108,-126,-92,-110,119,117,-4,61,106,57,-17,93,-26,73,-29,-111,67,63,-16,-89,0,-12,-55,36,86,108,50,92,-56,-56,-118,-83,16,94,51,-73,-8,122,-125,-109,-127,-118,-93,20,-47,-68,-98,77,-72,43,-55,63,54,122,-46,72,71,71,113,114,-56,-65,56,42,-52,119,21,-58,1,-4,77,85,121,-30,114,55,124,-121,24,76,-13,-100,-5,-42,125,-36,-26,84,38,104,-39,-101,3,110,50,112,123,-3,69,101,-61,-26,93,72,-85,24,36,-81,60,123,125,105,-88,-36,-92,-101,-47,29,11,106,119,118,-73,94,76,39,115,47,-54,-85,-100,-125,-63,-12,-21,89,-15,60,-87,116,34,-108,5,12,-92,-85,12,17,-45,-7,118,53,89,-95,-119,51,113,43,48,-105,35,29,0,30,-60,99,53,-87,110,-10,-122,53,86,-61,73,-27,-107,100,28,6,-7,-117,103,-111,-12,-4,-86,-29,22,-12,71,68,48,-107,102,-38,81,45,44,75,4,108,-77,51,0,112,-7,92,-98,61,57,-29,62,-11,12,119,112,-63,112,-86,-79,-110,-96,-113,-108,31,76,-9,-21,89,119,87,119,22,-13,-20,0,5,-112,100,41,-29,0,-3,106,-60,55,114,-35,-121,72,16,-123,3,-25,96,6,6,61,-22,26,125,76,26,107,70,109,127,104,91,121,-93,-51,82,-117,-53,15,44,101,-78,121,-28,-6,-9,-87,63,-75,108,-1,0,-65,117,-7,-113,-2,38,-78,5,-12,-117,43,66,2,-56,-82,49,-114,-52,13,46,-47,-1,0,62,107,-2,127,26,66,63,-1,-48,-56,95,22,107,-47,76,100,-98,77,-15,18,119,70,-40,110,15,108,-29,-75,96,-99,73,-98,-19,-81,-28,33,-92,57,-7,-113,31,120,99,-74,51,-114,-43,-115,-2,-115,55,49,57,-114,83,-50,1,57,31,90,-123,-32,-77,-126,48,-9,-82,-46,-69,119,28,126,-107,-33,38,-102,62,-49,-22,-72,123,93,-46,-115,-97,94,-97,-25,-8,124,-55,-18,-60,74,-54,-81,-72,-122,31,46,14,20,-100,114,115,75,106,-126,62,-124,-111,-35,123,84,105,61,-100,80,18,-71,117,99,-64,39,63,-50,-102,99,-45,20,3,-27,21,99,-3,-46,113,-4,-21,37,8,-89,116,-48,-29,70,-115,39,120,114,-81,-101,-4,-6,-36,-110,107,56,102,64,-69,8,92,-16,65,-30,-95,58,109,-76,24,49,35,-79,-11,-49,122,122,36,24,-38,37,32,30,10,-25,-113,-64,-29,53,105,4,44,-83,22,91,110,49,77,66,45,90,-58,-79,-62,81,113,-65,-77,95,-121,-11,-9,-107,-30,104,-115,-69,70,11,68,-93,42,64,60,-29,61,50,122,85,120,-51,-91,-118,-77,8,-104,-18,60,100,-126,71,29,51,82,-91,-79,15,-78,89,126,78,78,11,-127,-102,-122,-14,-54,51,-123,15,-27,-10,1,-71,31,-104,-88,-27,-108,85,-30,-114,9,-48,-28,94,-46,-107,53,117,-67,-19,-7,108,53,-11,-105,-115,-119,94,-11,98,-33,83,-5,88,109,-31,35,10,57,36,-11,-51,103,-86,-39,-37,-87,-118,100,-13,14,70,73,-28,115,-23,-116,98,-81,75,13,-100,104,-47,-85,70,-86,-36,-116,113,-45,-90,105,-62,83,-21,35,76,36,-15,11,87,53,-90,-24,-74,-46,51,-57,-70,-44,-119,7,117,-64,-21,-8,-43,41,55,-78,-106,96,-84,-60,-29,10,14,127,17,82,91,52,83,-88,107,121,76,110,123,117,6,-97,63,-37,35,6,70,35,-53,-58,95,-41,-118,-87,67,-98,23,102,-72,-72,70,-67,46,119,-73,-106,-65,-16,73,13,-78,69,-120,-26,64,-27,120,59,-80,74,-25,-73,53,98,11,117,-74,-120,-61,110,-82,67,28,-100,100,-32,-12,-19,89,63,104,18,66,22,70,-37,-98,-125,-1,0,-78,-22,104,2,-30,-43,-116,-112,74,118,-16,91,60,-12,-10,-87,-25,-117,-39,19,46,88,-59,78,52,-44,-83,-41,77,63,95,-21,-95,-90,-17,-28,-87,38,108,-20,24,37,78,118,-9,-23,85,-65,-76,-109,-2,126,-37,-2,-7,-84,-24,110,-110,-32,52,-77,-56,16,-55,-14,-99,-96,127,42,119,-39,-20,-1,0,-25,-69,127,-33,20,70,73,-22,-1,0,-81,-60,-62,21,121,-30,-91,-93,-11,-73,-7,-97,-1,-47,-13,86,-79,-75,40,35,-73,115,-26,-89,44,-64,-11,-49,-46,-85,125,-102,-44,41,75,-103,76,-104,28,110,-32,-127,-11,-17,90,87,58,78,-105,115,23,-103,-89,-7,-16,-52,-68,50,-19,56,31,82,79,-14,-84,-56,116,-55,96,50,111,38,87,59,72,35,-8,122,-11,-21,-57,76,-41,76,-30,-87,62,68,-109,126,90,-2,7,-46,42,-12,-88,105,24,94,-2,119,-4,2,59,61,-118,69,-71,-115,-29,63,-34,31,49,63,94,-108,-65,-39,42,-101,101,46,-15,-106,28,-90,3,17,-97,66,15,79,-62,-84,105,-106,-42,8,-81,45,-35,-39,-118,80,-60,-58,0,-56,-29,-66,49,-36,-43,-58,-110,24,80,92,92,124,-15,0,72,116,31,51,30,-36,103,-16,53,-83,58,92,-16,114,106,-1,0,61,-65,83,120,60,53,106,124,-50,59,108,-81,-2,90,-94,-100,86,-10,-63,68,23,50,9,7,77,-92,108,97,-114,-107,24,123,13,61,-116,46,-122,76,-1,0,19,124,-57,-114,-39,-88,90,43,77,78,63,38,22,-39,34,100,-128,-4,16,62,-67,106,-76,122,92,-40,-112,76,1,25,-2,30,77,39,25,69,39,21,-13,-36,-47,86,-108,-26,-91,70,23,125,-9,94,-102,-105,62,-47,-89,92,98,55,80,57,-21,-45,21,19,105,-79,92,-60,69,-84,-67,121,33,-85,5,1,12,-5,65,96,50,-96,30,13,89,-77,55,48,-36,-84,123,-68,-73,110,-57,-80,-12,53,-50,-86,115,59,77,28,75,25,10,-14,-28,-81,78,-9,-46,-21,66,91,88,-34,-58,115,37,-64,84,32,-29,97,-50,72,-1,0,103,21,110,105,-19,100,119,-14,-32,50,116,-49,35,2,-75,-38,-40,-54,86,89,73,125,-71,-57,-29,89,-14,91,91,-93,-19,102,-7,67,18,-96,13,-68,-97,82,43,89,-63,-63,90,59,29,-33,83,-83,66,42,-99,36,-100,111,-42,-41,-11,-41,79,45,-118,70,-22,101,-128,45,-88,109,-96,-13,-14,-12,-4,106,-11,-117,106,18,6,102,37,83,56,33,-121,62,-72,-59,18,78,-52,60,-72,48,-101,57,-32,-16,5,53,-11,6,-56,-114,80,-24,-39,36,49,-23,-116,86,119,-77,-67,-54,-70,-93,37,41,77,-39,105,110,-97,-103,45,-59,-67,-75,-55,-40,96,5,-67,65,34,-85,65,113,119,106,-37,38,-121,100,99,-115,-67,-66,-72,21,104,-33,9,35,-61,-71,-34,-68,115,-42,-103,34,77,119,15,-109,-26,109,61,65,61,127,-3,85,-77,-9,-75,-114,-26,-14,81,-109,-10,-108,-2,47,43,107,-22,85,-69,-75,-114,85,23,69,25,85,-79,-73,-113,-61,53,71,-20,-53,-22,-1,0,-112,-85,34,-62,-11,-94,42,-78,-126,-47,-127,-104,-40,-15,-41,-11,-51,71,-10,13,75,-2,121,67,-7,10,-58,81,-109,119,72,-15,-85,-13,-44,-105,55,-78,-4,63,-32,-97,-1,-46,-13,-53,13,114,91,35,-10,75,-112,39,44,8,83,-72,-81,-25,88,-41,87,-9,-46,-53,44,-79,-110,9,-24,0,-57,-89,95,-89,52,-21,84,70,-69,73,-92,108,-128,-69,-79,-22,71,99,91,58,60,58,57,-55,-65,108,-17,-18,50,64,39,-81,0,-13,90,71,17,86,114,80,115,-75,-114,-72,87,-85,87,-106,28,-10,-79,-54,-120,-18,25,21,-101,57,-112,-112,8,25,28,-46,-108,-69,-45,-89,81,38,25,-41,35,25,-56,-28,127,47,122,-24,-18,-82,-30,-114,86,-122,-55,93,81,71,67,-45,32,-111,-59,103,-119,-29,-110,-15,-89,-68,-52,-127,8,5,71,0,-127,-98,-3,115,-8,-12,-84,-107,-31,61,31,-52,-59,94,19,-75,-2,102,91,106,-73,18,-50,110,66,-82,126,-18,20,118,62,-99,-21,98,-40,94,-36,-18,-107,-113,-106,79,56,60,26,-102,-2,-17,69,8,-115,-90,64,-48,48,35,119,-89,35,-97,-54,-85,-51,127,111,18,-119,-93,109,-57,-17,21,35,-97,-91,118,104,-92,-36,-27,115,-33,-53,-86,40,-13,58,-75,46,-105,103,-8,-108,46,26,72,-100,-61,49,8,1,-49,-103,-125,-55,-49,-75,72,-94,21,121,24,-111,113,-69,44,115,-4,38,-85,106,23,-81,-88,58,-92,41,-76,49,-63,81,-17,-45,-82,105,-15,66,-74,50,57,40,74,-80,-37,-13,99,-116,-5,15,-25,92,-13,-102,82,-45,83,25,-30,23,-75,115,-118,-26,-118,-47,62,-33,-89,-34,105,-36,61,-36,-74,-94,104,-2,93,-128,96,47,79,95,-89,-46,-79,30,-26,43,-56,-4,-94,88,73,-41,13,-22,43,-96,-74,-79,-13,-95,-35,110,-50,114,15,76,-112,-92,122,-109,-57,79,122,-82,-42,-47,90,50,-54,-48,-99,-29,-85,41,-56,97,-33,53,80,-124,90,-9,118,71,-93,44,52,-36,82,-125,-76,118,125,127,-90,99,-37,90,52,110,90,92,50,-80,-57,-45,-89,53,-46,13,-77,-62,98,-72,-37,-18,59,-2,29,64,-88,38,-110,-55,-128,84,-119,-103,-92,81,-54,-16,70,115,-40,125,42,33,29,-62,46,75,29,-67,113,-36,123,-43,-62,-47,-42,46,-24,48,-40,106,112,114,-10,111,-103,63,63,-52,-75,45,-51,-78,71,-77,-55,84,35,0,62,54,-25,-14,-88,-25,-127,-25,24,19,-124,100,-25,110,57,31,-115,82,-44,101,96,-79,-62,-49,-69,-52,112,9,35,-97,-62,-90,77,66,-35,34,-14,-68,-123,5,65,37,-13,-116,-116,-16,8,-18,77,85,74,-9,-109,-26,-74,-33,-46,-45,-11,50,-83,-116,-123,42,-114,-116,-74,-5,-65,34,101,-14,102,-37,4,-63,-69,41,101,-5,-39,53,103,-5,34,-57,-42,-21,-4,-1,0,-64,-85,58,-53,80,-118,-9,-27,-72,42,-123,72,0,-14,63,30,57,-83,93,-106,-65,-13,-14,-65,-101,-1,0,-123,77,-29,100,-1,0,-81,-55,-99,48,-115,42,-47,85,18,78,-3,-9,-3,79,-1,-45,-15,-21,23,-14,100,71,-36,-119,-126,71,29,-120,31,-105,62,-107,110,-22,-32,75,127,24,104,-64,117,114,14,-47,-63,-19,-7,-109,-102,-94,44,90,24,93,-104,-126,78,-48,-84,15,66,79,97,-34,-81,70,-41,66,8,-40,-51,-13,-79,101,14,-40,35,35,-96,-84,93,86,-109,-115,-12,99,-10,-110,80,113,79,70,71,-10,-95,21,-56,75,-114,55,2,-64,-29,-98,-71,-29,21,64,-54,-55,51,-112,114,-69,-65,-50,125,-22,-12,-13,93,67,20,65,-45,18,109,-53,62,57,-25,-116,126,85,9,-116,-35,-92,81,-64,-87,-70,71,9,-41,28,-109,-116,-12,-51,17,73,46,102,111,75,11,42,-111,109,110,-107,-19,-35,25,-116,38,-72,-112,-57,110,55,22,60,34,-114,107,-82,-71,-16,70,-89,97,100,117,27,-87,-93,-40,-120,29,-45,56,32,99,-98,-36,-6,87,79,-92,-8,50,-21,68,-65,77,64,-70,92,-128,8,-107,49,-125,-125,-35,79,63,-113,78,43,91,-59,86,23,-6,-83,-113,-40,-20,84,54,79,-52,-96,-10,-19,-109,-11,-81,14,-74,108,-99,104,66,-116,-105,47,86,118,-45,-64,56,83,-108,-22,45,86,-56,-14,81,119,-89,40,-60,112,-116,-102,-71,29,-11,-99,-36,98,63,41,11,3,-55,-50,56,-19,89,-73,122,61,-34,-97,4,-46,93,20,-114,72,24,41,-119,-114,28,-18,-18,7,112,43,30,-37,-9,99,121,60,-26,-66,-122,21,-7,-67,-24,-67,11,-114,109,82,30,-20,-30,-83,-38,-42,61,75,79,-15,89,-48,109,36,-79,-103,68,-119,-68,-108,35,7,4,-16,65,62,-107,-50,-49,126,13,-52,-123,-119,116,-105,59,123,40,-17,-113,74,-29,-26,121,-122,86,99,-50,112,63,15,74,-69,110,-78,-76,-53,110,-89,40,-1,0,120,-111,-114,-39,-3,43,10,88,120,83,-85,42,-76,-107,-100,-65,18,99,-103,-44,117,-81,75,110,-58,-68,122,-108,86,-52,85,99,-55,-24,74,-100,-126,42,97,124,-84,-54,-14,-126,-86,-5,-79,-113,110,59,-43,86,-46,-115,-86,-105,36,-107,117,-56,61,56,-1,0,10,-84,109,36,86,88,-2,-8,-19,-20,43,-90,115,-108,86,-89,125,124,86,50,-124,20,-102,-47,110,-122,94,93,-61,52,-63,8,-7,66,113,-20,77,107,-24,26,109,-107,-19,-67,-44,-6,-119,-35,-28,4,-62,2,67,124,-57,-17,113,-44,83,36,-48,-96,-108,11,-105,114,56,-28,-116,96,-29,-80,-9,-86,109,103,21,-116,-122,-26,-38,86,60,96,-125,-116,-13,88,-42,-90,-22,65,-72,-53,-18,103,11,-61,86,109,-30,-86,37,37,-42,-51,127,90,29,-50,-97,-32,109,34,72,87,81,-73,-68,47,-126,89,21,-64,-64,-10,96,122,-30,-75,63,-31,31,79,-7,-17,103,-1,0,126,-105,-4,107,-125,-99,110,46,32,99,52,-60,22,24,-38,56,-49,29,112,6,49,88,-65,-39,103,-2,123,31,-54,-72,99,-105,-30,-27,119,26,-38,122,35,-70,88,110,95,-126,-110,107,-44,-1,-44,-13,123,93,71,-20,-110,125,-110,24,-64,-114,66,62,87,64,114,6,49,-57,122,126,-96,-70,44,-54,-92,126,-23,-103,-65,-128,-31,65,-9,29,-65,-6,-43,63,-120,-29,-115,52,107,9,81,64,118,39,44,7,39,-123,-22,105,-34,50,-73,-73,-126,59,111,34,53,78,71,-35,0,127,42,-13,37,27,-54,50,78,-41,27,-111,-124,-41,70,24,-102,-40,5,126,-5,-2,-9,-32,61,-115,86,-122,-2,11,55,41,105,0,87,-49,-51,51,13,-51,-97,108,-16,63,42,-91,-109,-104,-1,0,-33,74,77,87,-115,70,112,56,27,-21,-82,75,-38,123,-78,-40,-42,-82,42,-91,75,41,61,-74,59,-117,79,28,95,91,-22,17,-67,-42,-39,-94,-115,112,-22,-68,100,17,-41,-36,-42,-107,-25,-114,-27,18,-57,115,-89,64,-47,69,-56,38,65,-61,125,49,94,88,-3,71,-46,-67,34,-11,87,-2,17,104,78,58,36,88,-3,43,-56,-60,-32,-80,-48,-100,27,-122,-6,29,-104,108,77,89,66,109,-53,101,115,-104,-42,-11,100,-44,-27,121,-27,2,89,92,12,30,-104,-64,-82,84,-87,76,-79,-83,9,6,6,71,-67,67,-128,65,4,127,14,107,-39,-93,77,66,10,49,-40,-13,-28,-36,-101,-109,-22,85,-56,108,-79,25,60,115,67,-51,32,-112,75,25,-6,122,86,-107,-96,31,107,-76,-29,-84,-117,-4,-59,117,94,55,-73,-73,-123,109,-28,-118,53,70,114,119,21,0,19,-64,-21,85,123,73,33,-58,26,115,34,19,-90,106,113,-23,73,-88,-4,-78,-58,-47,9,8,28,-74,-42,28,-28,31,-18,-1,0,-11,-22,27,79,15,-33,93,-92,119,-119,44,113,36,-54,118,-87,39,62,-64,-6,103,-82,107,-48,108,-128,-14,44,-41,-79,-119,65,30,-59,106,-124,0,8,96,3,-96,65,-113,-5,-28,87,-105,87,48,-97,44,-107,-74,53,-85,-118,-100,-96,-95,39,116,114,-42,-102,6,-84,44,-38,-3,-14,-78,-82,-19,-80,115,-69,104,56,63,-113,-73,122,-24,-20,-76,27,75,-115,37,-115,-14,126,-7,73,12,-92,109,101,-29,-127,-17,93,58,-13,51,19,-49,-56,63,-12,26,117,-40,2,-22,5,28,3,-73,-118,-27,-87,-118,-99,69,-55,123,117,-45,-14,46,-98,42,80,-89,-54,-11,87,-40,-15,91,49,-88,36,98,97,19,-51,110,9,80,14,72,61,122,96,-25,-114,-68,85,-49,-75,63,-4,-8,55,-27,47,-1,0,21,94,-77,-128,-77,58,-81,0,71,-48,125,106,58,-19,88,-35,90,-27,58,104,-54,73,114,-33,99,-1,-39,48,1,58,90,104,116,116,112,58,47,47,49,57,50,46,49,54,56,46,49,46,56,49,58,56,48,47,102,115,47,49,47,50,48,50,53,47,48,50,47,49,56,47,48,55,47,51,55,47,52,48,47,77,51,108,110,99,87,49,51,99,122,74,114,45,49,45,49,55,51,57,56,51,53,52,54,48,45,116,66,98,71,82,110,49,90,119,56,111,79,46,106,112,103,64,3}; protoContent = WFCMessage.MessageContent.parseFrom(data2); messageContent = MessageContentFactory.decodeMessageContent(protoContent); if(messageContent instanceof TextMessageContent) { TextMessageContent txt = (TextMessageContent)messageContent; System.out.println("读取到的是文本消息,内容为:" + txt.getText()); } else if(messageContent instanceof ImageMessageContent) { ImageMessageContent img = (ImageMessageContent) messageContent; System.out.println("读取到的是图片消息,图片链接为:" + img.getRemoteMediaUrl()); } else if(messageContent instanceof SoundMessageContent) { SoundMessageContent sound = (SoundMessageContent) messageContent; System.out.println("读取到的是声音消息,声音链接为:" + sound.getRemoteMediaUrl()); } // 问题:MessageContentFactory是如何找到消息的? // 答:MessageContentFactory在启动时会扫描自己的包cn.wildfirechat.sdk.messagecontent下的所有MessageContent子类,记住子类和消息类型的对应关系。 // 问题:自定义消息如何添加到MessageContentFactory中? // 答:首先自定义消息需要继承MessageContent,然后有2个选择,1是放到此SDK的cn.wildfirechat.sdk.messagecontent包下打包SDK;2是调用MessageContentFactory中的registerCustomMessageContent方法手动关联。 // 比如 MessageContentFactory.registerCustomMessageContent(CustomTextMessageContent.class); } /** * 检查消息发送结果 *

* 验证消息是否发送成功,如果失败则退出程序。 *

* @param resultSendMessage 消息发送结果 */ static void checkSendMessageResult(IMResult resultSendMessage) { if (resultSendMessage != null && resultSendMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("send message success"); } else { System.out.println("send message failure"); System.exit(-1); } } /** * 流式文本消息测试 *

* 演示如何发送流式文本消息,模拟AI逐字生成效果: *

    *
  • 将长文本分段发送
  • *
  • 使用StreamTextGeneratingMessageContent表示正在生成
  • *
  • 使用StreamTextGeneratedMessageContent表示生成完成
  • *
*

* @param sender 发送者用户ID * @param conversation 会话对象 * @throws Exception 当发送过程中发生错误时抛出异常 */ static void testStreamingText(String sender, Conversation conversation) throws Exception { // 准备要发送的长文本 String fullText = "北京野火无限网络科技有限公司是成立于2019年底的一家科技创新企业,公司的主要目标是为广大企业和单位提供优质可控、私有部署的即时通讯和实时音视频能力,为社会信息化水平提高作出自己的贡献。\n" + "\n" + "野火IM是公司研发一套自主可控的即时通讯组件,具有全部私有化、功能齐全、协议稳定可靠、全平台支持、安全性高和支持国产化等技术特点。客户端分层设计,既可开箱即用,也可与现有系统深度融合。具有完善的服务端API和自定义消息功能,可以任意扩展功能。代码开源率高,方便二次开发和使用。支持多人实时音视频和会议功能,线上沟通更通畅。\n" + "\n" + "公司致力于开源项目,在Github上开源项目广受好评,其中Server项目有超过7.1K个Star,组织合计Star超过1万个。有大量的技术公司受益于我们的开源,为自己的产品添加了即时通讯能力,这也算是我们公司为社会信息化建设做出的一点点贡献吧。\n" + "\n" + "公司以即时通讯技术为核心,持续努力优化和完善即时通讯和实时音视频产品,努力为客户提供最优质的即时通讯和实时音视频能力。"; int i = 0; String streamId = UUID.randomUUID().toString(); while (i < fullText.length()) { i+= 15; boolean finish = i >= fullText.length(); String partText = finish?fullText:fullText.substring(0, i); MessageContent messageContent; if(finish) { messageContent = new StreamTextGeneratedMessageContent(partText, streamId); } else { messageContent = new StreamTextGeneratingMessageContent(partText, streamId); } //消息转成Payload并发送 MessagePayload payload = messageContent.encode(); IMResult resultSendMessage = MessageAdmin.sendMessage(sender, conversation, payload, null); if (resultSendMessage != null && resultSendMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("send message success"); } else { System.out.println("send message failure"); System.exit(-1); } Thread.sleep(500); } } //*********************************************** //**** 测试频道功能 //*********************************************** /** * 频道管理API测试 *

* 测试以下功能: *

    *
  • 创建频道
  • *
  • 获取频道信息
  • *
  • 关注频道
  • *
  • 取消关注频道
  • *
  • 检查用户关注状态
  • *
  • 销毁频道(标记为已删除状态)
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testChannelApi() throws Exception { String channelName = "MyChannel"; String channelOwner = "user1"; InputCreateChannel inputCreateChannel = new InputCreateChannel(); inputCreateChannel.setName(channelName); inputCreateChannel.setOwner(channelOwner); IMResult resultCreateChannel = ChannelAdmin.createChannel(inputCreateChannel); if (resultCreateChannel != null && resultCreateChannel.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("success"); inputCreateChannel.setTargetId(resultCreateChannel.result.getTargetId()); } else { System.out.println("create channel failure"); System.exit(-1); } IMResult resultGetChannel = ChannelAdmin.getChannelInfo(inputCreateChannel.getTargetId()); if(resultGetChannel != null && resultGetChannel.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && resultGetChannel.getResult().getName().equals(channelName) && resultGetChannel.getResult().getOwner().equals(channelOwner)) { System.out.println("success"); } else { System.out.println("get channel failure"); System.exit(-1); } String subscriber = "aaa"; IMResult voidIMResult = ChannelAdmin.subscribeChannel(inputCreateChannel.getTargetId(), subscriber); if(voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("subscribeChannel success"); } else { System.out.println("subscriber channel failure"); System.exit(-1); } Thread.sleep(100); IMResult booleanIMResult = ChannelAdmin.isUserSubscribedChannel(subscriber, inputCreateChannel.getTargetId()); if(booleanIMResult != null && booleanIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && booleanIMResult.getResult().value) { System.out.println("subscribe status is correct"); } else { System.out.println("subscribe status is incorrect"); System.exit(-1); } voidIMResult = ChannelAdmin.unsubscribeChannel(inputCreateChannel.getTargetId(), subscriber); if(voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("unsubscribeChannel success"); } else { System.out.println("unsubscriber channel failure"); System.exit(-1); } Thread.sleep(100); booleanIMResult = ChannelAdmin.isUserSubscribedChannel(subscriber, inputCreateChannel.getTargetId()); if(booleanIMResult != null && booleanIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && !booleanIMResult.getResult().value) { System.out.println("subscribe status is correct"); } else { System.out.println("subscribe status is incorrect"); System.exit(-1); } voidIMResult = ChannelAdmin.destroyChannel(inputCreateChannel.getTargetId()); if(voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("success"); } else { System.out.println("destroy channel failure"); System.exit(-1); } resultGetChannel = ChannelAdmin.getChannelInfo(inputCreateChannel.getTargetId()); if(resultGetChannel != null && resultGetChannel.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && (resultGetChannel.getResult().getState() & ProtoConstants.ChannelState.Channel_State_Mask_Deleted) > 0) { System.out.println("success"); } else { System.out.println("get channel failure"); System.exit(-1); } } //*********************************************** //**** 一些其它的功能,比如创建频道,更新用户设置等 //*********************************************** /** * 通用API测试 *

* 测试以下功能: *

    *
  • 获取系统设置(如群组最大成员数)
  • *
  • 修改用户设置
  • *
  • 发送用户设置
  • *
  • 获取用户设置
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testGeneralApi() throws Exception { IMResult resultGetSystemSetting = GeneralAdmin.getSystemSetting(Group_Max_Member_Count); if (resultGetSystemSetting != null && resultGetSystemSetting.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("success"); } else { System.out.println("get system setting failure"); System.exit(-1); } IMResult resultSetSystemSetting = GeneralAdmin.setSystemSetting(Group_Max_Member_Count, "2000", "最大群人数为2000"); if (resultSetSystemSetting != null && resultSetSystemSetting.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("success"); } else { System.out.println("get system setting failure"); System.exit(-1); } resultGetSystemSetting = GeneralAdmin.getSystemSetting(Group_Max_Member_Count); if (resultGetSystemSetting != null && resultGetSystemSetting.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && resultGetSystemSetting.getResult().value.equals("2000")) { System.out.println("success"); } else { System.out.println("get system setting failure"); System.exit(-1); } IMResult health = GeneralAdmin.healthCheck(); if(health != null && health.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println(health.result); } else { System.out.println("health check failure"); System.exit(-1); } //测试用户设置功能 IMResult setUserSettingResult = GeneralAdmin.setUserSetting("user1", 1, "test_key", "test_value"); if (setUserSettingResult != null && setUserSettingResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set user setting success"); } else { System.out.println("set user setting failure"); System.exit(-1); } IMResult getUserSettingResult = GeneralAdmin.getUserSetting("user1", 1, "test_key"); if (getUserSettingResult != null && getUserSettingResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && "test_value".equals(getUserSettingResult.getResult().getValue())) { System.out.println("get user setting success"); } else { System.out.println("get user setting failure"); System.exit(-1); } if (commercialServer) { //测试会话置顶功能 IMResult setTopResult = GeneralAdmin.setConversationTop("user1", ProtoConstants.ConversationType.ConversationType_Private, "user2", 0, true); if (setTopResult != null && setTopResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set conversation top success"); } else { System.out.println("set conversation top failure"); System.exit(-1); } Thread.sleep(1000); IMResult getTopResult = GeneralAdmin.getConversationTop("user1", ProtoConstants.ConversationType.ConversationType_Private, "user2", 0); if (getTopResult != null && getTopResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && getTopResult.getResult()) { System.out.println("get conversation top success"); } else { System.out.println("get conversation top failure"); System.exit(-1); } //取消置顶 setTopResult = GeneralAdmin.setConversationTop("user1", ProtoConstants.ConversationType.ConversationType_Private, "user2", 0, false); if (setTopResult != null && setTopResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("cancel conversation top success"); } else { System.out.println("cancel conversation top failure"); System.exit(-1); } //测试获取会话文件 IMResult getConversationFilesResult = GeneralAdmin.getConversationFiles(ProtoConstants.ConversationType.ConversationType_Private, "user2", 0, "user1", 0, true, 10); if (getConversationFilesResult != null && getConversationFilesResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get conversation files success"); } else { System.out.println("get conversation files failure"); } //测试获取用户文件 IMResult getUserFilesResult = GeneralAdmin.getUserFiles("user1", 0, true, 10); if (getUserFilesResult != null && getUserFilesResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get user files success"); } else { System.out.println("get user files failure"); } //测试获取单个文件信息 if (getUserFilesResult.getResult() != null && getUserFilesResult.getResult().files != null && !getUserFilesResult.getResult().files.isEmpty()) { long messageId = getUserFilesResult.getResult().files.get(0).messageId; IMResult getFileResult = GeneralAdmin.getFile(messageId); if (getFileResult != null && getFileResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get file success"); } else { System.out.println("get file failure"); } } } } /** * 聊天室管理API测试 *

* 测试以下功能: *

    *
  • 创建聊天室
  • *
  • 获取聊天室信息
  • *
  • 获取聊天室成员列表
  • *
  • 销毁聊天室
  • *
  • 获取用户的聊天室
  • *
  • 设置聊天室黑名单(仅商业版)
  • *
  • 获取聊天室黑名单(仅商业版)
  • *
  • 发送聊天室消息
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testChatroom() throws Exception { String chatroomId = "chatroomId1"; String chatroomTitle = "TESTCHATROM"; String chatroomDesc = "this is a test chatroom"; String chatroomPortrait = "http://pic.com/test123.png"; String chatroomExtra = "{\'managers:[\"user1\",\"user2\"]}"; IMResult chatroomIMResult = ChatroomAdmin.createChatroom(chatroomId,chatroomTitle, chatroomDesc, chatroomPortrait,chatroomExtra,ProtoConstants.ChatroomState.Chatroom_State_Normal); if (chatroomIMResult != null && chatroomIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && chatroomIMResult.getResult().getChatroomId().equals(chatroomId)) { System.out.println("create chatroom success"); } else { System.out.println("create chatroom failure"); System.exit(-1); } IMResult getChatroomInfoIMResult = ChatroomAdmin.getChatroomInfo(chatroomId); if (getChatroomInfoIMResult != null && getChatroomInfoIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { if (!getChatroomInfoIMResult.getResult().getChatroomId().equals(chatroomId) || !getChatroomInfoIMResult.getResult().getTitle().equals(chatroomTitle) || !getChatroomInfoIMResult.getResult().getDesc().equals(chatroomDesc) || !getChatroomInfoIMResult.getResult().getPortrait().equals(chatroomPortrait) || !getChatroomInfoIMResult.getResult().getExtra().equals(chatroomExtra) || getChatroomInfoIMResult.getResult().getState() != ProtoConstants.ChatroomState.Chatroom_State_Normal) { System.out.println("chatroom info incorrect"); System.exit(-1); } else { System.out.println("chatroom info correct"); } } else { System.out.println("get chatroom info failure"); System.exit(-1); } IMResult memberList = ChatroomAdmin.getChatroomMembers(chatroomId); if (memberList != null && memberList.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get chatroom member success"); } else { System.out.println("get chatroom member failure: " + memberList.getErrorCode().msg); } IMResult voidIMResult = ChatroomAdmin.destroyChatroom(chatroomId); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("destroy chatroom done!"); } else { System.out.println("destroy chatroom failure"); System.exit(-1); } Thread.sleep(1000); getChatroomInfoIMResult = ChatroomAdmin.getChatroomInfo(chatroomId); if (getChatroomInfoIMResult != null && getChatroomInfoIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && getChatroomInfoIMResult.getResult().getState() == ProtoConstants.ChatroomState.Chatroom_State_End) { System.out.println("chatroom destroyed!"); } else { System.out.println("chatroom not destroyed!"); System.exit(-1); } IMResult userChatroomIMResult = ChatroomAdmin.getUserChatroom("uygqmws2k"); if(userChatroomIMResult != null && (userChatroomIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS || userChatroomIMResult.getErrorCode() == ErrorCode.ERROR_CODE_NOT_EXIST)) { System.out.println("get user chatroom success"); } else { System.out.println("get user chatroom failure"); System.exit(-1); } //测试设置聊天室全局禁言 IMResult setChatroomMuteResult = ChatroomAdmin.setChatroomMute(chatroomId, true); if (setChatroomMuteResult != null && setChatroomMuteResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set chatroom mute success"); } else { System.out.println("set chatroom mute failure"); System.exit(-1); } //取消聊天室全局禁言 setChatroomMuteResult = ChatroomAdmin.setChatroomMute(chatroomId, false); if (setChatroomMuteResult != null && setChatroomMuteResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("cancel chatroom mute success"); } else { System.out.println("cancel chatroom mute failure"); System.exit(-1); } //下面仅专业版支持 if(commercialServer) { //设置用户聊天室黑名单。0正常;1禁言;2禁止加入。 IMResult voidIMResult1 = ChatroomAdmin.setChatroomBlacklist("chatroom1", "oto9o9__", 1); if (voidIMResult1 != null && voidIMResult1.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("add chatroom black success"); } else { System.out.println("add chatroom black failure"); System.exit(-1); } //获取聊天室黑名单 IMResult blackInfos = ChatroomAdmin.getChatroomBlacklist("chatroom1"); if (blackInfos != null && blackInfos.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && !blackInfos.getResult().infos.isEmpty()) { boolean success = false; for (OutputChatroomBlackInfos.OutputChatroomBlackInfo info : blackInfos.getResult().infos) { if (info.userId.equals("oto9o9__")) { success = true; break; } } if (success) { System.out.println("add chatroom black success"); } else { System.out.println("add chatroom black failure"); System.exit(-1); } } else { System.out.println("add chatroom black failure"); System.exit(-1); } //取消用户聊天室黑名单。0正常;1禁言;2禁止加入。 voidIMResult1 = ChatroomAdmin.setChatroomBlacklist("chatroom1", "oto9o9__", 0); if (voidIMResult1 != null && voidIMResult1.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("remove chatroom black success"); } else { System.out.println("remove chatroom black failure"); System.exit(-1); } //获取聊天室黑名单 blackInfos = ChatroomAdmin.getChatroomBlacklist("chatroom1"); if (blackInfos != null && blackInfos.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { boolean success = true; for (OutputChatroomBlackInfos.OutputChatroomBlackInfo info : blackInfos.getResult().infos) { if (info.userId.equals("oto9o9__")) { success = false; break; } } if (success) { System.out.println("remove chatroom black success"); } else { System.out.println("remove chatroom black failure"); System.exit(-1); } } else { System.out.println("remove chatroom black failure"); System.exit(-1); } //设置聊天室管理员 IMResult voidIMResult2 = ChatroomAdmin.setChatroomManager("chatroom1", "UserId1", 1); if (voidIMResult2 != null && voidIMResult2.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("add chatroom manager success"); } else { System.out.println("add chatroom black failure"); System.exit(-1); } //获取聊天室管理员 IMResult managers = ChatroomAdmin.getChatroomManagerList("chatroom1"); if (managers != null && managers.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && !managers.getResult().getList().isEmpty() && managers.getResult().getList().contains("UserId1")) { System.out.println("add chatroom black success"); } else { System.out.println("add chatroom black failure"); System.exit(-1); } //取消聊天室管理员 IMResult voidIMResult3 = ChatroomAdmin.setChatroomManager("chatroom1", "UserId1", 0); if (voidIMResult3 != null && voidIMResult3.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("add chatroom manager success"); } else { System.out.println("add chatroom black failure"); System.exit(-1); } //获取聊天室管理员 IMResult managers2 = ChatroomAdmin.getChatroomManagerList("chatroom1"); if (managers2 != null && managers2.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && !managers2.getResult().getList().contains("UserId1")) { System.out.println("add chatroom black success"); } else { System.out.println("add chatroom black failure"); System.exit(-1); } } } /** * 机器人功能测试 *

* 测试以下功能: *

    *
  • 创建机器人
  • *
  • 初始化RobotService(使用IM端口80)
  • *
  • 获取机器人信息
  • *
  • 发送消息
  • *
  • 撤回消息(仅商业版)
  • *
  • 更新消息(仅商业版)
  • *
  • 获取用户信息
  • *
  • 创建群组
  • *
  • 发送群组消息
  • *
  • 获取群组信息
  • *
  • 获取群组成员
  • *
  • 修改群组信息
  • *
  • 添加群成员
  • *
  • 踢出群成员
  • *
  • 退出群组
  • *
  • 解散群组
  • *
  • 销毁机器人
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testRobot() throws Exception { String robotId = "robot1"; String robotSecret = "123456"; //初始化服务API AdminConfig.initAdmin(AdminUrl, AdminSecret); //创建机器人 InputCreateRobot createRobot = new InputCreateRobot(); createRobot.setUserId(robotId); createRobot.setName(robotId); createRobot.setDisplayName("机器人"); createRobot.setOwner("userId1"); createRobot.setSecret(robotSecret); createRobot.setCallback("http://127.0.0.1:8883/robot/recvmsg"); IMResult resultCreateRobot = UserAdmin.createRobot(createRobot); if (resultCreateRobot != null && resultCreateRobot.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Create robot " + resultCreateRobot.getResult().getUserId() + " success"); } else { System.out.println("Create robot failure"); System.exit(-1); } //使用完需要释放 RobotService robotService = new RobotService(IMUrl, robotId, robotSecret); //*********************************************** //**** 机器人API //*********************************************** IMResult robotProfileIMResult = robotService.getProfile(); if(robotProfileIMResult != null && robotProfileIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get profile success"); } else { System.out.println("get profile failure"); System.exit(-1); } String displayName = "testrobot"+System.currentTimeMillis(); IMResult voidIMResult1 = robotService.updateProfile(Modify_DisplayName, displayName); if(voidIMResult1 != null && voidIMResult1.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("modify profile success"); } else { System.out.println("modify profile failure"); System.exit(-1); } robotProfileIMResult = robotService.getProfile(); if(robotProfileIMResult != null && robotProfileIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && displayName.equals(robotProfileIMResult.getResult().getDisplayName())) { System.out.println("get profile success"); } else { System.out.println("get profile failure"); System.exit(-1); } String robotCallback = "http://hellow123"; voidIMResult1 = robotService.setCallback(robotCallback); if(voidIMResult1 != null && voidIMResult1.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set callback success"); } else { System.out.println("set callback failure"); System.exit(-1); } IMResult callbackPojoIMResult = robotService.getCallback(); if(callbackPojoIMResult != null && callbackPojoIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && robotCallback.equals(callbackPojoIMResult.getResult().getUrl())) { System.out.println("get callback success"); } else { System.out.println("get callback failure"); System.exit(-1); } //测试删除机器人回调地址 voidIMResult1 = robotService.deleteCallback(); if(voidIMResult1 != null && voidIMResult1.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("delete callback success"); } else { System.out.println("delete callback failure"); System.exit(-1); } //验证回调地址已删除 callbackPojoIMResult = robotService.getCallback(); if(callbackPojoIMResult != null && callbackPojoIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && StringUtil.isNullOrEmpty(callbackPojoIMResult.getResult().getUrl())) { System.out.println("get callback success"); } else { System.out.println("get callback failure"); System.exit(-1); } //创建会话对象,设置目标用户和会话类型 Conversation conversation = new Conversation(); conversation.setTarget("user2"); conversation.setType(ProtoConstants.ConversationType.ConversationType_Private); //创建消息payload,设置消息类型和内容 MessagePayload payload = new MessagePayload(); payload.setType(1); payload.setSearchableContent("hello world"); //测试机器人发送消息 IMResult resultRobotSendMessage = robotService.sendMessage(robotService.getRobotId(), conversation, payload); if (resultRobotSendMessage != null && resultRobotSendMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("robot send message success"); } else { System.out.println("robot send message failure"); System.exit(-1); } //测试机器人回复消息 IMResult replyMessageResult = robotService.replyMessage(resultRobotSendMessage.getResult().getMessageUid(), payload, false); if (replyMessageResult != null && replyMessageResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("robot reply message success"); } else { System.out.println("robot reply message failure"); } if(commercialServer) { Thread.sleep(1000); IMResult recallMessageResult = robotService.recallMessage(resultRobotSendMessage.result.getMessageUid()); if (recallMessageResult != null && recallMessageResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("robot recall message success"); } else { System.out.println("robot recall message failure"); System.exit(-1); } payload.setSearchableContent("hello world, hello world"); resultRobotSendMessage = robotService.sendMessage(robotService.getRobotId(), conversation, payload); if (resultRobotSendMessage != null && resultRobotSendMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("robot send message success"); } else { System.out.println("robot send message failure"); System.exit(-1); } Thread.sleep(1000); payload.setSearchableContent("hello world, updated message content"); IMResult updateMessageResult = robotService.updateMessage(resultRobotSendMessage.result.getMessageUid(), payload); if (updateMessageResult != null && updateMessageResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("robot update message success"); } else { System.out.println("robot update message failure"); System.exit(-1); } } //测试机器人通过用户ID获取用户信息 IMResult resultRobotGetUserInfo = robotService.getUserInfo("userId1"); if (resultRobotGetUserInfo != null && resultRobotGetUserInfo.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("robot get user info success"); } else { System.out.println("robot get user info by userId failure"); System.exit(-1); } //测试机器人通过手机号获取用户信息 IMResult resultRobotGetUserInfoByMobile = robotService.getUserInfoByMobile("13900000000"); if (resultRobotGetUserInfoByMobile != null && resultRobotGetUserInfoByMobile.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("robot get user info by mobile success"); } else { System.out.println("robot get user info by mobile failure"); } //测试机器人通过用户名获取用户信息 IMResult resultRobotGetUserInfoByName = robotService.getUserInfoByName("user1"); if (resultRobotGetUserInfoByName != null && resultRobotGetUserInfoByName.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("robot get user info by name success"); } else { System.out.println("robot get user info by name failure"); } //创建群组信息,用于测试机器人群组管理功能 String groupId = "robot_group" + System.currentTimeMillis(); PojoGroupInfo groupInfo = new PojoGroupInfo(); groupInfo.setTarget_id(groupId); groupInfo.setName("test_group"); groupInfo.setType(2); groupInfo.setExtra("hello extra"); groupInfo.setPortrait("http://portrait"); List members = new ArrayList<>(); PojoGroupMember member1 = new PojoGroupMember(); member1.setMember_id("user1"); members.add(member1); PojoGroupMember member2 = new PojoGroupMember(); member2.setMember_id("user2"); members.add(member2); PojoGroupMember member3 = new PojoGroupMember(); member3.setMember_id("user3"); members.add(member3); //测试机器人创建群组 IMResult resultCreateGroup = robotService.createGroup(groupInfo, members, null, null, null); if (resultCreateGroup != null && resultCreateGroup.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("create group success"); } else { System.out.println("create group failure"); System.exit(-1); } IMResult resultGetGroupInfo = robotService.getGroupInfo(groupInfo.getTarget_id()); if (resultGetGroupInfo != null && resultGetGroupInfo.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { if (groupInfo.getExtra().equals(resultGetGroupInfo.getResult().getExtra()) && groupInfo.getName().equals(resultGetGroupInfo.getResult().getName()) && robotId.equals(resultGetGroupInfo.getResult().getOwner())) { System.out.println("get group success"); } else { System.out.println("group info is not expected"); System.exit(-1); } } else { System.out.println("create group failure"); System.exit(-1); } IMResult voidIMResult = robotService.modifyGroupInfo(groupInfo.getTarget_id(), ProtoConstants.ModifyGroupInfoType.Modify_Group_Name,"HelloWorld", null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("modify group success"); } else { System.out.println("modify group failure"); System.exit(-1); } IMResult resultGetMembers = robotService.getGroupMembers(groupInfo.getTarget_id()); if (resultGetMembers != null && resultGetMembers.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get group member success"); } else { System.out.println("get group member failure"); System.exit(-1); } PojoGroupMember m = new PojoGroupMember(); m.setMember_id("user0"); m.setAlias("hello user0"); voidIMResult = robotService.addGroupMembers(groupInfo.getTarget_id(), Arrays.asList(m), null, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("add group member success"); } else { System.out.println("add group member failure"); System.exit(-1); } IMResult groupMemberIMResult = robotService.getGroupMember(groupInfo.getTarget_id(), "user0"); if (groupMemberIMResult != null && groupMemberIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get group member success"); } else { System.out.println("get group member failure"); System.exit(-1); } voidIMResult = robotService.kickoffGroupMembers(groupInfo.getTarget_id(), Arrays.asList("user3"), null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("kickoff group member success"); } else { System.out.println("kickoff group member failure"); System.exit(-1); } voidIMResult = robotService.setGroupMemberAlias(groupInfo.getTarget_id(), "user2", "test user2", null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set group member alias success"); } else { System.out.println("set group member alias failure"); System.exit(-1); } //测试设置群成员extra voidIMResult = robotService.setGroupMemberExtra(groupInfo.getTarget_id(), "user2", "robot member extra", null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set group member extra success"); } else { System.out.println("set group member extra failure"); System.exit(-1); } if(commercialServer) { PojoGroupMember m4 = new PojoGroupMember(); m4.setMember_id("user4"); m4.setAlias("hello user4"); PojoGroupMember m5 = new PojoGroupMember(); m5.setMember_id("user5"); m5.setAlias("hello user5"); voidIMResult = robotService.addGroupMembers(groupInfo.getTarget_id(), Arrays.asList(m4, m5), null, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("add group member success"); } else { System.out.println("add group member failure"); System.exit(-1); } voidIMResult = robotService.setGroupManager(groupInfo.getTarget_id(), Arrays.asList("user4", "user5"), true, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("set group manager success"); } else { System.out.println("set group manager failure"); System.exit(-1); } voidIMResult = robotService.setGroupManager(groupInfo.getTarget_id(), Arrays.asList("user4", "user5"), false, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("cancel group manager success"); } else { System.out.println("cancel group manager failure"); System.exit(-1); } //测试机器人应用获取用户信息。authCode应该是从客户端SDK里获取到的,这里不具备条件,跳过测试 // IMResult appGetUserInfoResult = robotService.applicationGetUserInfo("test_auth_code"); // if (appGetUserInfoResult != null && (appGetUserInfoResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS || appGetUserInfoResult.getErrorCode() == ErrorCode.ERROR_CODE_INVALID_DATA)) { // System.out.println("robot application get user info success"); // } else { // System.out.println("robot application get user info failure"); // } //测试机器人发送会议请求。不具备测试条件,注释掉。 // IMResult sendConferenceRequestResult = robotService.sendConferenceRequest(robotId, "client1", "test_request", 1, "room1", "test_data", false); // if (sendConferenceRequestResult != null && (sendConferenceRequestResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS || sendConferenceRequestResult.getErrorCode() == ErrorCode.ERROR_CODE_INVALID_DATA)) { // System.out.println("robot send conference request success"); // } else { // System.out.println("robot send conference request failure"); // } OutputApplicationConfigData config = robotService.getApplicationSignature(); System.out.println(config); } //仅专业版支持 if (commercialServer) { //开启群成员禁言 voidIMResult = robotService.muteGroupMember(groupInfo.getTarget_id(), Arrays.asList("user5"), true, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mute group member success"); } else { System.out.println("mute group member failure"); System.exit(-1); } //关闭群成员禁言 voidIMResult = robotService.muteGroupMember(groupInfo.getTarget_id(), Arrays.asList("user5"), false, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("unmute group member success"); } else { System.out.println("unmute group member failure"); System.exit(-1); } //开启群成员白名单,当群全局禁言时,白名单用户可以发言 voidIMResult = robotService.allowGroupMember(groupInfo.getTarget_id(), Arrays.asList("user5"), true, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("allow group member success"); } else { System.out.println("allow group member failure"); System.exit(-1); } //关闭群成员白名单 voidIMResult = robotService.allowGroupMember(groupInfo.getTarget_id(), Arrays.asList("user5"), false, null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("unallow group member success"); } else { System.out.println("unallow group member failure"); System.exit(-1); } } //测试机器人转让群组给user2 voidIMResult = robotService.transferGroup(groupInfo.getTarget_id(), "user2", null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("transfer success"); } else { System.out.println("create group failure"); System.exit(-1); } //验证群组转让成功,检查新群主是否为user2 resultGetGroupInfo = robotService.getGroupInfo(groupInfo.getTarget_id()); if (resultGetGroupInfo != null && resultGetGroupInfo.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { if ("user2".equals(resultGetGroupInfo.getResult().getOwner())) { groupInfo.setOwner("user2"); } else { System.out.println("group info is not expected"); System.exit(-1); } } else { System.out.println("create group failure"); System.exit(-1); } //测试机器人退出群组 voidIMResult = robotService.quitGroup(groupInfo.getTarget_id(), null, null); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("quit group success"); } else { System.out.println("quit group failure"); System.exit(-1); } //仅专业版支持,且服务器端支持朋友圈 if (robotMomentsEnabled) { IMResult postResult = robotService.postMomentsFeed(ProtoConstants.MomentsContentType.Moments_Content_Text_Type, "hello from robot", null, null, null, null, "hello_extra"); if (postResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("post moments feed success"); } else { System.out.println("post moments feed failure:" + postResult.getErrorCode().code); System.exit(-1); } IMResult pullResult = robotService.getMomentsFeeds(0, 10, null); if (pullResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("pull moments feeds success"); } else { System.out.println("pull moments feeds failure:" + pullResult.getErrorCode().code); System.exit(-1); } IMResult feedResult = robotService.getMomentsFeed(postResult.getResult().feedId); if (feedResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("pull moments one feed success"); } else { System.out.println("pull moments one feed failure:" + feedResult.getErrorCode().code); System.exit(-1); } IMResult commentThumbUpResult = robotService.postMomentsComment(postResult.result.feedId, 0, ProtoConstants.MomentsCommentType.Moments_Comment_Thumbup_Type, null, null, null); if (commentThumbUpResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("post moments thumb up success"); } else { System.out.println("post moments thumb up failure:" + commentThumbUpResult.getErrorCode().code); System.exit(-1); } IMResult commentTextResult = robotService.postMomentsComment(postResult.result.feedId, 0, ProtoConstants.MomentsCommentType.Moments_Comment_Text_Type, "comment hello", null, null); if (commentTextResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("post moments comment text success"); } else { System.out.println("post moments comment text failure:" + commentTextResult.getErrorCode().code); System.exit(-1); } IMResult updateResult = robotService.updateMomentsFeed(postResult.getResult().feedId, ProtoConstants.MomentsContentType.Moments_Content_Text_Type, "hello from robot2", null, null, null, null, "hello_extra2"); if (updateResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("update moments feed success"); } else { System.out.println("update moments feed failure:" + updateResult.getErrorCode().code); System.exit(-1); } IMResult deleteCommentThumbUpResult = robotService.deleteMomentsComment(postResult.result.feedId, commentThumbUpResult.result.commentId); if (deleteCommentThumbUpResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("delete moments thumb up success"); } else { System.out.println("delete moments thumb up failure:" + deleteCommentThumbUpResult.getErrorCode().code); System.exit(-1); } IMResult deleteCommentTextResult = robotService.deleteMomentsComment(postResult.result.feedId, commentTextResult.result.commentId); if (deleteCommentTextResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("delete moments comment text success"); } else { System.out.println("delete moments comment text failure:" + deleteCommentTextResult.getErrorCode().code); System.exit(-1); } IMResult deleteFeedResult = robotService.deleteMomentsFeed(postResult.result.feedId); if (deleteFeedResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("delete moments feed success"); } else { System.out.println("delete moments feed failure:" + deleteFeedResult.getErrorCode().code); System.exit(-1); } IMResult profileResult = robotService.getUserMomentsProfile(robotId); if (profileResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get user moments profile success"); } else { System.out.println("get user moments profile failure:" + profileResult.getErrorCode().code); System.exit(-1); } //测试更新朋友圈设置 IMResult updateBgResult = robotService.updateMomentsBackgroundUrl("https://example.com/bg.jpg"); if (updateBgResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("update moments background success"); } else { System.out.println("update moments background failure:" + updateBgResult.getErrorCode().code); } IMResult updateVisibleCountResult = robotService.updateMomentsStrangerVisibleCount(10); if (updateVisibleCountResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("update moments visible count success"); } else { System.out.println("update moments visible count failure:" + updateVisibleCountResult.getErrorCode().code); } IMResult updateVisibleScopeResult = robotService.updateMomentsVisibleScope(0); if (updateVisibleScopeResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("update moments visible scope success"); } else { System.out.println("update moments visible scope failure:" + updateVisibleScopeResult.getErrorCode().code); } IMResult updateBlackListResult = robotService.updateMomentsBlackList(Arrays.asList("user1"), null); if (updateBlackListResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("update moments blacklist success"); } else { System.out.println("update moments blacklist failure:" + updateBlackListResult.getErrorCode().code); } IMResult updateBlockListResult = robotService.updateMomentsBlockList(Arrays.asList("user2"), null); if (updateBlockListResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("update moments blocklist success"); } else { System.out.println("update moments blocklist failure:" + updateBlockListResult.getErrorCode().code); } } //释放机器人服务资源 robotService.close(); } //***测试频道API功能,仅专业版支持*** /** * 频道功能测试(仅专业版支持) *

* 测试以下功能: *

    *
  • 创建频道
  • *
  • 获取频道信息
  • *
  • 修改频道信息
  • *
  • 获取频道列表
  • *
  • 关注/取消关注频道
  • *
  • 获取频道关注者
  • *
  • 设置频道菜单
  • *
  • 获取频道菜单
  • *
  • 发送频道消息
  • *
  • 获取频道历史消息
  • *
  • 获取用户关注的频道
  • *
  • 删除频道(标记为已删除)
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testChannel() throws Exception { //初始化服务API AdminConfig.initAdmin(AdminUrl, AdminSecret); //先创建3个用户 InputOutputUserInfo userInfo = new InputOutputUserInfo(); userInfo.setUserId("userId1"); userInfo.setName("user1"); userInfo.setMobile("13900000000"); userInfo.setDisplayName("user 1"); IMResult resultCreateUser = UserAdmin.createUser(userInfo); if (resultCreateUser != null && resultCreateUser.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Create user " + resultCreateUser.getResult().getName() + " success"); } else { System.out.println("Create user failure"); System.exit(-1); } userInfo = new InputOutputUserInfo(); userInfo.setUserId("userId2"); userInfo.setName("user2"); userInfo.setMobile("13900000002"); userInfo.setDisplayName("user 2"); resultCreateUser = UserAdmin.createUser(userInfo); if (resultCreateUser != null && resultCreateUser.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Create user " + resultCreateUser.getResult().getName() + " success"); } else { System.out.println("Create user failure"); System.exit(-1); } userInfo = new InputOutputUserInfo(); userInfo.setUserId("userId3"); userInfo.setName("user3"); userInfo.setMobile("13900000003"); userInfo.setDisplayName("user 3"); resultCreateUser = UserAdmin.createUser(userInfo); if (resultCreateUser != null && resultCreateUser.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Create user " + resultCreateUser.getResult().getName() + " success"); } else { System.out.println("Create user failure"); System.exit(-1); } //1. 先使用admin api创建频道 InputCreateChannel inputCreateChannel = new InputCreateChannel(); inputCreateChannel.setName("testChannel"); inputCreateChannel.setOwner("userId1"); String secret = "channelsecret"; String channelId = "channelId123"; inputCreateChannel.setSecret(secret); inputCreateChannel.setTargetId(channelId); inputCreateChannel.setAuto(1); inputCreateChannel.setCallback("http://192.168.1.81:8088/wf/channelId123"); inputCreateChannel.setState(Channel_State_Mask_FullInfo | Channel_State_Mask_Unsubscribed_User_Access | Channel_State_Mask_Active_Subscribe | Channel_State_Mask_Message_Unsubscribed); IMResult resultCreateChannel = ChannelAdmin.createChannel(inputCreateChannel); if (resultCreateChannel != null && resultCreateChannel.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("create channel success"); } else { System.out.println("create channel failure"); System.exit(-1); } //2. 初始化api,注意端口是80,不是18080 //使用完需要释放 ChannelServiceApi channelServiceApi = new ChannelServiceApi(IMUrl, channelId, secret); //3. 测试channel api功能 //测试用户关注频道 IMResult resultVoid = channelServiceApi.subscribe("userId2"); if (resultVoid != null && resultVoid.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("subscribe success"); } else { System.out.println("subscribe failure"); System.exit(-1); } //测试另一个用户关注频道 resultVoid = channelServiceApi.subscribe("userId3"); if (resultVoid != null && resultVoid.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("subscribe done"); } else { System.out.println("subscribe failure"); System.exit(-1); } //使用Admin API让userId4关注频道 resultVoid = ChannelAdmin.subscribeChannel(channelId, "userId4"); if (resultVoid != null && resultVoid.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("subscribe done"); } else { System.out.println("subscribe failure"); System.exit(-1); } //获取频道订阅者列表 IMResult resultStringList = channelServiceApi.getSubscriberList(); if (resultStringList != null && resultStringList.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && resultStringList.getResult().getList().contains("userId2") && resultStringList.getResult().getList().contains("userId3") && resultStringList.getResult().getList().contains("userId4")) { System.out.println("get subscriber done"); } else { System.out.println("get subscriber failure"); System.exit(-1); } //检查用户是否订阅了频道 IMResult booleanIMResult = channelServiceApi.isSubscriber("userId2"); if(booleanIMResult != null && booleanIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && booleanIMResult.getResult()) { System.out.println("is subscriber success"); } else { System.out.println("is subscriber failure"); System.exit(-1); } //测试用户取消关注频道 resultVoid = channelServiceApi.unsubscribe("userId2"); if (resultVoid != null && resultVoid.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("unsubscriber done"); } else { System.out.println("unsubscriber failure"); System.exit(-1); } //验证userId2已不在订阅者列表中 resultStringList = channelServiceApi.getSubscriberList(); if (resultStringList != null && resultStringList.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && resultStringList.getResult().getList().contains("userId3") && !resultStringList.getResult().getList().contains("userId2")) { System.out.println("get subscriber done"); } else { System.out.println("get subscriber failure"); System.exit(-1); } //测试频道获取用户信息 IMResult resultGetUserInfo1 = channelServiceApi.getUserInfo("userId3"); if (resultGetUserInfo1 != null && resultGetUserInfo1.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get user info success"); } else { System.out.println("get user info failure"); System.exit(-1); } //创建消息payload MessagePayload payload = new MessagePayload(); payload.setType(1); payload.setSearchableContent("hello world"); IMResult resultSendMessage = channelServiceApi.sendMessage(0, null, payload); if (resultSendMessage != null && resultSendMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("send message to all the subscriber success"); } else { System.out.println("send message to all the subscriber failure"); System.exit(-1); } //测试重新发布消息 IMResult republishResult = channelServiceApi.republishMessage(resultSendMessage.getResult().getMessageUid(), Arrays.asList("userId2", "userId3")); if (republishResult != null && republishResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("republish message success"); } else { System.out.println("republish message failure"); System.exit(-1); } ArticleContent articleContent = new ArticleContent("article1", "https://media.wfcoss.cn/channel-assets/20220816/2dd76540daa9444dae44e942aa1c2bbc.png", "这是一个测试文章", "测试一下文章的功能", "https://mp.weixin.qq.com/s/W6tanLbALd3qqZM8r3MTgA", true); articleContent.addSubArticle("article2", "https://media.wfcoss.cn/channel-assets/20220816/2dd76540daa9444dae44e942aa1c2bbc.png", "这是第二个测试文章", "测试一下文章的功能", "https://mp.weixin.qq.com/s/W6tanLbALd3qqZM8r3MTgA", false); articleContent.addSubArticle("article3", "https://media.wfcoss.cn/channel-assets/20220816/2dd76540daa9444dae44e942aa1c2bbc.png", "这是第三个测试文章", "测试一下文章的功能", "https://mp.weixin.qq.com/s/W6tanLbALd3qqZM8r3MTgA", false); payload = articleContent.toPayload(); resultSendMessage = channelServiceApi.sendMessage(0, null, payload); if (resultSendMessage != null && resultSendMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("send message to all the subscriber success"); } else { System.out.println("send message to all the subscriber failure"); System.exit(-1); } //发送定向消息给指定用户 payload.setSearchableContent("hello to user2"); resultSendMessage = channelServiceApi.sendMessage(0, Arrays.asList("userId2"),payload); if (resultSendMessage != null && resultSendMessage.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("send message to user2 success"); } else { System.out.println("send message to user2 failure"); System.exit(-1); } //测试修改频道描述信息 IMResult voidIMResult = channelServiceApi.modifyChannelInfo(ProtoConstants.ModifyChannelInfoType.Modify_Channel_Desc, "this is a test channel, update at:" + new Date().toString()); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("modify channel profile success"); } else { System.out.println("modify channel profile failure"); System.exit(-1); } List menus = new ArrayList<>(); PojoChannelMenu menu1 = new PojoChannelMenu(); menu1.menuId = UUID.randomUUID().toString(); menu1.type = "view"; menu1.name = "一级菜单1"; menu1.key = "key1"; menu1.url = "http://www.baidu.com"; menus.add(menu1); PojoChannelMenu menu2 = new PojoChannelMenu(); menu2.menuId = UUID.randomUUID().toString(); menu2.type = "view"; menu2.name = "一级菜单2"; menu2.key = "key2"; menu2.url = "http://www.sohu.com"; menu2.subMenus = new ArrayList<>(); menus.add(menu2); PojoChannelMenu menu21 = new PojoChannelMenu(); menu21.menuId = UUID.randomUUID().toString(); menu21.type = "click"; menu21.name = "二级菜单21"; menu21.key = "key21"; menu21.url = "http://www.sohu.com"; menu2.subMenus.add(menu21); String menuStr = new GsonBuilder().disableHtmlEscaping().create().toJson(menus); voidIMResult = channelServiceApi.modifyChannelInfo(ProtoConstants.ModifyChannelInfoType.Modify_Channel_Menu, menuStr); if (voidIMResult != null && voidIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("modify channel menu success"); } else { System.out.println("modify channel menu failure"); System.exit(-1); } IMResult outputGetChannelInfoIMResult = channelServiceApi.getChannelInfo(); if (outputGetChannelInfoIMResult != null && outputGetChannelInfoIMResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get channel info success"); } else { System.out.println("get channel info failure"); System.exit(-1); } //测试修改频道菜单 List testMenus = new ArrayList<>(); PojoChannelMenu testMenu = new PojoChannelMenu(); testMenu.menuId = UUID.randomUUID().toString(); testMenu.type = "view"; testMenu.name = "测试菜单"; testMenu.key = "test_key"; testMenu.url = "http://www.test.com"; testMenus.add(testMenu); IMResult modifyMenuResult = channelServiceApi.modifyChannelMenu(testMenus); if (modifyMenuResult != null && modifyMenuResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("modify channel menu success"); } else { System.out.println("modify channel menu failure"); } OutputApplicationConfigData config = channelServiceApi.getApplicationSignature(); System.out.println(config); //使用完需要释放 channelServiceApi.close(); } /** * 敏感词管理API测试 *

* 测试以下功能: *

    *
  • 添加敏感词到敏感词库
  • *
  • 获取敏感词列表
  • *
  • 从敏感词库移除敏感词
  • *
  • 验证敏感词添加和移除操作
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testSensitiveApi() throws Exception { List words = Arrays.asList("a","b","c"); IMResult addResult = SensitiveAdmin.addSensitives(words); if (addResult != null && addResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Add sensitive word response success"); } else { System.out.println("Add sensitive word response error"); System.exit(-1); } Thread.sleep(100); IMResult swResult = SensitiveAdmin.getSensitives(); if (swResult != null && swResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && swResult.getResult().getWords().containsAll(words)) { System.out.println("Sensitive word added"); } else { System.out.println("Sensitive word not added"); System.exit(-1); } IMResult removeResult = SensitiveAdmin.removeSensitives(words); if (removeResult != null && removeResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Remove sensitive word response success"); } else { System.out.println("Remove sensitive word response error"); System.exit(-1); } Thread.sleep(100); swResult = SensitiveAdmin.getSensitives(); if (swResult != null && swResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && !swResult.getResult().getWords().containsAll(words)) { System.out.println("Sensitive word removed"); } else { System.out.println("Sensitive word not removed"); System.exit(-1); } } /** * 朋友圈(动态)API测试 *

* 测试以下功能: *

    *
  • 发布动态(朋友圈)
  • *
  • 发送文本动态内容
  • *
  • 验证动态发送结果
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testMomentsApi() throws Exception { FeedPojo feedPojo = new FeedPojo(); feedPojo.sender = "73055b4105de4b70993b7258afbfc387"; feedPojo.type = 0; feedPojo.text = "hello from admin"; IMResult sendResult = MomentsAdmin.postFeeds(feedPojo); if (sendResult != null && sendResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("send moments feed success"); } else { System.out.println("send moments feed failure"); System.exit(-1); } } //*********************************************** //**** 物联网相关的API,仅专业版支持 //*********************************************** /** * 物联网设备管理API测试(仅专业版支持) *

* 测试以下功能: *

    *
  • 创建或更新设备
  • *
  • 获取设备信息
  • *
  • 设备绑定多个所有者
  • *
  • 设备ID唯一性验证
  • *
  • 销毁设备
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testDevice() throws Exception { //创建设备信息,设置设备ID和所有者列表 InputCreateDevice createDevice = new InputCreateDevice(); createDevice.setDeviceId("deviceId1"); createDevice.setOwners(Arrays.asList("opoGoG__", "userId1")); //测试创建设备(如果不存在则创建,存在则更新) IMResult resultCreateDevice = UserAdmin.createOrUpdateDevice(createDevice); if (resultCreateDevice != null && resultCreateDevice.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("Create device " + resultCreateDevice.getResult().getDeviceId() + " success"); } else { System.out.println("Create device failure"); System.exit(-1); } //测试获取设备信息 IMResult getDevice = UserAdmin.getDevice("deviceId1"); if (getDevice != null && getDevice.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS && getDevice.getResult().getDeviceId().equals("deviceId1") && getDevice.getResult().getOwners().contains("opoGoG__")) { System.out.println("Get device " + resultCreateDevice.getResult().getDeviceId() + " success"); } else { System.out.println("Get device failure"); System.exit(-1); } //测试获取用户绑定的所有设备 IMResult getUserDevices = UserAdmin.getUserDevices("userId1"); if (getUserDevices != null && getUserDevices.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { boolean success = false; for (OutputDevice outputDevice : getUserDevices.getResult().getDevices()) { if (outputDevice.getDeviceId().equals("deviceId1")) { success = true; break; } } if (success) { System.out.println("Get user device success"); } else { System.out.println("Get user device failure"); System.exit(-1); } } else { System.out.println("Get device failure"); System.exit(-1); } } /** * 会议功能测试(仅音视频高级版服务支持) *

* 测试以下会议功能: *

    *
  • 获取会议列表
  • *
  • 销毁会议
  • *
  • 创建普通会议
  • *
  • 创建高级会议
  • *
  • 检查会议是否存在
  • *
  • 开启会议录制
  • *
  • 获取参会者列表
  • *
  • RTP转发相关操作
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ public static void testConference() throws Exception { //获取当前会议列表 IMResult listResult = ConferenceAdmin.listConferences(100, 0); if(listResult == null || listResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get conference list failure"); System.exit(-1); } else { System.out.println("conference list " + listResult.getResult().conferenceInfoList); } //清理现有会议,避免影响测试 for (PojoConferenceInfo conferenceInfo:listResult.getResult().conferenceInfoList) { IMResult destroyResult = ConferenceAdmin.destroy(conferenceInfo.roomId, conferenceInfo.advance); if(destroyResult == null || destroyResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("destroy room failure"); System.exit(-1); } else { System.out.println("destroy room success"); } } //再次获取会议列表,确认已清空 listResult = ConferenceAdmin.listConferences(100, 0); if(listResult == null || listResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get conference list failure"); System.exit(-1); } else { System.out.println("conference list " + listResult.getResult().conferenceInfoList); } //生成两个会议房间ID String roomId1 = UUID.randomUUID().toString(); String roomId2 = UUID.randomUUID().toString(); //创建普通会议房间(非高级版,最多9人) IMResult voidIMResult = ConferenceAdmin.createRoom(roomId1, "hello room description", "123456", 9, false, 0, false, true); if(voidIMResult == null || voidIMResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("create conference failure"); System.exit(-1); } else { System.out.println("create conference"); } //创建高级会议房间(支持更多功能,最多20人) voidIMResult = ConferenceAdmin.createRoom(roomId2, "hello room description advanced", "123456", 20, true, 0, false, true); if(voidIMResult == null || voidIMResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("create conference failure"); System.exit(-1); } else { System.out.println("create conference"); } //检查会议房间是否存在 IMResult booleanIMResult = ConferenceAdmin.existsConferences(roomId1); if(booleanIMResult == null || booleanIMResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("exist conference failure"); System.exit(-1); } else { System.out.println("exit conference success"); } //开启会议录制功能(视频和音频都录制) voidIMResult = ConferenceAdmin.enableRecording(roomId2, true, true); if(voidIMResult == null || voidIMResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("recording conference failure"); System.exit(-1); } else { System.out.println("recording conference success"); } listResult = ConferenceAdmin.listConferences(100, 0); if(listResult == null || listResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("get conference list failure"); System.exit(-1); } else { System.out.println("conference list " + listResult.getResult().conferenceInfoList); } //获取每个会议的参会者列表 for (PojoConferenceInfo conferenceInfo:listResult.getResult().conferenceInfoList) { IMResult listParticipantsResult = ConferenceAdmin.listParticipants(conferenceInfo.roomId, conferenceInfo.advance); if(listParticipantsResult == null || listParticipantsResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("list participants failure"); System.exit(-1); } else { System.out.println("list participants success"); } } //获取RTP转发器列表,并停止所有转发 IMResult listForwarderResult = ConferenceAdmin.listRtpForwarders("6366963312"); if(listForwarderResult == null || listForwarderResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("list rtp forward failure"); } else { System.out.println("list rtp forward success"); listForwarderResult.getResult().forwarders.forEach(rtpForwarder -> rtpForwarder.streams.forEach(rtpStream -> { try { IMResult stopRtpForwardResult = ConferenceAdmin.stopRtpForward(listForwarderResult.getResult().roomId, rtpForwarder.publisherId, rtpStream.streamId); if(stopRtpForwardResult == null || stopRtpForwardResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("rtp forward stop failure"); } else { System.out.println("rtp forward stop success"); } } catch (Exception e) { e.printStackTrace(); } })); } //测试RTP转发功能,将媒体流转发到指定地址 IMResult rtpForwardResult = ConferenceAdmin.rtpForward("6366963312", "cygqmws2k", "192.168.1.81", 10000, 111, 0, 10005, 98, 0); if(rtpForwardResult == null || rtpForwardResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("rtp forward failure"); } else { System.out.println("rtp forward success"); } } //*********************************************** //**** Mesh相关API,用于分布式IM //*********************************************** /** * Mesh(分布式IM)API测试 *

* 测试以下分布式IM功能: *

    *
  • 搜索用户 - 跨域搜索用户
  • *
  • 批量获取用户信息 - 获取多个用户的详细信息
  • *
  • 发送好友请求 - 向其他域用户发送好友请求
  • *
  • 处理好友请求 - 接受或拒绝好友请求
  • *
  • 创建域 - 创建新的Mesh域
  • *
  • 获取域信息 - 获取指定域的详细信息
  • *
  • 获取所有域 - 获取Mesh网络中的所有域列表
  • *
  • Ping域 - 测试域的连通性
  • *
  • 删除域 - 从Mesh网络中移除域
  • *
  • 同步群组 - 跨域同步群组信息
  • *
  • 发送消息 - 向其他域用户发送消息
  • *
  • 发布消息 - 向多个域用户广播消息
  • *
  • 添加加入群组请求 - 跨域申请加入群组
  • *
  • 会议用户请求 - 跨域会议相关请求
  • *
  • 会议用户事件 - 跨域会议事件处理
  • *
*

* @throws Exception 当测试过程中发生错误时抛出异常 */ static void testMesh() throws Exception { //测试搜索用户 IMResult searchUserResult = MeshAdmin.searchUser("test", 0, 0, 1); if (searchUserResult != null && searchUserResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh search user success"); } else { System.out.println("mesh search user failure"); } //测试批量获取用户信息 IMResult batchUserInfosResult = MeshAdmin.getBatchUserInfos(Arrays.asList("user1", "user2")); if (batchUserInfosResult != null && batchUserInfosResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh batch get user info success"); } else { System.out.println("mesh batch get user info failure"); } //测试发送好友请求 IMResult sendFriendRequestResult = MeshAdmin.sendFriendRequest("user1", "user2", "hello"); if (sendFriendRequestResult != null && (sendFriendRequestResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS || sendFriendRequestResult.getErrorCode() == ErrorCode.ERROR_CODE_ALREADY_FRIENDS)) { System.out.println("mesh send friend request success"); } else { System.out.println("mesh send friend request failure"); } //测试处理好友请求 IMResult handleFriendRequestResult = MeshAdmin.handleFriendRequest("user2", "user1", 1); if (handleFriendRequestResult != null && handleFriendRequestResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh handle friend request success"); } else { System.out.println("mesh handle friend request failure"); } //测试创建域 String domainId = "test_domain_" + System.currentTimeMillis(); InputOutputDomainInfo domainInfo = new InputOutputDomainInfo(); domainInfo.setDomainId(domainId); domainInfo.setName("Test Domain"); IMResult createDomainResult = MeshAdmin.createDomain(domainInfo); if (createDomainResult != null && createDomainResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh create domain success"); } else { System.out.println("mesh create domain failure"); } //测试获取域 IMResult getDomainResult = MeshAdmin.getDomain(domainId); if (getDomainResult != null && getDomainResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh get domain success"); } else { System.out.println("mesh get domain failure"); } //测试获取所有域 IMResult getAllDomainResult = MeshAdmin.getAllDomain(); if (getAllDomainResult != null && getAllDomainResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh get all domain success"); } else { System.out.println("mesh get all domain failure"); } //测试ping域 IMResult pingDomainResult = MeshAdmin.pingDomain(domainId); if (pingDomainResult != null && pingDomainResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh ping domain success"); } else { System.out.println("mesh ping domain failure"); } //测试删除域 IMResult deleteDomainResult = MeshAdmin.deleteDomain(domainId); if (deleteDomainResult != null && deleteDomainResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh delete domain success"); } else { System.out.println("mesh delete domain failure"); } //测试同步群组 PojoGroupInfo meshGroupInfo = new PojoGroupInfo(); meshGroupInfo.setTarget_id("mesh_group_" + System.currentTimeMillis()); meshGroupInfo.setName("Mesh Test Group"); meshGroupInfo.setOwner("user1"); meshGroupInfo.setType(2); List meshMembers = new ArrayList<>(); PojoGroupMember meshMember = new PojoGroupMember(); meshMember.setMember_id("user1"); meshMembers.add(meshMember); IMResult syncGroupResult = MeshAdmin.syncGroup(meshGroupInfo, meshMembers); if (syncGroupResult != null && syncGroupResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh sync group success"); } else { System.out.println("mesh sync group failure"); } //测试发送消息 Conversation meshConversation = new Conversation(); meshConversation.setTarget("user2"); meshConversation.setType(ProtoConstants.ConversationType.ConversationType_Private); MessagePayload meshPayload = new MessagePayload(); meshPayload.setType(1); meshPayload.setSearchableContent("mesh test message"); IMResult meshSendMessageResult = MeshAdmin.sendMessage("user1", meshConversation, meshPayload, null); if (meshSendMessageResult != null && meshSendMessageResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh send message success"); } else { System.out.println("mesh send message failure"); } //测试发布消息 if (meshSendMessageResult != null && meshSendMessageResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { SendMessageData publishMessageData = new SendMessageData(); publishMessageData.setSender("user1"); publishMessageData.setConv(meshConversation); publishMessageData.setPayload(meshPayload); IMResult publishMessageResult = MeshAdmin.publishMessage(publishMessageData, Arrays.asList("user2"), meshSendMessageResult.getResult().getMessageUid()); if (publishMessageResult != null && publishMessageResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh publish message success"); } else { System.out.println("mesh publish message failure"); } } //测试添加加入群组请求 IMResult addJoinGroupRequestResult = MeshAdmin.addJoinGroupRequest("user2", meshGroupInfo.getTarget_id(), Arrays.asList("user3"), "please add me", null); if (addJoinGroupRequestResult != null && addJoinGroupRequestResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh add join group request success"); } else { System.out.println("mesh add join group request failure"); } //测试会议用户请求 IMResult userConferenceRequestResult = MeshAdmin.userConferenceRequest("client1", "user1", "test_request", 1, "room1", "test_data", false); if (userConferenceRequestResult != null && userConferenceRequestResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh user conference request success"); } else { System.out.println("mesh user conference request failure"); } //测试会议用户事件 IMResult userConferenceEventResult = MeshAdmin.userConferenceEvent("test_event_data", "user1", "client1", false); if (userConferenceEventResult != null && userConferenceEventResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { System.out.println("mesh user conference event success"); } else { System.out.println("mesh user conference event failure"); } } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/MeshAdmin.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.*; import cn.wildfirechat.pojos.mesh.*; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; import java.util.List; /** * Mesh服务管理类 *

* 提供Mesh网络(多域互联)服务管理相关的功能,包括: *

    *
  • 域管理(创建、删除、查询)
  • *
  • 跨域用户搜索
  • *
  • 跨域好友管理
  • *
  • 跨域消息发送
  • *
  • 跨域群组管理
  • *
  • 会议控制
  • *
*

*/ public class MeshAdmin { /** * 创建域 * @param domainInfo 域信息 * @return 创建结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult createDomain(InputOutputDomainInfo domainInfo) throws Exception { String path = APIPath.Create_Domain; return AdminHttpUtils.httpJsonPost(path, domainInfo, Void.class); } /** * 获取域信息 * @param domainId 域ID * @return 域信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getDomain(String domainId) throws Exception { String path = APIPath.Get_Domain; InputStringValue inputId = new InputStringValue(); inputId.setValue(domainId); return AdminHttpUtils.httpJsonPost(path, inputId, InputOutputDomainInfo.class); } /** * 删除域 * @param domainId 域ID * @return 删除结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult deleteDomain(String domainId) throws Exception { String path = APIPath.Destroy_Domain; InputStringValue inputId = new InputStringValue(); inputId.setValue(domainId); return AdminHttpUtils.httpJsonPost(path, inputId, Void.class); } /** * 获取所有域列表 * @return 域信息列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getAllDomain() throws Exception { String path = APIPath.List_Domain; return AdminHttpUtils.httpJsonPost(path, null, InputOutputDomainInfoList.class); } /** * 批量获取用户信息 * @param userIds 用户ID列表 * @return 用户信息列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getBatchUserInfos(List userIds) throws Exception { String path = APIPath.User_Batch_Get_Infos; OutputStringList getUserInfo = new OutputStringList(userIds); return AdminHttpUtils.httpJsonPost(path, getUserInfo, OutputUserInfoList.class); } /** * 搜索用户 * @param keyword 搜索关键词 * @param searchType 搜索类型 * @param userType 用户类型 * @param page 页码 * @return 搜索结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult searchUser(String keyword, int searchType, int userType, int page) throws Exception { String path = APIPath.Search_User; PojoSearchUserReq req = new PojoSearchUserReq(); req.keyword = keyword; req.searchType = searchType; req.page = page; req.userType = userType; return AdminHttpUtils.httpJsonPost(path, req, PojoSearchUserRes.class); } /** * 发送跨域好友请求 * @param userId 用户ID * @param targetId 目标用户ID * @param reason 申请理由 * @return 发送结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult sendFriendRequest(String userId, String targetId, String reason) throws Exception { String path = APIPath.Friend_Send_Request; InputAddFriendRequest input = new InputAddFriendRequest(); input.setUserId(userId); input.setFriendUid(targetId); input.setReason(reason); input.setForce(false); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 处理跨域好友请求 * @param userId 用户ID * @param targetId 目标用户ID * @param status 状态 * @return 处理结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult handleFriendRequest(String userId, String targetId, int status) throws Exception { String path = APIPath.Handle_Friend_Send_Request; InputHandleFriendRequest input = new InputHandleFriendRequest(); input.setUserId(userId); input.setFriendUid(targetId); input.setStatus(status); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 发送跨域消息 * @param sender 发送者用户ID * @param conversation 会话信息 * @param payload 消息内容 * @param toUsers 接收用户ID列表 * @return 发送结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult sendMessage(String sender, Conversation conversation, MessagePayload payload, List toUsers) throws Exception { String path = APIPath.Msg_Send; SendMessageData messageData = new SendMessageData(); messageData.setSender(sender); messageData.setConv(conversation); messageData.setPayload(payload); messageData.setToUsers(toUsers); messageData.setMeshMessage(true); if (payload.getType() == 1 && (payload.getSearchableContent() == null || payload.getSearchableContent().isEmpty())) { System.out.println("Payload错误,Payload格式应该跟客户端消息encode出来的Payload对齐,这样客户端才能正确识别。比如文本消息,文本需要放到searchableContent属性。请与客户端同事确认Payload的格式,或则去 https://gitee.com/wfchat/android-chat/tree/master/client/src/main/java/cn/wildfirechat/message 找到消息encode的实现方法!"); } return AdminHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class); } /** * 发布跨域消息 * @param messageData 消息数据 * @param receivers 接收者ID列表 * @param messageId 消息ID * @return 发布结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult publishMessage(SendMessageData messageData, List receivers, long messageId) throws Exception { String path = APIPath.Msg_Publish; PojoPublishMessageReq req = new PojoPublishMessageReq(); req.messageData = messageData; req.receivers = receivers; req.messageId = messageId; return AdminHttpUtils.httpJsonPost(path, req, SendMessageResult.class); } /** * 撤回跨域消息 * @param operator 操作者用户ID * @param messageId 消息ID * @return 撤回结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult recallMessage(String operator, long messageId) throws Exception { String path = APIPath.Msg_Recall; RecallMessageData req = new RecallMessageData(); req.setOperator(operator); req.setMessageUid(messageId); req.setUserRecall(true); return AdminHttpUtils.httpJsonPost(path, req, String.class); } /** * 更新跨域消息内容 * @param operator 操作者用户ID * @param messageUid 消息UID * @param payload 新的消息内容 * @param distribute 是否分发 * @return 更新结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult updateMessageContent(String operator, long messageUid, MessagePayload payload, boolean distribute) throws Exception { String path = APIPath.Msg_Update; UpdateMessageContentData updateMessageContentData = new UpdateMessageContentData(); updateMessageContentData.setOperator(operator); updateMessageContentData.setMessageUid(messageUid); updateMessageContentData.setPayload(payload); updateMessageContentData.setDistribute(distribute?1:0); updateMessageContentData.setUpdateTimestamp(0); updateMessageContentData.setMeshLocal(1); return AdminHttpUtils.httpJsonPost(path, updateMessageContentData, Void.class); } /** * 同步跨域群组 * @param group_info 群组信息 * @param members 成员列表 * @return 同步结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult syncGroup(PojoGroupInfo group_info, List members) throws Exception { String path = APIPath.Sync_Group; PojoGroup pojoGroup = new PojoGroup(); pojoGroup.setGroup_info(group_info); pojoGroup.setMembers(members); return AdminHttpUtils.httpJsonPost(path, pojoGroup, Void.class); } /** * 获取跨域群组信息 * @param groupId 群组ID * @return 群组信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getGroupInfo(String groupId) throws Exception { return GroupAdmin.getGroupInfo(groupId); } /** * 获取跨域群组成员列表 * @param groupId 群组ID * @return 群组成员列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getGroupMembers(String groupId) throws Exception { return GroupAdmin.getGroupMembers(groupId); } /** * 添加跨域群组成员 * @param operator 操作者用户ID * @param groupId 群组ID * @param groupMembers 成员列表 * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 添加结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult addGroupMembers(String operator, String groupId, List groupMembers, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Member_Add; InputAddGroupMember addGroupMember = new InputAddGroupMember(); addGroupMember.setGroup_id(groupId); addGroupMember.setMembers(groupMembers); addGroupMember.setOperator(operator); addGroupMember.setTo_lines(to_lines); addGroupMember.setNotify_message(notify_message); addGroupMember.setMeshMessage(true); return AdminHttpUtils.httpJsonPost(path, addGroupMember, Void.class); } /** * 添加跨域加群申请 * @param operator 操作者用户ID * @param groupId 群组ID * @param userIds 用户ID列表 * @param reason 理由 * @param extra 额外信息 * @return 添加结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult addJoinGroupRequest(String operator, String groupId, List userIds, String reason, String extra) throws Exception { String path = APIPath.Group_Join_Request_Add; PojoAddJoinGroupRequest addGroupMember = new PojoAddJoinGroupRequest(); addGroupMember.operator = operator; addGroupMember.group_id = groupId; addGroupMember.userIds = userIds; addGroupMember.reason = reason; addGroupMember.extra = extra; return AdminHttpUtils.httpJsonPost(path, addGroupMember, Void.class); } /** * 批量获取跨域群组信息 * @param groupIds 群组ID列表 * @return 群组信息列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult batchGroupInfos(List groupIds) throws Exception { return GroupAdmin.batchGroupInfos(groupIds); } /** * 退出跨域群组 * @param operator 操作者用户ID * @param groupId 群组ID * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 退出结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult quitGroup(String operator, String groupId, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Member_Quit; InputQuitGroup quitGroup = new InputQuitGroup(); quitGroup.setGroup_id(groupId); quitGroup.setOperator(operator); quitGroup.setTo_lines(to_lines); quitGroup.setNotify_message(notify_message); quitGroup.setMeshMessage(true); return AdminHttpUtils.httpJsonPost(path, quitGroup, Void.class); } /** * 解散跨域群组 * @param operator 操作者用户ID * @param groupId 群组ID * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 解散结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult dismissGroup(String operator, String groupId, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Dismiss; InputDismissGroup dismissGroup = new InputDismissGroup(); dismissGroup.setOperator(operator); dismissGroup.setGroup_id(groupId); dismissGroup.setTo_lines(to_lines); dismissGroup.setNotify_message(notify_message); dismissGroup.setMeshMessage(true); return AdminHttpUtils.httpJsonPost(path, dismissGroup, Void.class); } /** * 踢出跨域群组成员 * @param operator 操作者用户ID * @param groupId 群组ID * @param groupMemberIds 成员用户ID列表 * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 踢出结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult kickoffGroupMembers(String operator, String groupId, List groupMemberIds, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Member_Kickoff; InputKickoffGroupMember kickoffGroupMember = new InputKickoffGroupMember(); kickoffGroupMember.setGroup_id(groupId); kickoffGroupMember.setMembers(groupMemberIds); kickoffGroupMember.setOperator(operator); kickoffGroupMember.setTo_lines(to_lines); kickoffGroupMember.setMeshMessage(true); kickoffGroupMember.setNotify_message(notify_message); return AdminHttpUtils.httpJsonPost(path, kickoffGroupMember, Void.class); } /** * 转让跨域群组 * @param operator 操作者用户ID * @param groupId 群组ID * @param newOwner 新群主用户ID * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 转让结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult transferGroup(String operator, String groupId, String newOwner, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Transfer; InputTransferGroup transferGroup = new InputTransferGroup(); transferGroup.setGroup_id(groupId); transferGroup.setNew_owner(newOwner); transferGroup.setOperator(operator); transferGroup.setTo_lines(to_lines); transferGroup.setNotify_message(notify_message); transferGroup.setMeshMessage(true); return AdminHttpUtils.httpJsonPost(path, transferGroup, Void.class); } /** * 修改跨域群组信息 * @param operator 操作者用户ID * @param groupId 群组ID * @param type 修改信息类型(ModifyGroupInfoType) * @param value 新值 * @param to_lines 消息同步到的线路列表 * @param notify_message 通知消息 * @return 修改结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult modifyGroupInfo(String operator, String groupId, /*ModifyGroupInfoType*/int type, String value, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Group_Modify_Info; InputModifyGroupInfo modifyGroupInfo = new InputModifyGroupInfo(); modifyGroupInfo.setGroup_id(groupId); modifyGroupInfo.setOperator(operator); modifyGroupInfo.setTo_lines(to_lines); modifyGroupInfo.setType(type); modifyGroupInfo.setValue(value); modifyGroupInfo.setNotify_message(notify_message); modifyGroupInfo.setMeshMessage(true); return AdminHttpUtils.httpJsonPost(path, modifyGroupInfo, Void.class); } /** * 用户会议请求 * @param clientID 客户端ID * @param fromUser 发起用户ID * @param request 请求内容 * @param sessionId 会话ID * @param roomId 房间ID * @param data 数据 * @param advanced 是否高级模式 * @return 会议响应 * @throws Exception 请求失败时抛出异常 */ public static IMResult userConferenceRequest(String clientID, String fromUser, String request, long sessionId, String roomId, String data, boolean advanced) throws Exception { String path = APIPath.Conference_User_Request; PojoUserConferenceRequest conferenceRequest = new PojoUserConferenceRequest(); conferenceRequest.clientID = clientID; conferenceRequest.fromUser = fromUser; conferenceRequest.request = request; conferenceRequest.sessionId = sessionId; conferenceRequest.roomId = roomId; conferenceRequest.data = data; conferenceRequest.advanced = advanced; return AdminHttpUtils.httpJsonPost(path, conferenceRequest, PojoUserConferenceResponse.class); } /** * 用户会议事件 * @param data 事件数据 * @param userId 用户ID * @param clientId 客户端ID * @param isRobot 是否为机器人 * @return 事件处理结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult userConferenceEvent(String data, String userId, String clientId, boolean isRobot) throws Exception { String path = APIPath.Conference_User_Event; PojoUserConferenceEvent event = new PojoUserConferenceEvent(); event.data = data; event.userId = userId; event.clientId = clientId; event.isRobot = isRobot; return AdminHttpUtils.httpJsonPost(path, event, Void.class); } /** * Ping域 * @param domainId 域ID * @return Ping响应 * @throws Exception 请求失败时抛出异常 */ public static IMResult pingDomain(String domainId) throws Exception { String path = APIPath.Ping_Domain; PojoDomainPingRequest request = new PojoDomainPingRequest(); request.domainId = domainId; return AdminHttpUtils.httpJsonPost(path, request, PojoDomainPingResponse.class); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/MessageAdmin.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.*; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; import java.util.List; /** * 消息管理类 *

* 提供消息管理相关的功能,包括: *

    *
  • 发送消息(单聊、群聊、聊天室等)
  • *
  • 撤回消息
  • *
  • 删除消息
  • *
  • 更新消息内容
  • *
  • 广播和群发消息
  • *
  • 会话管理
  • *
  • 消息已读和投递状态查询
  • *
*

*/ public class MessageAdmin { /** * 发送消息 * @param sender 发送者用户ID * @param conversation 会话信息 * @param payload 消息内容 * @return 发送结果,包含消息ID * @throws Exception 请求失败时抛出异常 */ public static IMResult sendMessage(String sender, Conversation conversation, MessagePayload payload) throws Exception { return sendMessage(sender, conversation, payload, null); } /** * 发送消息(可指定部分接收用户) *

* toUsers为发送给会话中部分用户用的,正常为null,仅当需要指定群/频道/聊天室中部分接收用户时使用 *

* @param sender 发送者用户ID * @param conversation 会话信息 * @param payload 消息内容 * @param toUsers 接收用户ID列表,null表示发送给会话中所有用户 * @return 发送结果,包含消息ID * @throws Exception 请求失败时抛出异常 */ public static IMResult sendMessage(String sender, Conversation conversation, MessagePayload payload, List toUsers) throws Exception { return sendMessage(sender, conversation, payload, toUsers, false); } /** * 发送消息(完整参数版本) *

* toUsers为发送给会话中部分用户用的,正常为null,仅当需要指定群/频道/聊天室中部分接收用户时使用 *

* @param sender 发送者用户ID * @param conversation 会话信息 * @param payload 消息内容 * @param toUsers 接收用户ID列表,null表示发送给会话中所有用户 * @param isUserMessage 是否为用户消息 * @return 发送结果,包含消息ID * @throws Exception 请求失败时抛出异常 */ public static IMResult sendMessage(String sender, Conversation conversation, MessagePayload payload, List toUsers, boolean isUserMessage) throws Exception { String path = APIPath.Msg_Send; SendMessageData messageData = new SendMessageData(); messageData.setSender(sender); messageData.setConv(conversation); messageData.setPayload(payload); messageData.setToUsers(toUsers); messageData.setUserMessage(isUserMessage); if (payload.getType() == 1 && (payload.getSearchableContent() == null || payload.getSearchableContent().isEmpty())) { System.out.println("Payload错误,Payload格式应该跟客户端消息encode出来的Payload对齐,这样客户端才能正确识别。比如文本消息,文本需要放到searchableContent属性。请与客户端同事确认Payload的格式,或则去 https://gitee.com/wfchat/android-chat/tree/master/client/src/main/java/cn/wildfirechat/message 找到消息encode的实现方法!"); } return AdminHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class); } /** * 撤回消息 * @param operator 操作者用户ID * @param messageUid 消息UID * @return 撤回结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult recallMessage(String operator, long messageUid) throws Exception { String path = APIPath.Msg_Recall; RecallMessageData messageData = new RecallMessageData(); messageData.setOperator(operator); messageData.setMessageUid(messageUid); return AdminHttpUtils.httpJsonPost(path, messageData, String.class); } /** * 删除消息(仅专业版支持) * @param messageUid 消息UID * @return 删除结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult deleteMessage(long messageUid) throws Exception { String path = APIPath.Msg_Delete; DeleteMessageData deleteMessageData = new DeleteMessageData(); deleteMessageData.setMessageUid(messageUid); return AdminHttpUtils.httpJsonPost(path, deleteMessageData, Void.class); } /** * 清除用户消息(仅专业版支持) * @param userId 用户ID * @param conversation 会话信息 * @param fromTime 起始时间 * @param toTime 结束时间 * @return 清除结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult clearUserMessages(String userId, Conversation conversation, long fromTime, long toTime) throws Exception { String path = APIPath.Msg_Clear_By_User; InputClearUserMessages clearUserMessages = new InputClearUserMessages(userId, conversation, fromTime, toTime); return AdminHttpUtils.httpJsonPost(path, clearUserMessages, Void.class); } /** * 更新消息内容(仅专业版支持) * @param operator 操作者用户ID * @param messageUid 消息UID * @param payload 新的消息内容 * @param distribute 是否分发更新 * @return 更新结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult updateMessageContent(String operator, long messageUid, MessagePayload payload, boolean distribute) throws Exception { String path = APIPath.Msg_Update; UpdateMessageContentData updateMessageContentData = new UpdateMessageContentData(); updateMessageContentData.setOperator(operator); updateMessageContentData.setMessageUid(messageUid); updateMessageContentData.setPayload(payload); updateMessageContentData.setDistribute(distribute?1:0); updateMessageContentData.setUpdateTimestamp(0); return AdminHttpUtils.httpJsonPost(path, updateMessageContentData, Void.class); } /** * 清除会话(仅专业版支持) * @param userId 用户ID * @param conversation 会话信息 * @return 清除结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult clearConversation(String userId, Conversation conversation) throws Exception { String path = APIPath.Conversation_Delete; InputUserConversation input = new InputUserConversation(); input.userId = userId; input.conversation = conversation; return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 获取单条消息 *

如果想要更多消息的读取,可以直接读取IM服务的数据库

* @param messageUid 消息UID * @return 消息数据 * @throws Exception 请求失败时抛出异常 */ public static IMResult getMessage(long messageUid) throws Exception { String path = APIPath.Msg_GetOne; InputMessageUid inputMessageUid = new InputMessageUid(messageUid); return AdminHttpUtils.httpJsonPost(path, inputMessageUid, OutputMessageData.class); } /** * 撤回广播消息(仅专业版支持) * @param operator 操作者用户ID * @param messageUid 消息UID * @return 撤回结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult recallBroadCastMessage(String operator, long messageUid) throws Exception { String path = APIPath.Msg_RecallBroadCast; RecallMessageData messageData = new RecallMessageData(); messageData.setOperator(operator); messageData.setMessageUid(messageUid); return AdminHttpUtils.httpJsonPost(path, messageData, Void.class); } /** * 撤回群发消息 * @param operator 操作者用户ID * @param messageUid 消息UID * @param receivers 接收者ID列表 * @return 撤回结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult recallMultiCastMessage(String operator, long messageUid, List receivers) throws Exception { String path = APIPath.Msg_RecallMultiCast; RecallMultiCastMessageData messageData = new RecallMultiCastMessageData(); messageData.operator = operator; messageData.messageUid = messageUid; messageData.receivers = receivers; return AdminHttpUtils.httpJsonPost(path, messageData, Void.class); } /** * 删除广播消息(仅专业版支持) * @param operator 操作者用户ID * @param messageUid 消息UID * @return 删除结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult deleteBroadCastMessage(String operator, long messageUid) throws Exception { String path = APIPath.Msg_DeleteBroadCast; RecallMessageData messageData = new RecallMessageData(); messageData.setOperator(operator); messageData.setMessageUid(messageUid); return AdminHttpUtils.httpJsonPost(path, messageData, Void.class); } /** * 删除群发消息 * @param operator 操作者用户ID * @param messageUid 消息UID * @param receivers 接收者ID列表 * @return 删除结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult deleteMultiCastMessage(String operator, long messageUid, List receivers) throws Exception { String path = APIPath.Msg_DeleteMultiCast; RecallMultiCastMessageData messageData = new RecallMultiCastMessageData(); messageData.operator = operator; messageData.messageUid = messageUid; messageData.receivers = receivers; return AdminHttpUtils.httpJsonPost(path, messageData, Void.class); } /** * 广播消息(仅专业版支持) * @param sender 发送者用户ID * @param line 线路 * @param payload 消息内容 * @return 广播结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult broadcastMessage(String sender, int line, MessagePayload payload) throws Exception { String path = APIPath.Msg_Broadcast; BroadMessageData messageData = new BroadMessageData(); messageData.setSender(sender); messageData.setLine(line); messageData.setPayload(payload); return AdminHttpUtils.httpJsonPost(path, messageData, BroadMessageResult.class); } /** * 群发消息 * @param sender 发送者用户ID * @param receivers 接收者ID列表 * @param line 线路 * @param payload 消息内容 * @return 群发结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult multicastMessage(String sender, List receivers, int line, MessagePayload payload) throws Exception { String path = APIPath.Msg_Multicast; MulticastMessageData messageData = new MulticastMessageData(); messageData.setSender(sender); messageData.setTargets(receivers); messageData.setLine(line); messageData.setPayload(payload); return AdminHttpUtils.httpJsonPost(path, messageData, MultiMessageResult.class); } /** * 获取会话已读时间戳 * @param userId 用户ID * @param conversation 会话信息 * @return 已读时间戳 * @throws Exception 请求失败时抛出异常 */ public static IMResult getConversationReadTimestamp(String userId, Conversation conversation) throws Exception { String path = APIPath.Msg_ConvRead; InputGetConvReadTime input = new InputGetConvReadTime(userId, conversation.getType(), conversation.getTarget(), conversation.getLine()); return AdminHttpUtils.httpJsonPost(path, input, OutputTimestamp.class); } /** * 获取消息投递时间戳 * @param userId 用户ID * @return 投递时间戳 * @throws Exception 请求失败时抛出异常 */ public static IMResult getMessageDelivery(String userId) throws Exception { String path = APIPath.Msg_Delivery; InputUserId input = new InputUserId(userId); return AdminHttpUtils.httpJsonPost(path, input, OutputTimestamp.class); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/MomentsAdmin.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.*; import cn.wildfirechat.pojos.moments.FeedPojo; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; /** * 朋友圈管理类 *

* 提供朋友圈(动态)管理相关的功能。 *

*/ public class MomentsAdmin { /** * 发布朋友圈动态 * @param feedPojo 动态内容 * @return 发布结果,包含消息ID * @throws Exception 请求失败时抛出异常 */ public static IMResult postFeeds(FeedPojo feedPojo) throws Exception { String path = APIPath.Admin_Moments_Post_Feed; return AdminHttpUtils.httpJsonPost(path, feedPojo, SendMessageResult.class); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/RelationAdmin.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.*; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; /** * 好友关系管理类 *

* 提供好友关系管理相关的功能,包括: *

    *
  • 设置和获取好友关系
  • *
  • 黑名单管理
  • *
  • 好友别名和额外信息管理
  • *
  • 好友请求发送
  • *
  • 关系查询
  • *
*

*/ public class RelationAdmin { /** * 设置用户好友关系 * @param userId 用户ID * @param targetId 目标用户ID * @param isFriend true-设置为好友,false-删除好友 * @param extra 额外信息 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setUserFriend(String userId, String targetId, boolean isFriend, String extra) throws Exception { String path = APIPath.Friend_Update_Status; InputUpdateFriendStatusRequest input = new InputUpdateFriendStatusRequest(); input.setUserId(userId); input.setFriendUid(targetId); input.setStatus(isFriend ? 0 : 1); //历史遗留问题,在IM数据库中0是好友,1是好友被删除。 input.setExtra(extra); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 获取好友列表 * @param userId 用户ID * @return 好友ID列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getFriendList(String userId) throws Exception { String path = APIPath.Friend_Get_List; InputUserId input = new InputUserId(); input.setUserId(userId); return AdminHttpUtils.httpJsonPost(path, input, OutputStringList.class); } /** * 设置黑名单 * @param userId 用户ID * @param targetId 目标用户ID * @param isBlacklist true-加入黑名单,false-移出黑名单 * @return 设置结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult setUserBlacklist(String userId, String targetId, boolean isBlacklist) throws Exception { String path = APIPath.Blacklist_Update_Status; InputBlacklistRequest input = new InputBlacklistRequest(); input.setUserId(userId); input.setTargetUid(targetId); input.setStatus(isBlacklist ? 2 : 1); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 获取用户黑名单 * @param userId 用户ID * @return 黑名单用户ID列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserBlacklist(String userId) throws Exception { String path = APIPath.Blacklist_Get_List; InputUserId input = new InputUserId(); input.setUserId(userId); return AdminHttpUtils.httpJsonPost(path, input, OutputStringList.class); } /** * 更新好友别名 * @param operator 操作者用户ID * @param targetId 目标用户ID * @param alias 别名 * @return 更新结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult updateFriendAlias(String operator, String targetId, String alias) throws Exception { String path = APIPath.Friend_Set_Alias; InputUpdateAlias input = new InputUpdateAlias(); input.setOperator(operator); input.setTargetId(targetId); input.setAlias(alias); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 获取好友别名 * @param operator 操作者用户ID * @param targetId 目标用户ID * @return 好友别名 * @throws Exception 请求失败时抛出异常 */ public static IMResult getFriendAlias(String operator, String targetId) throws Exception { String path = APIPath.Friend_Get_Alias; InputGetAlias input = new InputGetAlias(); input.setOperator(operator); input.setTargetId(targetId); return AdminHttpUtils.httpJsonPost(path, input, OutputGetAlias.class); } /** * 更新好友额外信息 * @param operator 操作者用户ID * @param targetId 目标用户ID * @param extra 额外信息 * @return 更新结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult updateFriendExtra(String operator, String targetId, String extra) throws Exception { String path = APIPath.Friend_Set_Extra; InputUpdateFriendExtra input = new InputUpdateFriendExtra(); input.setOperator(operator); input.setTargetId(targetId); input.setExtra(extra); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 发送好友请求 * @param userId 用户ID * @param targetId 目标用户ID * @param reason 申请理由 * @param force 是否强制添加(直接成为好友无需对方同意) * @return 发送结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult sendFriendRequest(String userId, String targetId, String reason, boolean force) throws Exception { String path = APIPath.Friend_Send_Request; InputAddFriendRequest input = new InputAddFriendRequest(); input.setUserId(userId); input.setFriendUid(targetId); input.setReason(reason); input.setForce(force); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 获取两个用户之间的关系 * @param userId 用户1的ID * @param targetId 用户2的ID * @return 关系信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getRelation(String userId, String targetId) throws Exception { String path = APIPath.Relation_Get; StringPairPojo input = new StringPairPojo(userId, targetId); return AdminHttpUtils.httpJsonPost(path, input, RelationPojo.class); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/RobotService.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.pojos.*; import cn.wildfirechat.pojos.moments.*; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.RobotHttpUtils; import org.apache.commons.codec.digest.DigestUtils; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPut; import org.apache.http.entity.ContentType; import org.apache.http.entity.FileEntity; import org.apache.http.entity.InputStreamEntity; import org.apache.http.entity.mime.MultipartEntityBuilder; import org.apache.http.entity.mime.content.FileBody; import org.apache.http.entity.mime.content.InputStreamBody; import org.apache.http.util.EntityUtils; import java.io.Closeable; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URLConnection; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; import static cn.wildfirechat.proto.ProtoConstants.ApplicationType.ApplicationType_Robot; /** * 机器人服务类 *

* 提供机器人相关的功能,包括: *

    *
  • 发送和回复消息
  • *
  • 获取用户信息
  • *
  • 群组管理
  • *
  • 朋友圈管理
  • *
  • 会议控制
  • *
  • 回调管理
  • *
*

*/ public class RobotService implements Closeable { private final RobotHttpUtils robotHttpUtils; /** * 创建机器人服务实例 * @param url IM服务器地址 * @param robotId 机器人ID * @param robotSecret 机器人密钥 */ public RobotService(String url, String robotId, String robotSecret) { robotHttpUtils = new RobotHttpUtils(url, robotId, robotSecret); } /** * 获取机器人ID * @return 机器人ID */ public String getRobotId() { return robotHttpUtils.getRobotId(); } /** * 发送消息 * @param sender 发送者用户ID * @param conversation 会话信息 * @param payload 消息内容 * @return 发送结果 * @throws Exception 请求失败时抛出异常 */ public IMResult sendMessage(String sender, Conversation conversation, MessagePayload payload) throws Exception { return sendMessage(sender, conversation, payload, null); } /** * 发送消息(可指定接收用户) * @param sender 发送者用户ID * @param conversation 会话信息 * @param payload 消息内容 * @param toUsers 接收用户ID列表 * @return 发送结果 * @throws Exception 请求失败时抛出异常 */ public IMResult sendMessage(String sender, Conversation conversation, MessagePayload payload, List toUsers) throws Exception { String path = APIPath.Robot_Message_Send; SendMessageData messageData = new SendMessageData(); messageData.setSender(sender); messageData.setConv(conversation); messageData.setToUsers(toUsers); messageData.setPayload(payload); return robotHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class); } public IMResult replyMessage(long messageUid, MessagePayload payload, boolean only2Sender) throws Exception { String path = APIPath.Robot_Message_Reply; ReplyMessageData messageData = new ReplyMessageData(); messageData.setMessageUid(messageUid); messageData.setOnly2Sender(only2Sender); messageData.setPayload(payload); return robotHttpUtils.httpJsonPost(path, messageData, SendMessageResult.class); } public IMResult recallMessage(long messageUid) throws Exception { String path = APIPath.Robot_Message_Recall; RecallMessageData messageData = new RecallMessageData(); messageData.setMessageUid(messageUid); return robotHttpUtils.httpJsonPost(path, messageData, String.class); } public IMResult updateMessage(long messageUid, MessagePayload payload) throws Exception { String path = APIPath.Robot_Message_Update; UpdateMessageContentData updateMessageContentData = new UpdateMessageContentData(); updateMessageContentData.setMessageUid(messageUid); updateMessageContentData.setPayload(payload); updateMessageContentData.setUpdateTimestamp(0); updateMessageContentData.setDistribute(1); return robotHttpUtils.httpJsonPost(path, updateMessageContentData, Void.class); } public IMResult getUserInfo(String userId) throws Exception { String path = APIPath.Robot_User_Info; InputGetUserInfo getUserInfo = new InputGetUserInfo(userId, null, null); return robotHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class); } public IMResult getUserInfoByMobile(String phone) throws Exception { String path = APIPath.Robot_User_Info; InputGetUserInfo getUserInfo = new InputGetUserInfo(null, null, phone); return robotHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class); } public IMResult getUserInfoByName(String userName) throws Exception { String path = APIPath.Robot_User_Info; InputGetUserInfo getUserInfo = new InputGetUserInfo(null, userName, null); return robotHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class); } public IMResult setCallback(String url) throws Exception { String path = APIPath.Robot_Set_Callback; RobotCallbackPojo pojo = new RobotCallbackPojo(); pojo.setUrl(url); return robotHttpUtils.httpJsonPost(path, pojo, Void.class); } public IMResult getCallback() throws Exception { String path = APIPath.Robot_Get_Callback; return robotHttpUtils.httpJsonPost(path, null, RobotCallbackPojo.class); } public IMResult deleteCallback() throws Exception { String path = APIPath.Robot_Delete_Callback; return robotHttpUtils.httpJsonPost(path, null, Void.class); } public IMResult getProfile() throws Exception { String path = APIPath.Robot_Get_Profile; return robotHttpUtils.httpJsonPost(path, null, OutputRobot.class); } /* type可选范围为MyInfoType,注意不能修改电话号码,如果要修改电话号码请使用adminapi进行修改 */ public IMResult updateProfile(int/*MyInfoType*/ type, String value) throws Exception { String path = APIPath.Robot_Update_Profile; IntStringPairPojo pojo = new IntStringPairPojo(type, value); return robotHttpUtils.httpJsonPost(path, pojo, Void.class); } public IMResult createGroup(PojoGroupInfo group_info, List members, String member_extra, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Robot_Create_Group; PojoGroup pojoGroup = new PojoGroup(); pojoGroup.setGroup_info(group_info); pojoGroup.setMembers(members); InputCreateGroup createGroup = new InputCreateGroup(); createGroup.setGroup(pojoGroup); createGroup.setMember_extra(member_extra); createGroup.setTo_lines(to_lines); createGroup.setNotify_message(notify_message); return robotHttpUtils.httpJsonPost(path, createGroup, OutputCreateGroupResult.class); } public IMResult getGroupInfo(String groupId) throws Exception { String path = APIPath.Robot_Group_Get_Info; InputGetGroup input = new InputGetGroup(); input.setGroupId(groupId); return robotHttpUtils.httpJsonPost(path, input, PojoGroupInfo.class); } public IMResult dismissGroup(String groupId, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Robot_Group_Dismiss; InputDismissGroup dismissGroup = new InputDismissGroup(); dismissGroup.setGroup_id(groupId); dismissGroup.setTo_lines(to_lines); dismissGroup.setNotify_message(notify_message); return robotHttpUtils.httpJsonPost(path, dismissGroup, Void.class); } public IMResult transferGroup(String groupId, String newOwner, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Robot_Group_Transfer; InputTransferGroup transferGroup = new InputTransferGroup(); transferGroup.setGroup_id(groupId); transferGroup.setNew_owner(newOwner); transferGroup.setTo_lines(to_lines); transferGroup.setNotify_message(notify_message); return robotHttpUtils.httpJsonPost(path, transferGroup, Void.class); } public IMResult modifyGroupInfo(String groupId, /*ModifyGroupInfoType*/int type, String value, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Robot_Group_Modify_Info; InputModifyGroupInfo modifyGroupInfo = new InputModifyGroupInfo(); modifyGroupInfo.setGroup_id(groupId); modifyGroupInfo.setTo_lines(to_lines); modifyGroupInfo.setType(type); modifyGroupInfo.setValue(value); modifyGroupInfo.setNotify_message(notify_message); return robotHttpUtils.httpJsonPost(path, modifyGroupInfo, Void.class); } public IMResult getGroupMembers(String groupId) throws Exception { String path = APIPath.Robot_Group_Member_List; InputGetGroup input = new InputGetGroup(); input.setGroupId(groupId); return robotHttpUtils.httpJsonPost(path, input, OutputGroupMemberList.class); } public IMResult getGroupMember(String groupId, String memberId) throws Exception { String path = APIPath.Robot_Group_Member_Get; InputGetGroupMember input = new InputGetGroupMember(); input.setGroupId(groupId); input.setMemberId(memberId); return robotHttpUtils.httpJsonPost(path, input, PojoGroupMember.class); } public IMResult addGroupMembers(String groupId, List groupMembers, String member_extra, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Robot_Group_Member_Add; InputAddGroupMember addGroupMember = new InputAddGroupMember(); addGroupMember.setGroup_id(groupId); addGroupMember.setMembers(groupMembers); addGroupMember.setMemberExtra(member_extra); addGroupMember.setTo_lines(to_lines); addGroupMember.setNotify_message(notify_message); return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class); } public IMResult setGroupManager(String groupId, List groupMemberIds, boolean isManager, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Robot_Group_Set_Manager; InputSetGroupManager addGroupMember = new InputSetGroupManager(); addGroupMember.setGroup_id(groupId); addGroupMember.setMembers(groupMemberIds); addGroupMember.setIs_manager(isManager); addGroupMember.setTo_lines(to_lines); addGroupMember.setNotify_message(notify_message); return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class); } public IMResult muteGroupMember(String groupId, List groupMemberIds, boolean isMute, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Robot_Group_Mute_Member; InputMuteGroupMember addGroupMember = new InputMuteGroupMember(); addGroupMember.setGroup_id(groupId); addGroupMember.setMembers(groupMemberIds); addGroupMember.setIs_manager(isMute); addGroupMember.setTo_lines(to_lines); addGroupMember.setNotify_message(notify_message); return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class); } public IMResult allowGroupMember(String groupId, List groupMemberIds, boolean isAllow, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Robot_Group_Allow_Member; InputMuteGroupMember addGroupMember = new InputMuteGroupMember(); addGroupMember.setGroup_id(groupId); addGroupMember.setMembers(groupMemberIds); addGroupMember.setIs_manager(isAllow); addGroupMember.setTo_lines(to_lines); addGroupMember.setNotify_message(notify_message); return robotHttpUtils.httpJsonPost(path, addGroupMember, Void.class); } public IMResult kickoffGroupMembers(String groupId, List groupMemberIds, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Robot_Group_Member_Kickoff; InputKickoffGroupMember kickoffGroupMember = new InputKickoffGroupMember(); kickoffGroupMember.setGroup_id(groupId); kickoffGroupMember.setMembers(groupMemberIds); kickoffGroupMember.setTo_lines(to_lines); kickoffGroupMember.setNotify_message(notify_message); return robotHttpUtils.httpJsonPost(path, kickoffGroupMember, Void.class); } public IMResult quitGroup(String groupId, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Robot_Group_Member_Quit; InputQuitGroup quitGroup = new InputQuitGroup(); quitGroup.setGroup_id(groupId); quitGroup.setTo_lines(to_lines); quitGroup.setNotify_message(notify_message); return robotHttpUtils.httpJsonPost(path, quitGroup, Void.class); } public IMResult setGroupMemberAlias(String groupId, String memberId, String alias, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Robot_Group_Set_Member_Alias; InputSetGroupMemberAlias input = new InputSetGroupMemberAlias(); input.setGroup_id(groupId); input.setMemberId(memberId); input.setAlias(alias); input.setTo_lines(to_lines); input.setNotify_message(notify_message); return robotHttpUtils.httpJsonPost(path, input, Void.class); } public IMResult setGroupMemberExtra(String groupId, String memberId, String extra, List to_lines, MessagePayload notify_message) throws Exception { String path = APIPath.Robot_Group_Set_Member_Extra; InputSetGroupMemberExtra input = new InputSetGroupMemberExtra(); input.setGroup_id(groupId); input.setMemberId(memberId); input.setExtra(extra); input.setTo_lines(to_lines); input.setNotify_message(notify_message); return robotHttpUtils.httpJsonPost(path, input, Void.class); } public IMResult applicationGetUserInfo(String authCode) throws Exception { String path = APIPath.Robot_Application_Get_UserInfo; InputApplicationGetUserInfo input = new InputApplicationGetUserInfo(); input.setAuthCode(authCode); return robotHttpUtils.httpJsonPost(path, input, OutputApplicationUserInfo.class); } public OutputApplicationConfigData getApplicationSignature() { int nonce = (int)(Math.random() * 100000 + 3); long timestamp = System.currentTimeMillis()/1000; String str = nonce + "|" + robotHttpUtils.getRobotId() + "|" + timestamp + "|" + robotHttpUtils.getRobotSecret(); String sign = DigestUtils.sha1Hex(str); OutputApplicationConfigData configData = new OutputApplicationConfigData(); configData.setAppId(robotHttpUtils.getRobotId()); configData.setAppType(ApplicationType_Robot); configData.setTimestamp(timestamp); configData.setNonceStr(nonce+""); configData.setSignature(sign); return configData; } public IMResult sendConferenceRequest(String robotId, String clientId, String request, long sessionId, String roomId, String data, boolean advance) throws Exception { String path = APIPath.Robot_Conference_Request; InputConferenceRequest input = new InputConferenceRequest(robotId, clientId, request, sessionId, roomId, data, advance); return robotHttpUtils.httpJsonPost(path, input, String.class); } public IMResult postMomentsFeed(int/*MomentsContentType*/ type, String text, List medias, List toUsers, List excludeUsers, List mentionedUsers, String extra) throws Exception { String path = APIPath.Robot_Moments_Post_Feed; FeedPojo feedPojo = new FeedPojo(); feedPojo.type = type; feedPojo.text = text; feedPojo.medias = medias; feedPojo.to = toUsers; feedPojo.ex = excludeUsers; feedPojo.mu = mentionedUsers; feedPojo.extra = extra; IMResult imResult = robotHttpUtils.httpJsonPost(path, feedPojo, PostFeedResult.class); IMResult feedResult = new IMResult<>(); if(imResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { feedPojo.feedId = imResult.result.id; feedPojo.timestamp = imResult.result.timestamp; feedResult.setCode(ErrorCode.ERROR_CODE_SUCCESS.getCode()); feedResult.setResult(feedPojo); } else { feedResult.setCode(imResult.getCode()); feedResult.setMsg(imResult.getMsg()); } return feedResult; } public IMResult updateMomentsFeed(long feedId, int/*MomentsContentType*/ type, String text, List medias, List toUsers, List excludeUsers, List mentionedUsers, String extra) throws Exception { String path = APIPath.Robot_Moments_Update_Feed; FeedPojo feedPojo = new FeedPojo(); feedPojo.feedId = feedId; feedPojo.type = type; feedPojo.text = text; feedPojo.medias = medias; feedPojo.to = toUsers; feedPojo.ex = excludeUsers; feedPojo.mu = mentionedUsers; feedPojo.extra = extra; return robotHttpUtils.httpJsonPost(path, feedPojo, Void.class); } public IMResult getMomentsFeeds(long feedId, int count, String user) throws Exception { String path = APIPath.Robot_Moments_Pull_Feeds; PullFeedRequestPojo requestPojo = new PullFeedRequestPojo(); requestPojo.feedId = feedId; requestPojo.count = count; requestPojo.user = user; return robotHttpUtils.httpJsonPost(path, requestPojo, FeedsPojo.class); } public IMResult getMomentsFeed(long feedId) throws Exception { String path = APIPath.Robot_Moments_Fetch_Feed; PullOneFeedRequestPojo requestPojo = new PullOneFeedRequestPojo(); requestPojo.feedId = feedId; return robotHttpUtils.httpJsonPost(path, requestPojo, FeedPojo.class); } public IMResult deleteMomentsFeed(long feedId) throws Exception { String path = APIPath.Robot_Moments_Recall_Feed; IdPojo requestPojo = new IdPojo(); requestPojo.id = feedId; return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class); } public IMResult postMomentsComment(long feedId, long replyId, int/*MomentsCommentType*/ type, String text, String replyTo, String extra) throws Exception { String path = APIPath.Robot_Moments_Post_Comment; CommentPojo commentPojo = new CommentPojo(); commentPojo.type = type; commentPojo.text = text; commentPojo.replyId = replyId; commentPojo.feedId = feedId; commentPojo.replyTo = replyTo; commentPojo.extra = extra; IMResult imResult = robotHttpUtils.httpJsonPost(path, commentPojo, PostFeedResult.class); IMResult feedResult = new IMResult<>(); if(imResult.getErrorCode() == ErrorCode.ERROR_CODE_SUCCESS) { commentPojo.commentId = imResult.result.id; commentPojo.timestamp = imResult.result.timestamp; feedResult.setCode(ErrorCode.ERROR_CODE_SUCCESS.getCode()); feedResult.setResult(commentPojo); } else { feedResult.setCode(imResult.getCode()); feedResult.setMsg(imResult.getMsg()); } return feedResult; } public IMResult deleteMomentsComment(long feedId, long commentId) throws Exception { String path = APIPath.Robot_Moments_Recall_Comment; IdPojo requestPojo = new IdPojo(); requestPojo.id = commentId; requestPojo.id2 = feedId; return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class); } public IMResult getUserMomentsProfile(String userId) throws Exception { String path = APIPath.Robot_Moments_Fetch_Profiles; PullProfileRequestPojo requestPojo = new PullProfileRequestPojo(); requestPojo.u = userId; return robotHttpUtils.httpJsonPost(path, requestPojo, MomentProfilePojo.class); } public IMResult updateMomentsBackgroundUrl(String url) throws Exception { String path = APIPath.Robot_Moments_Update_Profiles_Value; PushProfileValueRequestPojo requestPojo = new PushProfileValueRequestPojo(); requestPojo.t = 0; requestPojo.v = url; return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class); } public IMResult updateMomentsStrangerVisibleCount(int count) throws Exception { String path = APIPath.Robot_Moments_Update_Profiles_Value; PushProfileValueRequestPojo requestPojo = new PushProfileValueRequestPojo(); requestPojo.t = 1; requestPojo.i = count; return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class); } public IMResult updateMomentsVisibleScope(int/*MomentsVisibleScope*/ scope) throws Exception { String path = APIPath.Robot_Moments_Update_Profiles_Value; PushProfileValueRequestPojo requestPojo = new PushProfileValueRequestPojo(); requestPojo.t = 2; requestPojo.i = scope; return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class); } public IMResult updateMomentsBlackList(List addList, List removeList) throws Exception { String path = APIPath.Robot_Moments_Update_Profiles_List_Value; PushProfileListRequestPojo requestPojo = new PushProfileListRequestPojo(); requestPojo.b = false; requestPojo.al = addList; requestPojo.rl = removeList; return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class); } public IMResult updateMomentsBlockList(List addList, List removeList) throws Exception { String path = APIPath.Robot_Moments_Update_Profiles_List_Value; PushProfileListRequestPojo requestPojo = new PushProfileListRequestPojo(); requestPojo.b = true; requestPojo.al = addList; requestPojo.rl = removeList; return robotHttpUtils.httpJsonPost(path, requestPojo, Void.class); } public IMResult getPresignedUploadUrl(String fileName, int/*ProtoConstants.MessageMediaType*/ mediaType, String contentType) throws Exception { String path = APIPath.Robot_Get_Presigned_Upload_Url; InputGetPresignedUploadUrl requestPojo = new InputGetPresignedUploadUrl(); requestPojo.fileName = fileName; requestPojo.mediaType = mediaType; requestPojo.contentType = contentType; return robotHttpUtils.httpJsonPost(path, requestPojo, OutputPresignedUploadUrl.class); } /** * 根据文件名获取Content-Type * * @param fileName 文件名 * @return Content-Type,如果无法识别则返回 "application/octet-stream" */ private String getContentTypeByFileName(String fileName) { if (fileName == null || fileName.isEmpty()) { return "application/octet-stream"; } // 首先尝试使用 URLConnection 猜测 String contentType = URLConnection.guessContentTypeFromName(fileName); // 如果无法识别,使用常见扩展名映射 if (contentType == null) { String lowerName = fileName.toLowerCase(); if (lowerName.endsWith(".jpg") || lowerName.endsWith(".jpeg")) { contentType = "image/jpeg"; } else if (lowerName.endsWith(".png")) { contentType = "image/png"; } else if (lowerName.endsWith(".gif")) { contentType = "image/gif"; } else if (lowerName.endsWith(".bmp")) { contentType = "image/bmp"; } else if (lowerName.endsWith(".webp")) { contentType = "image/webp"; } else if (lowerName.endsWith(".mp4")) { contentType = "video/mp4"; } else if (lowerName.endsWith(".mov")) { contentType = "video/quicktime"; } else if (lowerName.endsWith(".avi")) { contentType = "video/x-msvideo"; } else if (lowerName.endsWith(".mp3")) { contentType = "audio/mpeg"; } else if (lowerName.endsWith(".wav")) { contentType = "audio/wav"; } else if (lowerName.endsWith(".pdf")) { contentType = "application/pdf"; } else if (lowerName.endsWith(".doc")) { contentType = "application/msword"; } else if (lowerName.endsWith(".docx")) { contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; } else if (lowerName.endsWith(".xls")) { contentType = "application/vnd.ms-excel"; } else if (lowerName.endsWith(".xlsx")) { contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; } else if (lowerName.endsWith(".ppt")) { contentType = "application/vnd.ms-powerpoint"; } else if (lowerName.endsWith(".pptx")) { contentType = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; } else if (lowerName.endsWith(".txt")) { contentType = "text/plain"; } else if (lowerName.endsWith(".html") || lowerName.endsWith(".htm")) { contentType = "text/html"; } else if (lowerName.endsWith(".json")) { contentType = "application/json"; } else if (lowerName.endsWith(".xml")) { contentType = "application/xml"; } else if (lowerName.endsWith(".zip")) { contentType = "application/zip"; } else if (lowerName.endsWith(".rar")) { contentType = "application/x-rar-compressed"; } else if (lowerName.endsWith(".7z")) { contentType = "application/x-7z-compressed"; } else if (lowerName.endsWith(".tar")) { contentType = "application/x-tar"; } else if (lowerName.endsWith(".gz")) { contentType = "application/gzip"; } else { contentType = "application/octet-stream"; } } return contentType; } /** * 上传文件 *

* 流程:先调用getPresignedUploadUrl获取预签名上传地址,然后直接上传文件。 * 上传成功后返回文件的下载地址等信息。 *

* * @param file 要上传的文件 * @return 上传结果,包含下载地址 * @throws Exception 上传失败时抛出异常 */ public IMResult uploadFile(File file) throws Exception { return uploadFile(file, ProtoConstants.MessageMediaType.FILE, null); } /** * 上传文件 *

* 流程:先调用getPresignedUploadUrl获取预签名上传地址,然后直接上传文件。 * 上传成功后返回文件的下载地址等信息。 *

* * @param file 要上传的文件 * @param mediaType 媒体类型,参考{@link cn.wildfirechat.proto.ProtoConstants.MessageMediaType} * @param contentType 文件Content-Type,例如 "image/jpeg", "application/octet-stream" 等; * 如果为null或空,则根据文件名自动识别 * @return 上传结果,包含下载地址 * @throws Exception 上传失败时抛出异常 */ public IMResult uploadFile(File file, int mediaType, String contentType) throws Exception { if (file == null || !file.exists()) { throw new IllegalArgumentException("文件不能为空或不存在"); } // 如果未指定Content-Type,根据文件名自动获取 if (contentType == null || contentType.isEmpty()) { contentType = getContentTypeByFileName(file.getName()); } return doUploadFile(file.getName(), mediaType, contentType, file, null); } /** * 执行文件上传的公共方法 *

* 根据服务器类型选择不同的上传方式: *

    *
  • type = 1(七牛云):使用 POST + multipart/form-data 表单上传
  • *
  • type = 其他(阿里云、Minio等):使用 PUT + 二进制流上传
  • *
*

* * @param fileName 文件名 * @param mediaType 媒体类型 * @param contentType Content-Type * @param file 文件对象(用于七牛云上传) * @param inputStream 输入流(用于其他类型上传,可为null) * @return 上传结果 * @throws Exception 上传失败时抛出异常 */ private IMResult doUploadFile(String fileName, int mediaType, String contentType, File file, InputStream inputStream) throws Exception { // 1. 获取预签名上传地址 IMResult presignedResult = getPresignedUploadUrl( fileName, mediaType, contentType); if (presignedResult.getErrorCode() != ErrorCode.ERROR_CODE_SUCCESS) { IMResult imResult = new IMResult<>(); imResult.setCode(presignedResult.code); imResult.setMsg(presignedResult.msg); return imResult; } OutputPresignedUploadUrl presignedUrl = presignedResult.getResult(); if (presignedUrl == null || presignedUrl.uploadUrl == null) { throw new Exception("预签名上传地址为空"); } // 2. 根据服务器类型选择上传方式 if (presignedUrl.type == 1) { // 七牛云:使用 POST + multipart/form-data 表单上传 return uploadToQiniu(presignedUrl, file, inputStream, fileName, contentType); } else { // 其他(阿里云、Minio、腾讯云、华为云、AWS S3等):使用 PUT 上传 return uploadToOther(presignedUrl, file, inputStream, contentType); } } /** * 上传到七牛云(type = 1) * 使用 POST + multipart/form-data 表单格式 */ private IMResult uploadToQiniu(OutputPresignedUploadUrl presignedUrl, File file, InputStream inputStream, String fileName, String contentType) throws Exception { // 解析七牛云上传地址:格式为 "https://host?token?key" String uploadUrl = presignedUrl.uploadUrl; String token; String key; int tokenStart = uploadUrl.indexOf('?'); int keyStart = uploadUrl.indexOf('?', tokenStart + 1); if (tokenStart == -1 || keyStart == -1) { throw new Exception("七牛云上传地址格式错误"); } String baseUrl = uploadUrl.substring(0, tokenStart); token = uploadUrl.substring(tokenStart + 1, keyStart); key = uploadUrl.substring(keyStart + 1); HttpPost httpPost = new HttpPost(baseUrl); try { MultipartEntityBuilder builder = MultipartEntityBuilder.create(); // 添加 token 和 key 字段 builder.addTextBody("token", token); builder.addTextBody("key", key); // 添加文件字段 if (file != null) { builder.addPart("file", new FileBody(file, ContentType.create(contentType), fileName)); } else if (inputStream != null) { builder.addPart("file", new InputStreamBody(inputStream, ContentType.create(contentType), fileName)); } httpPost.setEntity(builder.build()); HttpResponse response = robotHttpUtils.getHttpClient().execute(httpPost); int statusCode = response.getStatusLine().getStatusCode(); // 消耗响应体 if (response.getEntity() != null) { EntityUtils.consumeQuietly(response.getEntity()); } // 七牛云返回 200 表示成功 if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_CREATED) { throw new Exception("文件上传到七牛云失败,HTTP状态码:" + statusCode); } IMResult imResult = new IMResult<>(); imResult.setCode(0); imResult.setResult(presignedUrl.downloadUrl); return imResult; } finally { httpPost.releaseConnection(); } } /** * 上传到其他对象存储(type != 1) * 使用 PUT + 二进制流 */ private IMResult uploadToOther(OutputPresignedUploadUrl presignedUrl, File file, InputStream inputStream, String contentType) throws Exception { HttpPut httpPut = new HttpPut(presignedUrl.uploadUrl); try { // 设置请求实体 if (file != null) { FileEntity fileEntity = new FileEntity(file); fileEntity.setContentType(contentType); httpPut.setEntity(fileEntity); } else if (inputStream != null) { InputStreamEntity streamEntity = new InputStreamEntity(inputStream); streamEntity.setContentType(contentType); httpPut.setEntity(streamEntity); } HttpResponse response = robotHttpUtils.getHttpClient().execute(httpPut); int statusCode = response.getStatusLine().getStatusCode(); // 消耗响应体,确保连接可以被复用 if (response.getEntity() != null) { EntityUtils.consumeQuietly(response.getEntity()); } if (statusCode != HttpStatus.SC_OK && statusCode != HttpStatus.SC_CREATED) { throw new Exception("文件上传失败,HTTP状态码:" + statusCode); } IMResult imResult = new IMResult<>(); imResult.setCode(0); imResult.setResult(presignedUrl.downloadUrl); return imResult; } finally { httpPut.releaseConnection(); } } /** * 上传文件(通过输入流) *

* 流程:先调用getPresignedUploadUrl获取预签名上传地址,然后直接上传文件。 * 上传成功后返回文件的下载地址等信息。 *

* * @param inputStream 文件输入流 * @param fileName 文件名 * @return 上传结果,包含下载地址 * @throws Exception 上传失败时抛出异常 */ public IMResult uploadFile(InputStream inputStream, String fileName) throws Exception { return uploadFile(inputStream, fileName, ProtoConstants.MessageMediaType.FILE, null); } /** * 上传文件(通过输入流) *

* 流程:先调用getPresignedUploadUrl获取预签名上传地址,然后直接上传文件。 * 上传成功后返回文件的下载地址等信息。 *

*

* 注意:无论上传成功还是失败,此方法都会关闭输入流。 *

* * @param inputStream 文件输入流(此方法会关闭该流) * @param fileName 文件名 * @param mediaType 媒体类型,参考{@link cn.wildfirechat.proto.ProtoConstants.MessageMediaType} * @param contentType 文件Content-Type,例如 "image/jpeg", "application/octet-stream" 等; * 如果为null或空,则根据文件名自动识别 * @return 上传结果,包含下载地址 * @throws Exception 上传失败时抛出异常 */ public IMResult uploadFile(InputStream inputStream, String fileName, int mediaType, String contentType) throws Exception { if (inputStream == null) { throw new IllegalArgumentException("输入流不能为空"); } // 如果未指定Content-Type,根据文件名自动获取 if (contentType == null || contentType.isEmpty()) { contentType = getContentTypeByFileName(fileName); } return doUploadFile(fileName, mediaType, contentType, null, inputStream); // 注意:正常流程下的流关闭在 uploadToQiniu 或 uploadToOther 的 finally 块中处理 } @Override public void close() throws IOException { robotHttpUtils.close(); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/SensitiveAdmin.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.*; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; import java.util.List; /** * 敏感词管理类 *

* 提供敏感词管理相关的功能,包括: *

    *
  • 添加敏感词
  • *
  • 删除敏感词
  • *
  • 查询敏感词列表
  • *
*

*/ public class SensitiveAdmin { /** * 添加敏感词 * @param sensitives 敏感词列表 * @return 添加结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult addSensitives(List sensitives) throws Exception { String path = APIPath.Sensitive_Add; InputOutputSensitiveWords input = new InputOutputSensitiveWords(); input.setWords(sensitives); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 删除敏感词 * @param sensitives 敏感词列表 * @return 删除结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult removeSensitives(List sensitives) throws Exception { String path = APIPath.Sensitive_Del; InputOutputSensitiveWords input = new InputOutputSensitiveWords(); input.setWords(sensitives); return AdminHttpUtils.httpJsonPost(path, input, Void.class); } /** * 获取敏感词列表 * @return 敏感词列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getSensitives() throws Exception { String path = APIPath.Sensitive_Query; return AdminHttpUtils.httpJsonPost(path, null, InputOutputSensitiveWords.class); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/UserAdmin.java ================================================ package cn.wildfirechat.sdk; import cn.wildfirechat.common.APIPath; import cn.wildfirechat.pojos.*; import cn.wildfirechat.sdk.model.IMResult; import cn.wildfirechat.sdk.utilities.AdminHttpUtils; import java.util.List; /** * 用户管理类 *

* 提供用户管理相关的功能,包括: *

    *
  • 用户信息的获取、创建、更新、销毁
  • *
  • 机器人管理
  • *
  • 用户封禁状态管理
  • *
  • 用户在线状态查询
  • *
  • 用户设备管理
  • *
  • 用户Token管理
  • *
*

*/ public class UserAdmin { /** * 根据用户名获取用户信息(不包含已删除用户) * @param name 用户名 * @return 用户信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserByName(String name) throws Exception { return getUserByName(name, false); } /** * 根据用户名获取用户信息 * @param name 用户名 * @param includeDeleted 是否包含已删除的用户 * @return 用户信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserByName(String name, boolean includeDeleted) throws Exception { String path = APIPath.User_Get_Info; InputGetUserInfo getUserInfo = new InputGetUserInfo(null, name, null, includeDeleted); return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class); } /** * 根据用户ID获取用户信息(不包含已删除用户) * @param userId 用户ID * @return 用户信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserByUserId(String userId) throws Exception { return getUserByUserId(userId, false); } /** * 根据用户ID获取用户信息 * @param userId 用户ID * @param includeDeleted 是否包含已删除的用户 * @return 用户信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserByUserId(String userId, boolean includeDeleted) throws Exception { String path = APIPath.User_Get_Info; InputGetUserInfo getUserInfo = new InputGetUserInfo(userId, null, null, includeDeleted); return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class); } /** * 根据手机号获取用户信息(不包含已删除用户) * @param mobile 手机号 * @return 用户信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserByMobile(String mobile) throws Exception { return getUserByMobile(mobile, false); } /** * 根据手机号获取用户信息 * @param mobile 手机号 * @param includeDeleted 是否包含已删除的用户 * @return 用户信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserByMobile(String mobile, boolean includeDeleted) throws Exception { String path = APIPath.User_Get_Info; InputGetUserInfo getUserInfo = new InputGetUserInfo(null, null, mobile, includeDeleted); return AdminHttpUtils.httpJsonPost(path, getUserInfo, InputOutputUserInfo.class); } /** * 根据邮箱获取用户信息列表 * @param email 邮箱地址 * @return 用户信息列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserByEmail(String email) throws Exception { String path = APIPath.User_Get_Email_Info; return AdminHttpUtils.httpJsonPost(path, email, OutputUserInfoList.class); } /** * 获取所有用户列表(分页) * @param count 每页数量 * @param offset 偏移量 * @return 用户列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getAllUsers(int count, int offset) throws Exception { String path = APIPath.User_Get_All; InputGetUserList input = new InputGetUserList(); input.count = count; input.offset = offset; return AdminHttpUtils.httpJsonPost(path, input, OutputGetUserList.class); } /** * 批量获取用户信息 * @param userIds 用户ID列表 * @return 用户信息列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getBatchUsers(List userIds) throws Exception { String path = APIPath.User_Batch_Get_Infos; InputStringList input = new InputStringList(); input.setList(userIds); return AdminHttpUtils.httpJsonPost(path, input, OutputUserInfoList.class); } /** * 创建用户 * @param user 用户信息 * @return 创建结果,包含用户ID * @throws Exception 请求失败时抛出异常 */ public static IMResult createUser(InputOutputUserInfo user) throws Exception { String path = APIPath.Create_User; return AdminHttpUtils.httpJsonPost(path, user, OutputCreateUser.class); } /** * 更新用户信息 * @param user 用户信息 * @param flag 更新标志位,指定要更新的字段(UpdateUserInfoMask) * @return 更新结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult updateUserInfo(InputOutputUserInfo user, int/*UpdateUserInfoMask*/ flag) throws Exception { String path = APIPath.Update_User; InputUpdateUserInfo updateUserInfo = new InputUpdateUserInfo(); updateUserInfo.flag = flag; updateUserInfo.userInfo = user; return AdminHttpUtils.httpJsonPost(path, updateUserInfo, Void.class); } /** * 创建机器人 * @param robot 机器人信息 * @return 创建结果,包含机器人ID和Token * @throws Exception 请求失败时抛出异常 */ public static IMResult createRobot(InputCreateRobot robot) throws Exception { String path = APIPath.Create_Robot; return AdminHttpUtils.httpJsonPost(path, robot, OutputCreateRobot.class); } /** * 销毁机器人 *

销毁机器人和销毁用户使用同一个接口

* @param userId 机器人用户ID * @return 销毁结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult destroyRobot(String userId) throws Exception { String path = APIPath.Destroy_User; InputDestroyUser inputDestroyUser = new InputDestroyUser(); inputDestroyUser.setUserId(userId); return AdminHttpUtils.httpJsonPost(path, inputDestroyUser, Void.class); } /** * 获取机器人信息 * @param robotId 机器人ID * @return 机器人信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getRobotInfo(String robotId) throws Exception { String path = APIPath.User_Get_Robot_Info; InputRobotId getRobotInfo = new InputRobotId(); getRobotInfo.setRobotId(robotId); return AdminHttpUtils.httpJsonPost(path, getRobotInfo, OutputRobot.class); } /** * 获取用户的机器人列表 * @param userId 用户ID * @return 机器人ID列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserRobots(String userId) throws Exception { String path = APIPath.User_Get_User_Robots; InputUserId getRobotInfo = new InputUserId(); getRobotInfo.setUserId(userId); return AdminHttpUtils.httpJsonPost(path, getRobotInfo, OutputStringList.class); } /** * 获取用户的IM Token * @param userId 用户ID * @param clientId 客户端ID * @param platform 平台类型 * @return Token信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserToken(String userId, String clientId, int platform) throws Exception { String path = APIPath.User_Get_Token; InputGetToken getToken = new InputGetToken(userId, clientId, platform); return AdminHttpUtils.httpJsonPost(path, getToken, OutputGetIMTokenData.class); } /** * 更新用户封禁状态 * @param userId 用户ID * @param block 封禁状态:0-正常,1-封禁 * @return 更新结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult updateUserBlockStatus(String userId, int block) throws Exception { String path = APIPath.User_Update_Block_Status; InputOutputUserBlockStatus blockStatus = new InputOutputUserBlockStatus(userId, block); return AdminHttpUtils.httpJsonPost(path, blockStatus, Void.class); } /** * 检查用户封禁状态 * @param userId 用户ID * @return 用户封禁状态 * @throws Exception 请求失败时抛出异常 */ public static IMResult checkUserBlockStatus(String userId) throws Exception { String path = APIPath.User_Check_Block_Status; InputGetUserInfo getUserInfo = new InputGetUserInfo(userId, null, null); return AdminHttpUtils.httpJsonPost(path, getUserInfo, OutputUserStatus.class); } /** * 获取被封禁用户列表 * @return 被封禁用户列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getBlockedList() throws Exception { String path = APIPath.User_Get_Blocked_List; return AdminHttpUtils.httpJsonPost(path, null, OutputUserBlockStatusList.class); } /** * 检查用户在线状态 * @param userId 用户ID * @return 用户在线状态 * @throws Exception 请求失败时抛出异常 */ public static IMResult checkUserOnlineStatus(String userId) throws Exception { String path = APIPath.User_Get_Online_Status; InputGetUserInfo getUserInfo = new InputGetUserInfo(userId, null, null); return AdminHttpUtils.httpJsonPost(path, getUserInfo, OutputCheckUserOnline.class); } /** * 强迫用户下线 *

* 强迫用户下线后,用户需要重新获取token才能进行连接。 * userId必须有效,clientId可以为空。 * 当clientId为空时,踢下线所有客户端;当不为空时仅踢掉对应客户端。 *

* @param userId 用户ID * @param clientId 客户端ID,为空时踢下线所有客户端 * @return 下线结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult kickoffUserClient(String userId, String clientId) throws Exception { String path = APIPath.User_Kickoff_Client; StringPairPojo pojo = new StringPairPojo(userId, clientId); return AdminHttpUtils.httpJsonPost(path, pojo, Void.class); } /** * 销毁用户 * @param userId 用户ID * @return 销毁结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult destroyUser(String userId) throws Exception { String path = APIPath.Destroy_User; InputDestroyUser inputDestroyUser = new InputDestroyUser(); inputDestroyUser.setUserId(userId); return AdminHttpUtils.httpJsonPost(path, inputDestroyUser, Void.class); } /** * 创建或更新设备信息(仅专业版支持) * @param device 设备信息 * @return 创建或更新结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult createOrUpdateDevice(InputCreateDevice device) throws Exception { String path = APIPath.CreateOrUpdate_Device; return AdminHttpUtils.httpJsonPost(path, device, OutputCreateDevice.class); } /** * 获取设备信息(仅专业版支持) * @param deviceId 设备ID * @return 设备信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getDevice(String deviceId) throws Exception { String path = APIPath.Get_Device; InputDeviceId inputDeviceId = new InputDeviceId(); inputDeviceId.setDeviceId(deviceId); return AdminHttpUtils.httpJsonPost(path, inputDeviceId, OutputDevice.class); } /** * 获取用户的设备列表 * @param userId 用户ID * @return 用户设备列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserDevices(String userId) throws Exception { String path = APIPath.Get_User_Devices; InputUserId inputUserId = new InputUserId(); inputUserId.setUserId(userId); return AdminHttpUtils.httpJsonPost(path, inputUserId, OutputDeviceList.class); } /** * 获取在线用户数量 * @return 在线用户数量统计结果 * @throws Exception 请求失败时抛出异常 */ public static IMResult getOnlineUserCount() throws Exception { return AdminHttpUtils.httpJsonPost(APIPath.User_Online_Count, null, GetOnlineUserCountResult.class); } /** * 获取在线用户列表(分页) * @param nodeId 节点ID,用于分布式部署场景 * @param offset 偏移量 * @param count 每页数量 * @return 在线用户列表 * @throws Exception 请求失败时抛出异常 */ public static IMResult getOnlineUser(int nodeId, int offset, int count) throws Exception { GetOnlineUserRequest request = new GetOnlineUserRequest(); request.nodeId = nodeId; request.offset = offset; request.count = count; return AdminHttpUtils.httpJsonPost(APIPath.User_Online_List, request, GetOnlineUserResult.class); } /** * 通过应用授权码获取用户信息 * @param authCode 应用授权码 * @return 用户信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult applicationGetUserInfo(String authCode) throws Exception { String path = APIPath.User_Application_Get_UserInfo; InputApplicationGetUserInfo input = new InputApplicationGetUserInfo(); input.setAuthCode(authCode); return AdminHttpUtils.httpJsonPost(path, input, OutputApplicationUserInfo.class); } /** * 获取用户会话信息 * @param userId 用户ID * @return 用户会话信息 * @throws Exception 请求失败时抛出异常 */ public static IMResult getUserSession(String userId) throws Exception { InputUserId inputUserId = new InputUserId(userId); return AdminHttpUtils.httpJsonPost(APIPath.User_Session_List, inputUserId, GetUserSessionResult.class); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/ArticlesMessageContent.java ================================================ /* * Copyright (c) 2022 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import java.util.ArrayList; import java.util.Base64; import java.util.List; /** * 图文消息内容类 *

* 表示图文链接类型的消息内容,包含一个主文章和多个子文章。 * 通常用于公众号文章分享等场景。 *

*/ public class ArticlesMessageContent extends MessageContent { public Article topArticle; public ArrayList
subArticles; @Override public int getContentType() { return ProtoConstants.ContentType.Articles; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setSearchableContent(topArticle.title); JSONObject object = new JSONObject(); object.put("top", topArticle.toJson()); if (subArticles != null) { JSONArray jsonArray = new JSONArray(); object.put("subArticles", jsonArray); for (Article article : subArticles) { jsonArray.add(article.toJson()); } } payload.setBase64edData(Base64.getEncoder().encodeToString(object.toString().getBytes())); return payload; } @Override public void decode(MessagePayload payload) { try { super.decode(payload); JSONObject object = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData()))); JSONObject topObj = (JSONObject) object.get("top"); this.topArticle = Article.fromJson(topObj); JSONArray jsonArray = (JSONArray) object.get("subArticles"); if (jsonArray != null && jsonArray.size() > 0) { this.subArticles = new ArrayList<>(); for (int i = 0; i < jsonArray.size(); i++) { subArticles.add(Article.fromJson((JSONObject) jsonArray.get(i))); } } } catch (ParseException e) { throw new RuntimeException(e); } } public List toLinkMessageContent() { List contents = new ArrayList<>(); contents.add(this.topArticle.toLinkMessageContent()); if (this.subArticles != null) { for (Article article : subArticles) { contents.add(article.toLinkMessageContent()); } } return contents; } public static class Article { public String articleId; public String cover; public String title; public String digest; public String url; boolean readReport; JSONObject toJson() { JSONObject obj = new JSONObject(); obj.put("id", articleId); obj.put("cover", cover); obj.put("title", title); obj.put("digest", digest); obj.put("url", url); obj.put("rr", readReport); return obj; } static Article fromJson(JSONObject obj) { Article article = new Article(); article.articleId = (String) obj.get("id"); article.cover = (String) obj.get("cover"); article.title = (String) obj.get("title"); article.digest = (String) obj.get("digest"); article.url = (String) obj.get("url"); article.readReport = (boolean) obj.get("rr"); return article; } public LinkMessageContent toLinkMessageContent() { LinkMessageContent content = new LinkMessageContent(this.title, this.url); content.setContentDigest(this.digest); content.setThumbnailUrl(this.cover); return content; } public Article() { } } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/CallStartMessageContent.java ================================================ /* * Copyright (c) 2020 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import io.netty.util.internal.StringUtil; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import java.util.ArrayList; import java.util.Base64; import java.util.List; /** * Created by heavyrain lee on 2017/12/6. */ /** * 音视频通话消息内容类 *

* 表示音视频通话相关的消息内容,包含通话ID、参与者、连接时间等信息。 * 支持一对一和多人音视频通话。 *

*/ public class CallStartMessageContent extends MessageContent { private String callId; // 多人视音频是有效,不包含自己,一对一忽略此参数 private List targetIds; private long connectTime; private long endTime; private boolean audioOnly; private String pin; /** * 0, UnKnown, * 1, Busy, * 2, SignalError, * 3, Hangup, * 4, MediaError, * 5, RemoteHangup, * 6, OpenCameraFailure, * 7, Timeout, * 8, AcceptByOtherClient */ private int status; /** * 0,未知;1,多人版音视频;2,高级版音视频 */ private int type; public CallStartMessageContent() { } public CallStartMessageContent(String callId, List targetIds, boolean audioOnly) { this.callId = callId; this.audioOnly = audioOnly; this.targetIds = targetIds; } public String getCallId() { return callId; } public void setCallId(String callId) { this.callId = callId; } public long getConnectTime() { return connectTime; } public void setConnectTime(long connectTime) { this.connectTime = connectTime; } public long getEndTime() { return endTime; } public void setEndTime(long endTime) { this.endTime = endTime; } public int getStatus() { return status; } public void setStatus(int status) { this.status = status; } public boolean isAudioOnly() { return audioOnly; } public void setAudioOnly(boolean audioOnly) { this.audioOnly = audioOnly; } public List getTargetIds() { return targetIds; } public void setTargetIds(List targetIds) { this.targetIds = targetIds; } public String getPin() { return pin; } public void setPin(String pin) { this.pin = pin; } public int getType() { return type; } public void setType(int type) { this.type = type; } @Override public int getContentType() { return ProtoConstants.ContentType.Call_Start; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setContent(callId); payload.setPushContent("音视频通话邀请"); JSONObject objWrite = new JSONObject(); if (connectTime > 0) { objWrite.put("c", connectTime); } if (endTime > 0) { objWrite.put("e", endTime); } if (status > 0) { objWrite.put("s", status); } objWrite.put("t", targetIds.get(0)); JSONArray ts = new JSONArray(); ts.addAll(targetIds); objWrite.put("ts", ts); objWrite.put("a", audioOnly ? 1 : 0); objWrite.put("p", pin); if (this.type > 0) { objWrite.put("ty", this.type); } payload.setBase64edData(Base64.getEncoder().encodeToString(objWrite.toString().getBytes())); JSONObject pushDataWrite = new JSONObject(); pushDataWrite.put("callId", callId); pushDataWrite.put("audioOnly", audioOnly); if (targetIds != null && targetIds.size() > 0) { pushDataWrite.put("participants", targetIds); } payload.setPushData(pushDataWrite.toString()); return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); callId = payload.getContent(); try { if (!StringUtil.isNullOrEmpty(payload.getBase64edData())) { JSONObject jsonObject = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData()))); connectTime = (long) jsonObject.get("c"); endTime = (long) jsonObject.get("e"); status = (int) jsonObject.get("s"); pin = (String) jsonObject.get("p"); type = (int) jsonObject.get("ty"); JSONArray array = (JSONArray) jsonObject.get("ts"); targetIds = new ArrayList<>(); if (array == null) { targetIds.add((String) jsonObject.get("t")); } else { for (int i = 0; i < array.size(); i++) { if (array.get(i) instanceof String) { targetIds.add((String) array.get(i)); } } } audioOnly = (int)jsonObject.get("a") > 0; } } catch (ParseException e) { throw new RuntimeException(e); } } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/CardMessageContent.java ================================================ /* * Copyright (c) 2020 WildFireChat. All rights reserved. */ /* * Copyright (c) 2020 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import io.netty.util.internal.StringUtil; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import java.util.Base64; /** * 名片消息内容类 *

* 表示分享的名片消息,可以是用户名片、群组名片、聊天室名片或频道名片。 *

*/ public class CardMessageContent extends MessageContent { /** * 0,用户;1,群组;2,聊天室;3,频道 */ private int type; private String target; // 用户名,一般是type为用户时使用 private String name; private String displayName; private String portrait; private String from; public CardMessageContent() { } public CardMessageContent(int type, String target, String displayName, String portrait, String from) { this.type = type; this.target = target; this.displayName = displayName; this.portrait = portrait; this.from = from; } public String getTarget() { return target; } public void setTarget(String target) { this.target = target; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDisplayName() { return displayName; } public void setDisplayName(String displayName) { this.displayName = displayName; } public String getPortrait() { return portrait; } public void setPortrait(String portrait) { this.portrait = portrait; } public int getType() { return type; } public void setType(int type) { this.type = type; } public String getFrom() { return from; } public void setFrom(String from) { this.from = from; } @Override public int getContentType() { return ProtoConstants.ContentType.Name_Card; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setContent(target); JSONObject objWrite = new JSONObject(); objWrite.put("t", type); objWrite.put("n", name); objWrite.put("d", displayName); objWrite.put("p", portrait); objWrite.put("f", from); payload.setBase64edData(Base64.getEncoder().encodeToString(objWrite.toString().getBytes())); return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); target = payload.getContent(); try { if (!StringUtil.isNullOrEmpty(payload.getBase64edData())) { JSONObject jsonObject = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData()))); type = (int) jsonObject.get("t"); name = (String) jsonObject.get("n"); displayName = (String) jsonObject.get("d"); portrait = (String) jsonObject.get("p"); from = (String) jsonObject.get("f"); } } catch (ParseException e) { throw new RuntimeException(e); } } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/DeleteMessageContent.java ================================================ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import java.nio.charset.StandardCharsets; import java.util.Base64; /** * 删除消息内容类 *

* 表示消息删除通知,包含被删除消息的ID和操作者信息。 *

*/ public class DeleteMessageContent extends MessageContent { private long messageId; private String operatorId; //必须有个空的构造函数 public DeleteMessageContent() { } public long getMessageId() { return messageId; } public String getOperatorId() { return operatorId; } @Override public int getContentType() { return ProtoConstants.ContentType.Delete; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Not_Persist; } @Override public MessagePayload encode() { throw new RuntimeException("Delete message cannot encode"); } @Override public void decode(MessagePayload payload) { super.decode(payload); operatorId = payload.getContent(); messageId = Long.parseLong(new String(Base64.getDecoder().decode(payload.getBase64edData()), StandardCharsets.UTF_8)); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/FileMessageContent.java ================================================ /* * Copyright (c) 2020 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; /** * 文件消息内容类 *

* 表示文件类型的消息内容,继承自MediaMessageContent。 * 包含文件名和文件大小信息。 *

*/ public class FileMessageContent extends MediaMessageContent { private String name; private int size; private static final String FILE_NAME_PREFIX = "[文件] "; @Override public int getContentType() { return ProtoConstants.ContentType.File; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setSearchableContent(name); payload.setContent(size + ""); return payload; } public String getName() { return name; } public int getSize() { return size; } public void setName(String name) { this.name = name; } public void setSize(int size) { this.size = size; } @Override public void decode(MessagePayload payload) { super.decode(payload); if (payload.getSearchableContent().startsWith(FILE_NAME_PREFIX)) { name = payload.getSearchableContent().substring(payload.getSearchableContent().indexOf(FILE_NAME_PREFIX) + FILE_NAME_PREFIX.length()); } else { name = payload.getSearchableContent(); } size = Integer.parseInt(payload.getContent()); } @Override protected int getMediaType() { return ProtoConstants.MessageMediaType.FILE; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/ImageMessageContent.java ================================================ /* * Copyright (c) 2020 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import java.util.Base64; /** * 图片消息内容类 *

* 表示图片类型的消息内容,继承自MediaMessageContent。 * 包含图片缩略图数据。 *

*/ public class ImageMessageContent extends MediaMessageContent { private byte[] thumbnailBytes; public void setThumbnailBytes(byte[] thumbnailBytes) { this.thumbnailBytes = thumbnailBytes; } public byte[] getThumbnailBytes() { return thumbnailBytes; } @Override public int getContentType() { return ProtoConstants.ContentType.Image; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setSearchableContent("[图片]"); if(thumbnailBytes != null) { payload.setBase64edData(Base64.getEncoder().encodeToString(thumbnailBytes)); } return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); if(payload.getBase64edData() != null) { thumbnailBytes = Base64.getDecoder().decode(payload.getBase64edData()); } } @Override protected int getMediaType() { return ProtoConstants.MessageMediaType.IMAGE; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/LinkMessageContent.java ================================================ /* * Copyright (c) 2020 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import io.netty.util.internal.StringUtil; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import java.util.Base64; /** * 链接消息内容类 *

* 表示链接分享类型的消息内容,包含标题、描述、URL和缩略图。 *

*/ public class LinkMessageContent extends MessageContent { private String title; private String contentDigest; private String url; private String thumbnailUrl; public LinkMessageContent() { } public LinkMessageContent(String title, String url) { this.title = title; this.url = url; } public String getContentDigest() { return contentDigest; } public void setContentDigest(String contentDigest) { this.contentDigest = contentDigest; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getThumbnailUrl() { return thumbnailUrl; } public void setThumbnailUrl(String thumbnailUrl) { this.thumbnailUrl = thumbnailUrl; } @Override public int getContentType() { return ProtoConstants.ContentType.Link; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setSearchableContent(title); JSONObject objWrite = new JSONObject(); objWrite.put("d", contentDigest); objWrite.put("u", url); objWrite.put("t", thumbnailUrl); payload.setBase64edData(Base64.getEncoder().encodeToString(objWrite.toString().getBytes())); return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); title = payload.getSearchableContent(); try { if (!StringUtil.isNullOrEmpty(payload.getBase64edData())) { JSONObject jsonObject = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData()))); contentDigest = (String) jsonObject.get("d"); url = (String) jsonObject.get("u"); thumbnailUrl = (String) jsonObject.get("t"); } } catch (ParseException e) { throw new RuntimeException(e); } } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/LocationMessageContent.java ================================================ /* * Copyright (c) 2020 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import io.netty.util.internal.StringUtil; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import java.util.Base64; /** * 位置消息内容类 *

* 表示位置类型的消息内容,包含标题、缩略图、经纬度信息。 *

*/ public class LocationMessageContent extends MessageContent { private String title; public byte[] thumbnailByte; private double longitude; private double latitude; public LocationMessageContent() { } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public byte[] getThumbnailByte() { return thumbnailByte; } public void setThumbnailByte(byte[] thumbnailByte) { this.thumbnailByte = thumbnailByte; } public double getLongitude() { return longitude; } public void setLongitude(double longitude) { this.longitude = longitude; } public double getLatitude() { return latitude; } public void setLatitude(double latitude) { this.latitude = latitude; } @Override public int getContentType() { return ProtoConstants.ContentType.Location; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setSearchableContent(title); payload.setBase64edData(Base64.getEncoder().encodeToString(this.thumbnailByte)); JSONObject objWrite = new JSONObject(); objWrite.put("lat", latitude); objWrite.put("long", longitude); payload.setContent(objWrite.toString()); return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); if (!StringUtil.isNullOrEmpty(payload.getBase64edData())) { this.thumbnailByte = Base64.getDecoder().decode(payload.getBase64edData()); } title = payload.getSearchableContent(); try { if (payload.getContent() != null) { JSONObject jsonObject = (JSONObject) new JSONParser().parse(payload.getContent()); latitude = (double) jsonObject.get("lat"); longitude = (double) jsonObject.get("long"); } } catch (ParseException e) { throw new RuntimeException(e); } } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/MediaMessageContent.java ================================================ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; /** * 媒体消息内容基类 *

* 所有媒体类型消息(图片、语音、视频、文件等)的抽象基类。 * 包含媒体文件的远程URL信息。 *

*/ abstract public class MediaMessageContent extends MessageContent { private String remoteMediaUrl; public String getRemoteMediaUrl() { return remoteMediaUrl; } public void setRemoteMediaUrl(String remoteMediaUrl) { this.remoteMediaUrl = remoteMediaUrl; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setRemoteMediaUrl(remoteMediaUrl); payload.setMediaType(getMediaType()); return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); remoteMediaUrl = payload.getRemoteMediaUrl(); } protected abstract int getMediaType(); } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/MessageContent.java ================================================ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import java.util.List; /** * 消息内容基类 *

* 所有消息内容类型的抽象基类,定义了消息内容的通用属性和方法。 * 子类需要实现具体的消息类型编码和解码逻辑。 *

*/ public abstract class MessageContent { private int mentionedType; private List mentionedTargets; private String extra; public MessageContent mentionedType(int mentionedType) { this.mentionedType = mentionedType; return this; } public MessageContent mentionedTargets(List mentionedTargets) { this.mentionedTargets = mentionedTargets; return this; } public MessageContent extra(String extra) { this.extra = extra; return this; } public MessagePayload encode() { MessagePayload payload = new MessagePayload(); payload.setType(getContentType()); payload.setPersistFlag(getPersistFlag()); payload.setMentionedType(mentionedType); payload.setMentionedTarget(mentionedTargets); payload.setExtra(extra); return payload; } protected void decode(MessagePayload payload) { this.mentionedType = payload.getMentionedType(); this.mentionedTargets = payload.getMentionedTarget(); this.extra = payload.getExtra(); } abstract public int getContentType(); abstract public int getPersistFlag(); } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/MessageContentFactory.java ================================================ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.Conversation; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.WFCMessage; import cn.wildfirechat.sdk.model.Message; import cn.wildfirechat.sdk.utilities.ClassUtil; import java.io.IOException; import java.lang.reflect.Modifier; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; /** * 消息内容工厂类 *

* 负责消息内容的编码和解码,维护消息类型到消息内容类的映射关系。 * 支持内置消息类型和自定义消息类型的注册。 *

*/ public class MessageContentFactory { private static final Map> contentClassMap = new ConcurrentHashMap<>(); private static List buildinMessageContents = Arrays.asList( ArticlesMessageContent.class, StreamTextGeneratedMessageContent.class, CallStartMessageContent.class, StreamTextGeneratingMessageContent.class, CardMessageContent.class, MultiCallOngoingMessageContent.class, TextMessageContent.class, DeleteMessageContent.class, NotDeliveredMessageContent.class, TipNotificationMessageContent.class, FileMessageContent.class, PTTSoundMessageContent.class, TypingMessageContent.class, ImageMessageContent.class, RecallMessageContent.class, UnknownMessageContent.class, LinkMessageContent.class, RichNotificationMessageContent.class, VideoMessageContent.class, LocationMessageContent.class, SoundMessageContent.class, StickerMessageContent.class ); static { registerAllMessageContent(); } public static Message decodeMessage(WFCMessage.Message protoMessage) { Message message = new Message(); message.content = decodeMessageContent(protoMessage.getContent()); WFCMessage.Conversation protoConversation = protoMessage.getConversation(); message.conversation = new Conversation(protoConversation.getType(), protoConversation.getTarget(), protoConversation.getLine()); message.messageUid = protoMessage.getMessageId(); message.sender = protoMessage.getFromUser(); message.serverTime = protoMessage.getServerTimestamp(); message.toUsers = protoMessage.getToList(); return message; } public static MessageContent decodeMessageContent(WFCMessage.MessageContent protoMessageContent) { MessagePayload payload = MessagePayload.fromProtoMessageContent(protoMessageContent); return decodeMessageContent(payload); } public static MessageContent decodeMessageContent(MessagePayload messagePayload) { Class cls = contentClassMap.get(messagePayload.getType()); MessageContent messageContent; if(cls != null) { try { messageContent = cls.newInstance(); } catch (InstantiationException e) { throw new RuntimeException(e); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } else { messageContent = new UnknownMessageContent(); } messageContent.decode(messagePayload); return messageContent; } public static void registerCustomMessageContent(Class cls) throws Exception { MessageContent content = cls.newInstance(); contentClassMap.put(content.getContentType(), cls); } private static void registerAllMessageContent() { try { for (Class buildinMessageContent : buildinMessageContents) { MessageContent content = (MessageContent)buildinMessageContent.newInstance(); contentClassMap.put(content.getContentType(), buildinMessageContent); } } catch (Exception e) { e.printStackTrace(); } try { for (Class cls : ClassUtil.getAllAssignedClass(MessageContent.class)) { if(!Modifier.isAbstract(cls.getModifiers())) { try { MessageContent content = (MessageContent)cls.newInstance(); contentClassMap.put(content.getContentType(), cls); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } } } } catch (IOException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/MultiCallOngoingMessageContent.java ================================================ /* * Copyright (c) 2022 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import java.util.ArrayList; import java.util.Base64; import java.util.List; /** * 多人通话进行中消息内容类 *

* 表示多人音视频通话进行中的状态消息。 * 包含通话ID、发起者、是否仅语音、参与者列表等信息。 *

*/ public class MultiCallOngoingMessageContent extends MessageContent { private String callId; private String initiator; private boolean audioOnly; private List targets; public MultiCallOngoingMessageContent() { } public MultiCallOngoingMessageContent(String callId, String initiator, boolean audioOnly, List targets) { this.callId = callId; this.initiator = initiator; this.audioOnly = audioOnly; this.targets = targets; } @Override public int getContentType() { return ProtoConstants.ContentType.Call_Multi_Call_Ongoing; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Transparent; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setContent(callId); JSONObject object = new JSONObject(); object.put("initiator", this.initiator); JSONArray arr = new JSONArray(); for (int i = 0; i < targets.size(); i++) { arr.add(i, targets.get(i)); } object.put("targets", arr); object.put("audioOnly", this.audioOnly ? 1 : 0); payload.setBase64edData(Base64.getEncoder().encodeToString(object.toString().getBytes())); return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); this.callId = payload.getContent(); try { JSONObject object = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData()))); this.initiator = (String) object.get("initiator"); this.targets = new ArrayList<>(); JSONArray array = (JSONArray) object.get("targets"); if (array != null) { for (int i = 0; i < array.size(); i++) { targets.add((String) array.get(i)); } } this.audioOnly = (int)object.get("audioOnly") == 1; } catch (ParseException e) { e.printStackTrace(); } } public String getCallId() { return callId; } public void setCallId(String callId) { this.callId = callId; } public String getInitiator() { return initiator; } public void setInitiator(String initiator) { this.initiator = initiator; } public boolean isAudioOnly() { return audioOnly; } public void setAudioOnly(boolean audioOnly) { this.audioOnly = audioOnly; } public List getTargets() { return targets; } public void setTargets(List targets) { this.targets = targets; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/NotDeliveredMessageContent.java ================================================ /* * Copyright (c) 2024 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import java.util.ArrayList; import java.util.Base64; import java.util.List; /** * 消息未送达通知类 *

* 表示消息未能成功送达的通知,包含失败原因和失败用户列表。 * 用于跨域消息投递失败的场景。 *

*/ public class NotDeliveredMessageContent extends MessageContent { // 请求的类型,1 发送消息,2 撤回消息,3 删除消息 private int type; // 发送的消息 uid private long messageUid; // 是全部失败,还是部分失败 private boolean allFailure; // 部分失败时,失败的用户 id 列表 private List userIds; // 归属IM服务请求桥接服务出现的错误,有可能是桥接服务没有配置,或者不可用。 private int localImErrorCode; // 归属桥接服务出现的错误 private int localBridgeErrorCode; // 远端桥接服务出现的错误 private int remoteBridgeErrorCode; // 远端IM服务出现的错误 private int remoteServerErrorCode; // 错误提示信息 private String errorMessage; @Override public int getContentType() { return ProtoConstants.ContentType.Not_Delivered; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); JSONObject obj = new JSONObject(); obj.put("mid", this.messageUid); obj.put("all", this.allFailure); obj.put("us", this.userIds); obj.put("lme", this.localImErrorCode); obj.put("lbe", this.localBridgeErrorCode); obj.put("rbe", this.remoteBridgeErrorCode); obj.put("rme", this.remoteServerErrorCode); obj.put("em", this.errorMessage); payload.setBase64edData(Base64.getEncoder().encodeToString(obj.toString().getBytes())); return payload; } @Override public void decode(MessagePayload payload) { try { super.decode(payload); JSONObject obj = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData()))); this.messageUid = (long) obj.get("mid"); this.allFailure = (boolean) obj.get("all"); this.userIds = new ArrayList<>(); JSONArray arr = (JSONArray) obj.get("us"); if (arr != null) { for (int i = 0; i < arr.size(); i++) { this.userIds.add((String) arr.get(i)); } } this.localImErrorCode = (int) obj.get("lme"); this.localBridgeErrorCode = (int) obj.get("lbe"); this.remoteBridgeErrorCode = (int) obj.get("rbe"); this.remoteServerErrorCode = (int) obj.get("rme"); this.errorMessage = (String) obj.get("em"); } catch (ParseException e) { throw new RuntimeException(e); } } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/PTTSoundMessageContent.java ================================================ /* * Copyright (c) 2021 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import org.json.simple.JSONObject; /** * 对讲语音消息内容类 *

* 表示对讲语音类型的消息内容,继承自SoundMessageContent。 * 用于实时对讲场景。 *

*/ public class PTTSoundMessageContent extends SoundMessageContent { public PTTSoundMessageContent() { super(); } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setSearchableContent("[对讲语音]"); return payload; } @Override public int getContentType() { return ProtoConstants.ContentType.Ptt_Voice; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/RecallMessageContent.java ================================================ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import org.apache.http.util.TextUtils; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import java.nio.charset.StandardCharsets; import java.util.Base64; /** * 撤回消息内容类 *

* 表示消息撤回通知,包含被撤回消息的原始信息。 *

*/ public class RecallMessageContent extends MessageContent { private long messageId; private String operatorId; private String originalSender; private int originalContentType; private String originalSearchableContent; private String originalContent; private String originalExtra; private byte[] originalBinaryContent; private int originalMediaType; private String originalMediaUrl; private long originalMessageTimestamp; //必须有个空的构造函数 public RecallMessageContent() { } public long getMessageId() { return messageId; } public String getOperatorId() { return operatorId; } public String getOriginalSender() { return originalSender; } public int getOriginalContentType() { return originalContentType; } public String getOriginalSearchableContent() { return originalSearchableContent; } public String getOriginalContent() { return originalContent; } public String getOriginalExtra() { return originalExtra; } public long getOriginalMessageTimestamp() { return originalMessageTimestamp; } public byte[] getOriginalBinaryContent() { return originalBinaryContent; } public int getOriginalMediaType() { return originalMediaType; } public String getOriginalMediaUrl() { return originalMediaUrl; } @Override public int getContentType() { return ProtoConstants.ContentType.Recall; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist; } @Override public MessagePayload encode() { throw new RuntimeException("Recall message cannot encode"); } @Override public void decode(MessagePayload payload) { super.decode(payload); operatorId = payload.getContent(); messageId = Long.parseLong(new String(Base64.getDecoder().decode(payload.getBase64edData()), StandardCharsets.UTF_8)); if(!TextUtils.isEmpty(payload.getExtra())) { try { JSONObject dictionary = (JSONObject) new JSONParser().parse(payload.getExtra()); originalSender = (String) dictionary.get("s"); if (dictionary.containsKey("t")) { originalContentType = ((Number) dictionary.get("t")).intValue(); } originalSearchableContent = (String) dictionary.get("sc"); originalContent = (String) dictionary.get("c"); originalExtra = (String) dictionary.get("e"); if (dictionary.containsKey("ts")) { originalMessageTimestamp = ((Number) dictionary.get("ts")).longValue(); } if (dictionary.containsKey("mt")) { originalMediaType = ((Number) dictionary.get("mt")).intValue(); } originalMediaUrl = (String) dictionary.get("mu"); if (dictionary.containsKey("mb")) { originalBinaryContent = Base64.getDecoder().decode((String) dictionary.get("mb")); } } catch (ParseException e) { throw new RuntimeException(e); } } } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/RichNotificationMessageContent.java ================================================ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import io.netty.util.internal.StringUtil; import org.json.simple.JSONArray; import org.json.simple.JSONObject; import java.nio.charset.StandardCharsets; import java.util.Base64; /** * 富媒体通知消息内容类 *

* 表示富媒体类型的消息内容,包含标题、描述、扩展信息等。 * 支持自定义数据和扩展字段。 *

*/ public class RichNotificationMessageContent extends MessageContent { private String title; private String desc; private String remark; private JSONArray datas; private String exName; private String exPortrait; private String exUrl; private String appId; //必须有个空的构造函数 public RichNotificationMessageContent() { } public RichNotificationMessageContent(String title, String desc, String exUrl) { this.title = title; this.desc = desc; this.exUrl = exUrl; } public RichNotificationMessageContent title(String title) { this.title = title; return this; } public RichNotificationMessageContent desc(String desc) { this.desc = desc; return this; } public RichNotificationMessageContent exUrl(String exUrl) { this.exUrl = exUrl; return this; } public RichNotificationMessageContent remark(String remark) { this.remark = remark; return this; } public RichNotificationMessageContent exName(String exName) { this.exName = exName; return this; } public RichNotificationMessageContent exPortrait(String exPortrait) { this.exPortrait = exPortrait; return this; } public RichNotificationMessageContent appId(String appId) { this.appId = appId; return this; } public RichNotificationMessageContent addItem(String key, String value) { return addItem(key, value, null); } public RichNotificationMessageContent addItem(String key, String value, String color) { if(this.datas == null) { this.datas = new JSONArray(); } JSONObject item = new JSONObject(); item.put("key", key); item.put("value", value == null ? "" : value); if(!StringUtil.isNullOrEmpty(color)) { item.put("color", color); } this.datas.add(item); return this; } @Override public int getContentType() { return ProtoConstants.ContentType.Rich_Notification; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setPushContent(title); payload.setContent(desc); JSONObject jsonObject = new JSONObject(); if(!StringUtil.isNullOrEmpty(remark)) jsonObject.put("remark", remark); if(!StringUtil.isNullOrEmpty(exName)) jsonObject.put("exName", exName); if(!StringUtil.isNullOrEmpty(exPortrait)) jsonObject.put("exPortrait", exPortrait); if(!StringUtil.isNullOrEmpty(exUrl)) jsonObject.put("exUrl", exUrl); if(!StringUtil.isNullOrEmpty(appId)) jsonObject.put("appId", appId); if(datas != null && !datas.isEmpty()) jsonObject.put("datas", datas); payload.setBase64edData(Base64.getEncoder().encodeToString(jsonObject.toJSONString().getBytes(StandardCharsets.UTF_8))); return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/SoundMessageContent.java ================================================ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import org.json.simple.JSONObject; /** * 语音消息内容类 *

* 表示语音类型的消息内容,继承自MediaMessageContent。 * 包含语音时长信息。 *

*/ public class SoundMessageContent extends MediaMessageContent { private int duration; //必须有个空的构造函数 public SoundMessageContent() { } public SoundMessageContent(int duration) { this.duration = duration; } public int getDuration() { return duration; } public void setDuration(int duration) { this.duration = duration; } @Override public int getContentType() { return ProtoConstants.ContentType.Voice; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public void decode(MessagePayload payload) { super.decode(payload); } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); JSONObject jsonObject = new JSONObject(); jsonObject.put("duration", duration); payload.setContent(jsonObject.toJSONString()); return payload; } @Override protected int getMediaType() { return ProtoConstants.MessageMediaType.VOICE; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/StickerMessageContent.java ================================================ /* * Copyright (c) 2020 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import java.util.Base64; /** * 动态表情消息内容类 *

* 表示动态表情(贴纸)类型的消息内容,继承自MediaMessageContent。 * 包含表情图片的宽高信息。 *

*/ public class StickerMessageContent extends MediaMessageContent { public int width; public int height; public int getWidth() { return width; } public void setWidth(int width) { this.width = width; } public int getHeight() { return height; } public void setHeight(int height) { this.height = height; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setSearchableContent("[动态表情]"); JSONObject objWrite = new JSONObject(); objWrite.put("x", width); objWrite.put("y", height); payload.setBase64edData(Base64.getEncoder().encodeToString(objWrite.toString().getBytes())); return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); try { JSONObject jsonObject = (JSONObject) new JSONParser().parse(new String(Base64.getDecoder().decode(payload.getBase64edData()))); width = (int) jsonObject.get("x"); height = (int) jsonObject.get("y"); } catch (ParseException e) { throw new RuntimeException(e); } } @Override protected int getMediaType() { return ProtoConstants.MessageMediaType.STICKER; } @Override public int getContentType() { return ProtoConstants.ContentType.Sticker; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/StreamTextGeneratedMessageContent.java ================================================ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; /** * 流式文本已生成消息内容类 *

* 表示AI流式文本生成的结果消息。 * 包含生成的完整文本内容和流ID。 *

*/ public class StreamTextGeneratedMessageContent extends MessageContent { private String text; private String streamId; //必须有个空的构造函数 public StreamTextGeneratedMessageContent() { } public StreamTextGeneratedMessageContent(String text, String streamId) { this.text = text; this.streamId = streamId; } public StreamTextGeneratedMessageContent text(String text) { this.text = text; return this; } public StreamTextGeneratedMessageContent streamId(String streamId) { this.streamId = streamId; return this; } @Override public int getContentType() { return ProtoConstants.ContentType.StreamingText_Generated; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public void decode(MessagePayload payload) { super.decode(payload); this.streamId = payload.getContent(); this.text = payload.getSearchableContent(); } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setSearchableContent(text); payload.setContent(streamId); return payload; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/StreamTextGeneratingMessageContent.java ================================================ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; /** * 流式文本生成中消息内容类 *

* 表示AI流式文本正在生成的状态消息。 * 包含生成的文本内容和流ID。 *

*/ public class StreamTextGeneratingMessageContent extends MessageContent { private String text; private String streamId; //必须有个空的构造函数 public StreamTextGeneratingMessageContent() { } public StreamTextGeneratingMessageContent(String text, String streamId) { this.text = text; this.streamId = streamId; } public StreamTextGeneratingMessageContent text(String text) { this.text = text; return this; } public StreamTextGeneratingMessageContent streamId(String streamId) { this.streamId = streamId; return this; } @Override public int getContentType() { return ProtoConstants.ContentType.StreamingText_Generationg; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Transparent; } @Override public void decode(MessagePayload payload) { super.decode(payload); streamId = payload.getContent(); text = payload.getSearchableContent(); } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setSearchableContent(text); payload.setContent(streamId); return payload; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/TextMessageContent.java ================================================ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import cn.wildfirechat.sdk.model.QuoteInfo; import org.apache.http.util.TextUtils; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import java.nio.charset.StandardCharsets; import java.util.Base64; /** * 文本消息内容类 *

* 表示文本类型的消息内容,支持纯文本和引用回复功能。 *

*/ public class TextMessageContent extends MessageContent { private String text; private QuoteInfo quoteInfo; //必须有个空的构造函数 public TextMessageContent() { } public TextMessageContent(String text) { this.text = text; } public TextMessageContent text(String text) { this.text = text; return this; } public String getText() { return text; } public void setText(String text) { this.text = text; } public QuoteInfo getQuoteInfo() { return quoteInfo; } public void setQuoteInfo(QuoteInfo quoteInfo) { this.quoteInfo = quoteInfo; } @Override public int getContentType() { return ProtoConstants.ContentType.Text; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setSearchableContent(text); if(quoteInfo != null) { payload.setBase64edData(Base64.getEncoder().encodeToString(quoteInfo.encode().toJSONString().getBytes(StandardCharsets.UTF_8))); } return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); text = payload.getSearchableContent(); if(!TextUtils.isEmpty(payload.getBase64edData())) { String jsonStr = new String(Base64.getDecoder().decode(payload.getBase64edData()), StandardCharsets.UTF_8); try { JSONObject jsonObject = (JSONObject) new JSONParser().parse(jsonStr); quoteInfo = new QuoteInfo(); quoteInfo.decode(jsonObject); } catch (ParseException e) { throw new RuntimeException(e); } } } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/TipNotificationMessageContent.java ================================================ /* * Copyright (c) 2020 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; /** * 提示通知消息内容类 *

* 表示提示类型的消息内容,用于显示各种提示信息(如"对方正在输入"等)。 *

*/ public class TipNotificationMessageContent extends MessageContent { public String tip; public TipNotificationMessageContent() { } public String getTip() { return tip; } public void setTip(String tip) { this.tip = tip; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setContent(tip); return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); tip = payload.getContent(); } @Override public int getContentType() { return ProtoConstants.ContentType.Tip; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/TypingMessageContent.java ================================================ /* * Copyright (c) 2020 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; /** * 正在输入消息内容类 *

* 表示正在输入的状态消息,用于显示对方正在输入的提示。 * 支持多种输入类型:文本、语音、视频、位置、文件等。 *

*/ public class TypingMessageContent extends MessageContent { public static final int TYPING_TEXT = 0; public static final int TYPING_VOICE = 1; public static final int TYPING_CAMERA = 2; public static final int TYPING_LOCATION = 3; public static final int TYPING_FILE = 4; private int typingType; public TypingMessageContent() { } public TypingMessageContent(int typingType) { this.typingType = typingType; } public int getTypingType() { return typingType; } public void setTypingType(int typingType) { this.typingType = typingType; } @Override public int getContentType() { return ProtoConstants.ContentType.Typing; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Transparent; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setContent(typingType + ""); return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); typingType = Integer.parseInt(payload.getContent()); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/UnknownMessageContent.java ================================================ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; /** * 未知消息内容类 *

* 表示未知类型的消息内容,用于处理无法识别的消息类型。 * 保存原始的消息负载以便后续处理。 *

*/ public class UnknownMessageContent extends MessageContent { private MessagePayload orignalPayload; //必须有个空的构造函数 public UnknownMessageContent() { } @Override public int getContentType() { return ProtoConstants.ContentType.Unknown; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public MessagePayload encode() { return orignalPayload; } @Override public void decode(MessagePayload payload) { this.orignalPayload = payload; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/messagecontent/VideoMessageContent.java ================================================ /* * Copyright (c) 2020 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.messagecontent; import cn.wildfirechat.pojos.MessagePayload; import cn.wildfirechat.proto.ProtoConstants; import org.json.simple.JSONObject; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; import java.util.Base64; /** * 创建者 heavyrain lee * * @refactor dhl * 添加小视频的宽高,时长 */ /** * 视频消息内容类 *

* 表示视频类型的消息内容,继承自MediaMessageContent。 * 包含视频缩略图和时长信息。 *

*/ public class VideoMessageContent extends MediaMessageContent { private byte[] thumbnailBytes; private long duration ; //必须有个空的构造函数 public VideoMessageContent() { } public VideoMessageContent setThumbnailBytes(byte[] thumbnailBytes) { this.thumbnailBytes = thumbnailBytes; return this; } public byte[] getThumbnailBytes() { return thumbnailBytes; } public void setDuration(long duration) { this.duration = duration; } public long getDuration() { return duration; } @Override public int getContentType() { return ProtoConstants.ContentType.Video; } @Override public int getPersistFlag() { return ProtoConstants.PersistFlag.Persist_And_Count; } @Override public MessagePayload encode() { MessagePayload payload = super.encode(); payload.setSearchableContent("[视频]"); payload.setBase64edData(Base64.getEncoder().encodeToString(thumbnailBytes)); JSONObject objWrite = new JSONObject(); objWrite.put("d", duration); objWrite.put("duration", duration); payload.setContent(objWrite.toJSONString()); return payload; } @Override public void decode(MessagePayload payload) { super.decode(payload); thumbnailBytes = Base64.getDecoder().decode(payload.getBase64edData()); try { JSONObject jsonObject = (JSONObject) new JSONParser().parse(payload.getContent()); if(jsonObject.containsKey("d")) { duration = (long) jsonObject.get("d"); } else { duration = (long) jsonObject.get("duration"); } } catch (ParseException e) { throw new RuntimeException(e); } } @Override protected int getMediaType() { return ProtoConstants.MessageMediaType.VIDEO; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/model/IMResult.java ================================================ package cn.wildfirechat.sdk.model; import cn.wildfirechat.common.ErrorCode; /** * IM结果类 *

* 泛型类,用于封装所有API调用的返回结果。 * 包含错误码、错误消息和返回数据。 *

* @param 返回数据的类型 */ public class IMResult { public int code; public String msg; public T result; public int getCode() { return code; } public void setCode(int code) { this.code = code; } public ErrorCode getErrorCode() { return ErrorCode.fromCode(code); } public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public T getResult() { return result; } public void setResult(T result) { this.result = result; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/model/Message.java ================================================ package cn.wildfirechat.sdk.model; import cn.wildfirechat.pojos.Conversation; import cn.wildfirechat.sdk.messagecontent.MessageContent; import java.util.List; /** * 消息类 *

* 表示一条完整的消息,包含会话信息、消息内容、发送者、时间等。 *

*/ public class Message { public Conversation conversation; public MessageContent content; public long messageUid; public String sender; public long serverTime; public List toUsers; } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/model/QuoteInfo.java ================================================ /* * Copyright (c) 2020 WildFireChat. All rights reserved. */ package cn.wildfirechat.sdk.model; import org.json.simple.JSONObject; /** * 引用消息信息类 *

* 封装被引用消息的信息,包括消息UID、发送者信息、消息摘要等。 * 用于回复消息时引用原消息内容。 *

*/ public class QuoteInfo { private long messageUid; private String userId; private String userDisplayName; private String messageDigest; public long getMessageUid() { return messageUid; } public void setMessageUid(long messageUid) { this.messageUid = messageUid; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getUserDisplayName() { return userDisplayName; } public void setUserDisplayName(String userDisplayName) { this.userDisplayName = userDisplayName; } public String getMessageDigest() { return messageDigest; } public void setMessageDigest(String messageDigest) { this.messageDigest = messageDigest; } public JSONObject encode() { JSONObject object = new JSONObject(); object.put("u", messageUid); object.put("i", userId); object.put("n", userDisplayName); object.put("d", messageDigest); JSONObject quote = new JSONObject(); quote.put("quote", object); return quote; } public void decode(JSONObject object) { JSONObject quote = (JSONObject)object.get("quote"); if(quote != null) { messageUid = (long) quote.get("u"); userId = (String) quote.get("i"); userDisplayName = (String) quote.get("n"); messageDigest = (String) quote.get("d"); } } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/utilities/AdminHttpUtils.java ================================================ package cn.wildfirechat.sdk.utilities; import cn.wildfirechat.sdk.model.IMResult; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.apache.commons.codec.digest.DigestUtils; import org.apache.http.HttpResponse; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.security.SecureRandom; import java.util.concurrent.TimeUnit; /** * 管理员HTTP工具类 *

* 提供管理员API调用的HTTP工具方法,包括初始化、请求签名、HTTP请求等。 * 继承自HttpUtils,专门用于管理员接口的调用。 *

*/ public class AdminHttpUtils extends HttpUtils { // ======================== 常量定义(消除硬编码)======================== private static final Logger LOG = LoggerFactory.getLogger(AdminHttpUtils.class); // 连接池配置常量 private static final int DEFAULT_CONNECT_TIMEOUT = 15000; private static final int DEFAULT_CONNECTION_REQUEST_TIMEOUT = 3000; private static final int DEFAULT_SOCKET_TIMEOUT = 15000; private static final int MAX_CONN_TOTAL = 100; private static final int MAX_CONN_PER_ROUTE = 50; private static final long IDLE_CONNECTION_EVICT_TIME = 60L; private static final int VALIDATE_AFTER_INACTIVITY = 1000; private static final SecureRandom SECURE_RANDOM = new SecureRandom(); private static final int NONCE_MAX_RANGE = 1000000; // ======================== 线程安全的全局变量 ======================== private static volatile String adminUrl; private static volatile String adminSecret; public static CloseableHttpClient getHttpClient() { return httpClient; } private static volatile CloseableHttpClient httpClient; // ======================== 初始化方法 ======================== public static void init(String url, String secret) { init(url, secret, DEFAULT_SOCKET_TIMEOUT); } /** * 初始化HTTP客户端和配置 * @param url IM服务管理地址 * @param secret 管理密钥 * @param timeout 套接字超时时间(毫秒) */ public static synchronized void init(String url, String secret, int timeout) { // 参数校验 if (isNullOrEmpty(url) || isNullOrEmpty(secret)) { throw new IllegalArgumentException("IM服务地址或密钥不能为空"); } adminUrl = url.trim(); adminSecret = secret.trim(); // 若已存在HttpClient,先关闭再重新初始化(支持配置更新) if (httpClient != null) { try { httpClient.close(); } catch (IOException e) { LOG.error("关闭旧HttpClient连接池失败", e); } } // 初始化连接池 PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); cm.setValidateAfterInactivity(VALIDATE_AFTER_INACTIVITY); // 构建请求配置 RequestConfig requestConfig = RequestConfig.custom() .setConnectTimeout(DEFAULT_CONNECT_TIMEOUT) .setSocketTimeout(timeout) .setConnectionRequestTimeout(DEFAULT_CONNECTION_REQUEST_TIMEOUT) .build(); // 构建HttpClient httpClient = HttpClients.custom() .setDefaultRequestConfig(requestConfig) .setConnectionManager(cm) .evictExpiredConnections() .evictIdleConnections(IDLE_CONNECTION_EVICT_TIME, TimeUnit.SECONDS) .setRetryHandler(new DefaultHttpRequestRetryHandler(3, false)) // 重试3次,不重试IO异常 .setMaxConnTotal(MAX_CONN_TOTAL) .setMaxConnPerRoute(MAX_CONN_PER_ROUTE) .build(); LOG.info("AdminHttpUtils初始化完成,IM服务地址:{}", adminUrl); } // ======================== HTTP GET请求 ======================== public static IMResult httpGet(String path, Class clazz) throws Exception { // 前置校验 validateInitStatus(adminUrl, adminSecret, httpClient); if (isNullOrEmpty(path)) { throw new IllegalArgumentException("请求路径不能为空"); } HttpGet httpGet = new HttpGet(adminUrl + path); try { HttpResponse response = httpClient.execute(httpGet); return handleResponse(response, clazz, adminUrl, adminSecret); } catch (Exception e) { LOG.error("HTTP GET请求失败,路径:{}", path, e); throw new Exception("HTTP GET请求异常:" + e.getMessage(), e); } finally { httpGet.releaseConnection(); } } // ======================== HTTP JSON POST请求 ======================== public static IMResult httpJsonPost(String path, Object object, Class clazz) throws Exception { return httpJsonPost(adminUrl, adminSecret, httpClient, path, object, clazz, httpPost -> { // 构建签名头 int nonce = SECURE_RANDOM.nextInt(NONCE_MAX_RANGE) + 1; // 安全随机数 long timestamp = System.currentTimeMillis(); String signStr = nonce + "|" + adminSecret + "|" + timestamp; String sign = DigestUtils.sha1Hex(signStr); // 设置请求头 httpPost.setHeader("Content-type", "application/json; charset=utf-8"); httpPost.setHeader("Connection", "Keep-Alive"); httpPost.setHeader("nonce", String.valueOf(nonce)); httpPost.setHeader("timestamp", String.valueOf(timestamp)); httpPost.setHeader("sign", sign); }); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/utilities/ChannelHttpUtils.java ================================================ package cn.wildfirechat.sdk.utilities; import cn.wildfirechat.sdk.model.IMResult; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import ikidou.reflect.TypeBuilder; import org.apache.commons.codec.digest.DigestUtils; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Type; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.Charset; import java.util.concurrent.TimeUnit; /** * 频道HTTP工具类 *

* 提供频道API调用的HTTP工具方法,包括初始化、请求签名、HTTP请求等。 * 继承自HttpUtils并实现Closeable接口,专门用于频道接口的调用。 *

*/ public class ChannelHttpUtils extends HttpUtils implements Closeable { private static final Logger LOG = LoggerFactory.getLogger(ChannelHttpUtils.class); private String imurl; private String channelId; private String channelSecret; private final CloseableHttpClient httpClient; private final int port; private void checkPort() { if (port != 80 && port != 443 && port != -1) { if (port == 18080) { LOG.warn("您传入的频道API地址中的端口是18080,18080端口默认为管理API端口,频道API端口应该为IM服务的HTTP端口,默认为80,请确认是否使用错误!"); } else { LOG.warn("您传入的频道API地址中的端口不是80/443,频道API的端口和客户端使用端口一样,都应该为IM服务的HTTP端口,默认为80,请确实是否正确?如果您定制化了IM服务端口或者使用其他端口反向代理IM服务的HTTP端口请忽略此提示。"); } } } public ChannelHttpUtils(String imurl, String channelId, String secret) { this.imurl = imurl.trim(); this.channelId = channelId.trim(); this.channelSecret = secret.trim(); try { URL u = new URL(this.imurl); int port = u.getPort(); if(port == -1) { port = u.getDefaultPort(); } this.port = port; } catch (MalformedURLException e) { throw new RuntimeException(e); } checkPort(); PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); cm.setValidateAfterInactivity(1000); int connectTimeout = 5000; // 连接超时时间 int socketTimeout = 15000; // 请求超时时间 int connectionRequestTimeout = 3000; // 从连接池获取连接的超时时间 RequestConfig requestConfig = RequestConfig.custom() .setConnectTimeout(connectTimeout) .setSocketTimeout(socketTimeout) .setConnectionRequestTimeout(connectionRequestTimeout) .build(); httpClient = HttpClients.custom() .setDefaultRequestConfig(requestConfig) .setConnectionManager(cm) .evictExpiredConnections() .evictIdleConnections(60L, TimeUnit.SECONDS) .setRetryHandler(DefaultHttpRequestRetryHandler.INSTANCE) .setMaxConnTotal(100) .setMaxConnPerRoute(50) .build(); } public IMResult httpJsonPost(String path, Object object, Class clazz) throws Exception{ return httpJsonPost(imurl, channelId, httpClient, path, object, clazz, post -> { int nonce = (int)(Math.random() * 100000 + 3); long timestamp = System.currentTimeMillis(); String str = nonce + "|" + channelSecret + "|" + timestamp; String sign = DigestUtils.sha1Hex(str); post.setHeader("Content-type", "application/json; charset=utf-8"); post.setHeader("Connection", "Keep-Alive"); post.setHeader("nonce", nonce + ""); post.setHeader("timestamp", "" + timestamp); post.setHeader("cid", channelId); post.setHeader("sign", sign); }); } public String getChannelId() { return channelId; } public String getChannelSecret() { return channelSecret; } @Override public void close() throws IOException { httpClient.close(); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/utilities/ClassUtil.java ================================================ /* * This file is part of the Wildfire Chat package. * (c) Heavyrain2012 * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ package cn.wildfirechat.sdk.utilities; import java.io.File; import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; import java.util.ArrayList; import java.util.Enumeration; import java.util.List; import java.util.jar.JarEntry; import java.util.jar.JarFile; /** * 类工具类 *

* 提供类加载和扫描相关的工具方法,用于获取指定包下的所有类。 * 支持从文件系统和JAR包中加载类。 *

*/ public class ClassUtil { /** * 获取同一路径下所有子类或接口实现类 * * @param cls * @return * @throws IOException * @throws ClassNotFoundException */ public static List> getAllAssignedClass(Class cls) throws IOException, ClassNotFoundException { List> classes = new ArrayList>(); for (Class c : getClasses(cls)) { if (cls.isAssignableFrom(c) && !cls.equals(c)) { classes.add(c); } } return classes; } /** * 取得当前类路径下的所有类 * * @param cls * @return * @throws IOException * @throws ClassNotFoundException */ public static List> getClasses(Class cls) throws IOException, ClassNotFoundException { String pk = cls.getPackage().getName(); // String path = pk.replace('.', '/'); // ClassLoader classloader = Thread.currentThread().getContextClassLoader(); // URL url = classloader.getResource(path); // String type = url.getProtocol(); // // System.out.println("the type is " + type); // System.out.println(url.getPath()); // // return getClasses(new File(url.getFile()), pk); List classNames = getClassName(pk, true); List> classes = new ArrayList<>(); for (String className : classNames) { if (className.endsWith(".class")) { className = className.substring(0, className.length() - 6); className = className.substring(className.lastIndexOf("/")+1, className.length()); } classes.add(Class.forName(className)); } return classes; } /** * 迭代查找类 * * @param dir * @param pk * @return * @throws ClassNotFoundException */ private static List> getClasses(File dir, String pk) throws ClassNotFoundException { System.out.println(dir.getAbsolutePath()); List> classes = new ArrayList>(); if (!dir.exists()) { return classes; } for (File f : dir.listFiles()) { if (f.isDirectory()) { classes.addAll(getClasses(f, pk + "." + f.getName())); } String name = f.getName(); if (name.endsWith(".class")) { classes.add(Class.forName(pk + "." + name.substring(0, name.length() - 6))); } } return classes; } /** * 获取某包下所有类 * @param packageName 包名 * @param childPackage 是否遍历子包 * @return 类的完整名称 */ public static List getClassName(String packageName, boolean childPackage) { List fileNames = null; ClassLoader loader = Thread.currentThread().getContextClassLoader(); String packagePath = packageName.replace(".", "/"); URL url = loader.getResource(packagePath); if (url != null) { String type = url.getProtocol(); if (type.equals("file")) { fileNames = getClassNameByFile(url.getPath(), null, childPackage); } else if (type.equals("jar")) { fileNames = getClassNameByJar(url.getPath(), childPackage); } } else { fileNames = getClassNameByJars(((URLClassLoader) loader).getURLs(), packagePath, childPackage); } return fileNames; } /** * 从项目文件获取某包下所有类 * @param filePath 文件路径 * @param className 类名集合 * @param childPackage 是否遍历子包 * @return 类的完整名称 */ private static List getClassNameByFile(String filePath, List className, boolean childPackage) { List myClassName = new ArrayList(); File file = new File(filePath); File[] childFiles = file.listFiles(); for (File childFile : childFiles) { if (childFile.isDirectory()) { if (childPackage) { myClassName.addAll(getClassNameByFile(childFile.getPath(), myClassName, childPackage)); } } else { String childFilePath = childFile.getPath(); if (childFilePath.endsWith(".class")) { if (childFilePath.indexOf("\\classes") >= 0 || childFilePath.indexOf("/classes") >= 0) { int start = childFilePath.indexOf("\\classes"); if (start == -1) { start = childFilePath.indexOf("/classes"); } childFilePath = childFilePath.substring(start + 9, childFilePath.lastIndexOf(".")); } childFilePath = childFilePath.replace("\\", "."); childFilePath = childFilePath.replace("/", "."); myClassName.add(childFilePath); } } } return myClassName; } /** * 从jar获取某包下所有类 * @param jarPath jar文件路径 * @param childPackage 是否遍历子包 * @return 类的完整名称 */ private static List getClassNameByJar(String jarPath, boolean childPackage) { List myClassName = new ArrayList(); String[] jarInfo = jarPath.split("!"); String jarFilePath = jarInfo[0].substring(jarInfo[0].indexOf("/")); String packagePath = jarInfo[1].substring(1); try { JarFile jarFile = new JarFile(jarFilePath); Enumeration entrys = jarFile.entries(); while (entrys.hasMoreElements()) { JarEntry jarEntry = entrys.nextElement(); String entryName = jarEntry.getName(); if (entryName.endsWith(".class")) { if (childPackage) { if (entryName.startsWith(packagePath)) { entryName = entryName.replace("/", ".").substring(0, entryName.lastIndexOf(".")); myClassName.add(entryName); } } else { int index = entryName.lastIndexOf("/"); String myPackagePath; if (index != -1) { myPackagePath = entryName.substring(0, index); } else { myPackagePath = entryName; } if (myPackagePath.equals(packagePath)) { entryName = entryName.replace("/", ".").substring(0, entryName.lastIndexOf(".")); myClassName.add(entryName); } } } } } catch (Exception e) { e.printStackTrace(); } return myClassName; } /** * 从所有jar中搜索该包,并获取该包下所有类 * @param urls URL集合 * @param packagePath 包路径 * @param childPackage 是否遍历子包 * @return 类的完整名称 */ private static List getClassNameByJars(URL[] urls, String packagePath, boolean childPackage) { List myClassName = new ArrayList(); if (urls != null) { for (int i = 0; i < urls.length; i++) { URL url = urls[i]; String urlPath = url.getPath(); // 不必搜索classes文件夹 if (urlPath.endsWith("classes/")) { continue; } String jarPath = urlPath + "!/" + packagePath; myClassName.addAll(getClassNameByJar(jarPath, childPackage)); } } return myClassName; } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/utilities/HttpUtils.java ================================================ package cn.wildfirechat.sdk.utilities; import cn.wildfirechat.common.ErrorCode; import cn.wildfirechat.sdk.model.IMResult; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.apache.commons.codec.digest.DigestUtils; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.security.SecureRandom; import java.util.concurrent.TimeUnit; /** * HTTP工具类 *

* 提供HTTP请求相关的工具方法,包括: *

    *
  • HTTP POST请求
  • *
  • HTTP GET请求
  • *
  • 响应处理
  • *
  • 日志记录
  • *
*

*/ public class HttpUtils extends JsonUtils { // ======================== 常量定义(消除硬编码)======================== private static final Logger LOG = LoggerFactory.getLogger(HttpUtils.class); public static final Gson GSON = new GsonBuilder().disableHtmlEscaping().create(); public static interface HeaderCallback { public void addHeaders(HttpPost httpPost); } // ======================== HTTP JSON POST请求 ======================== public static IMResult httpJsonPost(String adminUrl, String adminSecret, HttpClient httpClient, String path, Object object, Class clazz, HeaderCallback headerCallback) throws Exception { // 前置校验 validateInitStatus(adminUrl, adminSecret, httpClient); if (isNullOrEmpty(path)) { throw new IllegalArgumentException("请求路径不能为空"); } String url = adminUrl + path; HttpPost httpPost = new HttpPost(url); try { headerCallback.addHeaders(httpPost); // 设置请求体 String jsonStr = object == null ? "" : GSON.toJson(object); LOG.info("HTTP POST请求:{},请求体:{}", url, truncateLogContent(jsonStr)); StringEntity entity = new StringEntity(jsonStr, StandardCharsets.UTF_8); entity.setContentEncoding(StandardCharsets.UTF_8.name()); entity.setContentType("application/json"); httpPost.setEntity(entity); // 执行请求并处理响应 HttpResponse response = httpClient.execute(httpPost); return handleResponse(response, clazz, adminUrl, adminSecret); } catch (Exception e) { LOG.error("HTTP POST请求失败,路径:{}", path, e); throw new Exception("HTTP POST请求异常:" + e.getMessage(), e); } finally { httpPost.releaseConnection(); } } // ======================== 私有工具方法 ======================== /** * 校验初始化状态 */ protected static void validateInitStatus(String adminUrl, String adminSecret, HttpClient httpClient) { if (isNullOrEmpty(adminUrl) || isNullOrEmpty(adminSecret) || httpClient == null) { String errorMsg = "野火IM Server SDK未初始化,请调用AdminConfig.initAdmin(AdminUrl, AdminSecret)完成初始化"; LOG.error(errorMsg); throw new IllegalStateException(errorMsg); } } /** * 处理HTTP响应,统一解析逻辑 */ protected static IMResult handleResponse(HttpResponse response, Class clazz, String adminUrl, String adminSecret) throws Exception { int statusCode = response.getStatusLine().getStatusCode(); String content = readResponseContent(response); // 非200状态码处理 if (statusCode != HttpStatus.SC_OK) { String errorMsg = String.format("HTTP请求失败,状态码:%d,响应内容:%s", statusCode, truncateLogContent(content)); LOG.error(errorMsg); throw new Exception(errorMsg); } // 解析响应体 IMResult result = fromJsonObject(content, clazz); if (result != null) { if (result.getErrorCode() == ErrorCode.ERROR_CODE_AUTH_FAILURE) { LOG.error("鉴权失败,请检查IM服务地址({})或密钥({})配置", adminUrl, maskSecret(adminSecret)); } else if (result.getErrorCode() == ErrorCode.ERROR_CODE_SIGN_EXPIRED) { LOG.error("签名过期,请确保当前服务与IM服务({})时间同步", adminUrl); } } return result; } /** * 读取响应体(兼容分块传输,修复getContentLength=-1问题) */ protected static String readResponseContent(HttpResponse response) throws IOException { if (response.getEntity() == null) { return ""; } // 使用try-with-resources自动关闭所有流,避免资源泄漏 try (InputStream is = response.getEntity().getContent(); InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8); BufferedReader br = new BufferedReader(isr)) { StringBuilder sb = new StringBuilder(); String line; String nl = System.getProperty("line.separator"); while ((line = br.readLine()) != null) { sb.append(line).append(nl); } String content = sb.toString().trim(); LOG.info("HTTP响应内容:{}", truncateLogContent(content)); return content; } } /** * 截断超长日志内容(避免日志爆炸) */ protected static String truncateLogContent(String content) { if (content == null) { return ""; } int maxLength = 1024; return content.length() > maxLength ? content.substring(0, maxLength) + "..." : content; } /** * 掩码处理密钥(避免日志泄露敏感信息) */ protected static String maskSecret(String secret) { if (isNullOrEmpty(secret) || secret.length() <= 4) { return "******"; } return secret.substring(0, 2) + "******" + secret.substring(secret.length() - 2); } /** * 空值判断(补充实现,避免依赖外部未定义方法) */ public static boolean isNullOrEmpty(String str) { return str == null || str.trim().isEmpty(); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/utilities/JsonUtils.java ================================================ package cn.wildfirechat.sdk.utilities; import cn.wildfirechat.pojos.mesh.MeshRestResult; import cn.wildfirechat.sdk.model.IMResult; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import ikidou.reflect.TypeBuilder; /** * JSON工具类 *

* 提供JSON序列化和反序列化的工具方法。 *

*/ public class JsonUtils { public static final Gson gson = new GsonBuilder().disableHtmlEscaping().create(); public static IMResult fromJsonObject(String content, Class clazz) { TypeBuilder builder = TypeBuilder.newInstance(IMResult.class); if (!clazz.equals(Void.class)) { builder.addTypeParam(clazz); } return gson.fromJson(content, builder.build()); } public static MeshRestResult fromJsonObject2(String content, Class clazz) { TypeBuilder builder = TypeBuilder.newInstance(MeshRestResult.class); if (!clazz.equals(Void.class)) { builder.addTypeParam(clazz); } return gson.fromJson(content, builder.build()); } public static T fromJsonObject3(String content, Class cls, Class clazz) { TypeBuilder builder = TypeBuilder.newInstance(cls); if (!clazz.equals(Void.class)) { builder.addTypeParam(clazz); } return gson.fromJson(content, builder.build()); } public static boolean isNullOrEmpty(String str) { return str == null || str.isEmpty(); } } ================================================ FILE: sdk/src/main/java/cn/wildfirechat/sdk/utilities/RobotHttpUtils.java ================================================ package cn.wildfirechat.sdk.utilities; import cn.wildfirechat.sdk.model.IMResult; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import ikidou.reflect.TypeBuilder; import io.netty.util.internal.StringUtil; import org.apache.commons.codec.digest.DigestUtils; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; import org.apache.http.client.HttpClient; import org.apache.http.client.config.RequestConfig; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.DefaultHttpRequestRetryHandler; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.client.HttpClients; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Type; import java.net.MalformedURLException; import java.net.URL; import java.nio.charset.Charset; import java.util.concurrent.TimeUnit; /** * 机器人HTTP工具类 *

* 提供机器人API调用的HTTP工具方法,包括初始化、请求签名、HTTP请求等。 * 继承自HttpUtils并实现Closeable接口,专门用于机器人接口的调用。 *

*/ public class RobotHttpUtils extends HttpUtils implements Closeable { private static final Logger LOG = LoggerFactory.getLogger(RobotHttpUtils.class); public static final Gson gson = new GsonBuilder().disableHtmlEscaping().create(); private final String url; private final String robotId; private final String robotSecret; private final CloseableHttpClient httpClient; private final int port; private void checkPort() { if (port != 80 && port != 443 && port != -1) { if (port == 18080) { LOG.warn("您传入的机器人API地址中的端口是18080,18080端口默认为管理API端口,机器人API端口应该为IM服务的HTTP端口,默认为80,请确认是否使用错误!"); } else { LOG.warn("您传入的机器人API地址中的端口不是80/443,机器人API的端口和客户端使用端口一样,都应该为IM服务的HTTP端口,默认为80,请确实是否正确?如果您定制化了IM服务端口或者使用其他端口反向代理IM服务的HTTP端口请忽略此提示。"); } } } public RobotHttpUtils(String url, String robotId, String robotSecret) { this.url = url.trim(); this.robotId = robotId.trim(); this.robotSecret = robotSecret.trim(); try { URL u = new URL(this.url); int port = u.getPort(); if(port == -1) { port = u.getDefaultPort(); } this.port = port; } catch (MalformedURLException e) { throw new RuntimeException(e); } checkPort(); PoolingHttpClientConnectionManager cm = new PoolingHttpClientConnectionManager(); cm.setValidateAfterInactivity(1000); int connectTimeout = 5000; // 连接超时时间 int socketTimeout = 15000; // 请求超时时间 int connectionRequestTimeout = 3000; // 从连接池获取连接的超时时间 RequestConfig requestConfig = RequestConfig.custom() .setConnectTimeout(connectTimeout) .setSocketTimeout(socketTimeout) .setConnectionRequestTimeout(connectionRequestTimeout) .build(); httpClient = HttpClients.custom() .setDefaultRequestConfig(requestConfig) .setConnectionManager(cm) .evictExpiredConnections() .evictIdleConnections(60L, TimeUnit.SECONDS) .setRetryHandler(DefaultHttpRequestRetryHandler.INSTANCE) .setMaxConnTotal(100) .setMaxConnPerRoute(50) .build(); } public IMResult httpJsonPost(String path, Object object, Class clazz) throws Exception{ return httpJsonPost(url, robotId, httpClient, path, object, clazz, post -> { int nonce = (int)(Math.random() * 100000 + 3); long timestamp = System.currentTimeMillis(); String str = nonce + "|" + robotSecret + "|" + timestamp; String sign = DigestUtils.sha1Hex(str); post.setHeader("Content-type", "application/json; charset=utf-8"); post.setHeader("Connection", "Keep-Alive"); post.setHeader("nonce", nonce + ""); post.setHeader("timestamp", "" + timestamp); post.setHeader("rid", robotId); post.setHeader("sign", sign); }); } public String getRobotId() { return robotId; } public String getRobotSecret() { return robotSecret; } public CloseableHttpClient getHttpClient() { return httpClient; } @Override public void close() throws IOException { httpClient.close(); } } ================================================ FILE: sdk/src/main/java/ikidou/reflect/TypeBuilder.java ================================================ /* * Copyright 2016 ikidou * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ikidou.reflect; import ikidou.reflect.exception.TypeException; import ikidou.reflect.typeimpl.ParameterizedTypeImpl; import ikidou.reflect.typeimpl.WildcardTypeImpl; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.List; public class TypeBuilder { private final TypeBuilder parent; private final Class raw; private final List args = new ArrayList<>(); private TypeBuilder(Class raw, TypeBuilder parent) { assert raw != null; this.raw = raw; this.parent = parent; } public static TypeBuilder newInstance(Class raw) { return new TypeBuilder(raw, null); } private static TypeBuilder newInstance(Class raw, TypeBuilder parent) { return new TypeBuilder(raw, parent); } public TypeBuilder beginSubType(Class raw) { return newInstance(raw, this); } public TypeBuilder endSubType() { if (parent == null) { throw new TypeException("expect beginSubType() before endSubType()"); } parent.addTypeParam(getType()); return parent; } public TypeBuilder addTypeParam(Class clazz) { return addTypeParam((Type) clazz); } public TypeBuilder addTypeParamExtends(Class... classes) { if (classes == null) { throw new NullPointerException("addTypeParamExtends() expect not null Class"); } WildcardTypeImpl wildcardType = new WildcardTypeImpl(null, classes); return addTypeParam(wildcardType); } public TypeBuilder addTypeParamSuper(Class... classes) { if (classes == null) { throw new NullPointerException("addTypeParamSuper() expect not null Class"); } WildcardTypeImpl wildcardType = new WildcardTypeImpl(classes, null); return addTypeParam(wildcardType); } public TypeBuilder addTypeParam(Type type) { if (type == null) { throw new NullPointerException("addTypeParam expect not null Type"); } args.add(type); return this; } public Type build() { if (parent != null) { throw new TypeException("expect endSubType() before build()"); } return getType(); } private Type getType() { if (args.isEmpty()) { return raw; } return new ParameterizedTypeImpl(raw, args.toArray(new Type[args.size()]), null); } } ================================================ FILE: sdk/src/main/java/ikidou/reflect/TypeToken.java ================================================ /* * Copyright 2016 ikidou * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ikidou.reflect; import ikidou.reflect.exception.TypeException; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; public abstract class TypeToken { private final Type type; public TypeToken() { Type superclass = getClass().getGenericSuperclass(); if (superclass instanceof Class) { throw new TypeException("No generics found!"); } ParameterizedType type = (ParameterizedType) superclass; this.type = type.getActualTypeArguments()[0]; } public Type getType() { return type; } } ================================================ FILE: sdk/src/main/java/ikidou/reflect/exception/TypeException.java ================================================ /* * Copyright 2016 ikidou * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ikidou.reflect.exception; public class TypeException extends RuntimeException { public TypeException() { } public TypeException(String message) { super(message); } public TypeException(String message, Throwable cause) { super(message, cause); } public TypeException(Throwable cause) { super(cause); } public TypeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } } ================================================ FILE: sdk/src/main/java/ikidou/reflect/typeimpl/ParameterizedTypeImpl.java ================================================ /* * Copyright 2016 ikidou * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ikidou.reflect.typeimpl; import ikidou.reflect.exception.TypeException; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.lang.reflect.TypeVariable; import java.util.Arrays; @SuppressWarnings("SpellCheckingInspection") public class ParameterizedTypeImpl implements ParameterizedType { private final Class raw; private final Type[] args; private final Type owner; public ParameterizedTypeImpl(Class raw, Type[] args, Type owner) { this.raw = raw; this.args = args != null ? args : new Type[0]; this.owner = owner; checkArgs(); } private void checkArgs() { if (raw == null) { throw new TypeException("raw class can't be null"); } TypeVariable[] typeParameters = raw.getTypeParameters(); if (args.length != 0 && typeParameters.length != args.length) { throw new TypeException(raw.getName() + " expect " + typeParameters.length + " arg(s), got " + args.length); } } @Override public Type[] getActualTypeArguments() { return args; } @Override public Type getRawType() { return raw; } @Override public Type getOwnerType() { return owner; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(raw.getName()); if (args.length != 0) { sb.append('<'); for (int i = 0; i < args.length; i++) { if (i != 0) { sb.append(", "); } Type type = args[i]; if (type instanceof Class) { Class clazz = (Class) type; if (clazz.isArray()) { int count = 0; do { count++; clazz = clazz.getComponentType(); } while (clazz.isArray()); sb.append(clazz.getName()); for (int j = count; j > 0; j--) { sb.append("[]"); } } else { sb.append(clazz.getName()); } } else { sb.append(args[i].toString()); } } sb.append('>'); } return sb.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ParameterizedTypeImpl that = (ParameterizedTypeImpl) o; if (!raw.equals(that.raw)) return false; // Probably incorrect - comparing Object[] arrays with Arrays.equals if (!Arrays.equals(args, that.args)) return false; return owner != null ? owner.equals(that.owner) : that.owner == null; } @Override public int hashCode() { int result = raw.hashCode(); result = 31 * result + Arrays.hashCode(args); result = 31 * result + (owner != null ? owner.hashCode() : 0); return result; } } ================================================ FILE: sdk/src/main/java/ikidou/reflect/typeimpl/WildcardTypeImpl.java ================================================ /* * Copyright 2016 ikidou * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package ikidou.reflect.typeimpl; import java.lang.reflect.Type; import java.lang.reflect.WildcardType; import java.util.Arrays; public class WildcardTypeImpl implements WildcardType { private final Class[] upper; private final Class[] lower; public WildcardTypeImpl(Class[] lower, Class[] upper) { this.lower = lower != null ? lower : new Class[0]; this.upper = upper != null ? upper : new Class[0]; checkArgs(); } private void checkArgs() { if (lower.length == 0 && upper.length == 0) { throw new IllegalArgumentException("lower or upper can't be null"); } checkArgs(lower); checkArgs(upper); } private void checkArgs(Class[] args) { for (int i = 1; i < args.length; i++) { Class clazz = args[i]; if (!clazz.isInterface()) { throw new IllegalArgumentException(clazz.getName() + " not a interface!"); } } } @Override public Type[] getUpperBounds() { return upper; } @Override public Type[] getLowerBounds() { return lower; } @Override public String toString() { if (upper.length > 0) { if (upper[0] == Object.class) { return "?"; } return getTypeString("? extends ", upper); } else { return getTypeString("? super ", lower); } } private String getTypeString(String prefix, Class[] type) { StringBuilder sb = new StringBuilder(); sb.append(prefix); for (int i = 0; i < type.length; i++) { if (i != 0) { sb.append(" & "); } sb.append(type[i].getName()); } return sb.toString(); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; WildcardTypeImpl that = (WildcardTypeImpl) o; return Arrays.equals(upper, that.upper) && Arrays.equals(lower, that.lower); } @Override public int hashCode() { int result = Arrays.hashCode(upper); result = 31 * result + Arrays.hashCode(lower); return result; } } ================================================ FILE: systemd/README.md ================================================ # Linux Service 方式运行 除了命令行方式直接执行IM服务外,还可以以linux systemd service方式来运行,注意以这种方式运行,im服务的配置还是需要按照常规方法来配置。 ## 获取软件包 如果是社区版可以下载野火release或则会自己源码编译,得到软件压缩包```distribution-bundle-tar.tar.gz```、```im-server.deb```和```im-server.rpm```。如果是专业版使用专业版邮件里的链接下载软件压缩包,下载后先解压一次,得到```distribution-bundle-tar.tar.gz```、```im-server.deb```和```im-server.rpm```。 > ```im-server.deb```和```im-server.rpm```文件可能带有版本号,下面使用过程中,请注意修正为实际的文件名称。 ## 手动部署 ### 依赖 野火IM依赖JRE1.8手动部署需要手动安装JRE1.8,确保命令:```java -version```能看到正确的java版本信息才行。 ### 部署软件包 创建```/opt/im-server```目录,把软件包```distribution-bundle-tar.tar.gz```解压到这个目录下。解压后这个目录下有```bin```、```config```、```lib```、```systemd```等目录。 ### 放置systemd server file 把```systemd```目录下的```im-server.service```文件放到```/usr/lib/systemd/system/```目录下。然后执行命令```sudo systemctl daemon-reload```。 ### 目录结构 所有目录都在```/opt/im-server```目录下。包括日志目录、配置目录等。 ### 测试 根据下面管理服务的说明,启动服务,查看控制台日志,确认启动没有异常,服务器本地执行 ```curl -v http://127.0.0.1/api/version``` 能够返回版本的JSON信息。 ## 安装部署 ### 依赖 安装包安装将会自动安装依赖,不需要手动安装java。如果服务器上有其他版本的Java,请注意可能的冲突问题。 ### 部署软件包 可以直接安装```deb```和```rpm```格式的安装包,在debian系的linux系统(Ubuntu等使用```apt```命令安装软件的系统)中,使用命令: ```shell sudo apt install ./im-server.deb ``` 在红帽系的linux系统(Centos等使用```yum```命令安装软件的系统)中,使用命令: ```shell sudo yum install ./im-server.rpm ``` 注意在上述两个命令中,都使用的是本地安装,注意安装包名前的```./```路径。如果使用```dpkg -i ./im-server.deb```命令将不会安装依赖。 ### 目录结构 * /etc/im-server/config 配置文件目录 * /opt/im-server 程序目录 * /var/log/im-server 日志目录 * /var/lib/im-server/h2db H2数据库目录,如果使用mysql则不会使用 * /var/lib/im-server/media 内置对象存储数据目录,如果使用非内置,则目录不会使用。 ### 测试 根据下面管理服务的说明,启动服务,查看控制台日志,确认启动没有异常,服务器本地执行 ```curl -v http://127.0.0.1/api/version``` 能够返回版本的JSON信息。 ## 管理服务 * 刷新配置,当安装或者更新后需要执行: ```sudo systemctl daemon-reload``` * 启动服务: ```sudo systemctl start im-server``` * 停止服务: ```sudo systemctl stop im-server``` * 重启服务: ```sudo systemctl restart im-server``` * 查看服务状态:```sudo systemctl status im-server``` * 设置开机自启动:```sudo systemctl enable im-server``` * 禁止开机自启动:```sudo systemctl disable im-server``` * 查看控制台日志: ```journalctl -f -u im-server``` ## 修改服务内存大小 修改```/opt/im-server/bin/wildfirechat.sh```文件的倒数3、4行。打开Xmx和Xms配置,设置为合适的内存大小。 ## 配置 需要对IM服务配置来达到最好的执行效果,手动部署配置文件在````/opt/im-server/config````目录下,安装部署的配置文件在````/etc/im-server/config````目录下。 ## 日志 手动部署的日志文件在```/opt/im-server/logs```目录下,安装部署的日志在```/var/log/im-server```目录下。如果需要提供日志给野火官方,请把这个目录下的日志和制台日志(```journalctl -f -u im-server```)一起发给野火。 手动部署也可以修改目录,可以修改配置文件目录下的```config/log4j2.xml```修改日志的路径。 ================================================ FILE: systemd/im-server.service ================================================ [Unit] Description=IM Server Documentation=https://docs.wildfirechat.cn Wants=network-online.target After=network-online.target [Service] WorkingDirectory=/opt/im-server ExecStart=/bin/sh bin/wildfirechat.sh 2>&1 # Let systemd restart this service always Restart=always RestartSec=5 # Specifies the maximum file descriptor number that can be opened by this process LimitNOFILE=65536 # Specifies the maximum number of threads this process can create TasksMax=infinity # Disable timeout logic and wait until process is stopped TimeoutStopSec=infinity SendSIGKILL=no [Install] WantedBy=multi-user.target