public override void NotifyUpdateChannelState(Google.ProtocolBuffers.IRpcController controller, UpdateChannelStateNotification request, Action<bnet.protocol.NO_RESPONSE> done) { throw new NotImplementedException(); }
private void HandleChannelSubscriber_NotifyUpdateChannelState(RPCContext context) { UpdateChannelStateNotification updateChannelStateNotification = UpdateChannelStateNotification.ParseFrom(context.Payload); base.ApiLog.LogDebug("HandleChannelSubscriber_NotifyUpdateChannelState: " + updateChannelStateNotification); ChannelAPI.ChannelReferenceObject channelReferenceObject = this.GetChannelReferenceObject(context.Header.ObjectId); if (channelReferenceObject == null) { base.ApiLog.LogError("HandleChannelSubscriber_NotifyUpdateChannelState had unexpected traffic for objectId : " + context.Header.ObjectId); return; } ChannelAPI.ChannelType channelType = channelReferenceObject.m_channelData.m_channelType; switch (channelType) { case ChannelAPI.ChannelType.PRESENCE_CHANNEL: if (updateChannelStateNotification.StateChange.HasPresence) { bnet.protocol.presence.ChannelState presence = updateChannelStateNotification.StateChange.Presence; this.m_battleNet.Presence.HandlePresenceUpdates(presence, channelReferenceObject); } return; case ChannelAPI.ChannelType.CHAT_CHANNEL: case ChannelAPI.ChannelType.GAME_CHANNEL: break; case ChannelAPI.ChannelType.PARTY_CHANNEL: this.m_battleNet.Party.PreprocessPartyChannelUpdated(channelReferenceObject, updateChannelStateNotification); break; default: return; } ChannelAPI.ChannelData channelData = (ChannelAPI.ChannelData)channelReferenceObject.m_channelData; if (channelData != null) { bool flag = channelType == ChannelAPI.ChannelType.PARTY_CHANNEL; bool flag2 = false; Map <string, Variant> map = null; bnet.protocol.channel.ChannelState channelState = channelData.m_channelState; bnet.protocol.channel.ChannelState stateChange = updateChannelStateNotification.StateChange; if (stateChange.HasMaxMembers) { channelState.MaxMembers = stateChange.MaxMembers; } if (stateChange.HasMinMembers) { channelState.MinMembers = stateChange.MinMembers; } if (stateChange.HasMaxInvitations) { channelState.MaxInvitations = stateChange.MaxInvitations; } if (stateChange.HasPrivacyLevel && channelState.PrivacyLevel != stateChange.PrivacyLevel) { channelState.PrivacyLevel = stateChange.PrivacyLevel; flag2 = true; } if (stateChange.HasName) { channelState.Name = stateChange.Name; } if (stateChange.HasDelegateName) { channelState.DelegateName = stateChange.DelegateName; } if (stateChange.HasChannelType) { if (!flag) { channelState.ChannelType = stateChange.ChannelType; } if (flag && stateChange.ChannelType != PartyAPI.PARTY_TYPE_DEFAULT) { channelState.ChannelType = stateChange.ChannelType; int num = -1; for (int i = 0; i < channelState.AttributeList.get_Count(); i++) { if (channelState.AttributeList.get_Item(i).Name == "WTCG.Party.Type") { num = i; break; } } Attribute attribute = ProtocolHelper.CreateAttribute("WTCG.Party.Type", channelState.ChannelType); if (num >= 0) { channelState.AttributeList.set_Item(num, attribute); } else { channelState.AttributeList.Add(attribute); } } } if (stateChange.HasProgram) { channelState.Program = stateChange.Program; } if (stateChange.HasAllowOfflineMembers) { channelState.AllowOfflineMembers = stateChange.AllowOfflineMembers; } if (stateChange.HasSubscribeToPresence) { channelState.SubscribeToPresence = stateChange.SubscribeToPresence; } if (stateChange.AttributeCount > 0 && map == null) { map = new Map <string, Variant>(); } for (int j = 0; j < stateChange.AttributeCount; j++) { Attribute attribute2 = stateChange.AttributeList.get_Item(j); int num2 = -1; for (int k = 0; k < channelState.AttributeList.get_Count(); k++) { Attribute attribute3 = channelState.AttributeList.get_Item(k); if (attribute3.Name == attribute2.Name) { num2 = k; break; } } if (attribute2.Value.IsNone()) { if (num2 >= 0) { channelState.AttributeList.RemoveAt(num2); } } else if (num2 >= 0) { channelState.Attribute.set_Item(num2, attribute2); } else { channelState.AddAttribute(attribute2); } map.Add(attribute2.Name, attribute2.Value); } if (stateChange.HasReason) { IList <Invitation> invitationList = stateChange.InvitationList; IList <Invitation> invitationList2 = channelState.InvitationList; for (int l = 0; l < invitationList.get_Count(); l++) { Invitation invitation = invitationList.get_Item(l); for (int m = 0; m < invitationList2.get_Count(); m++) { Invitation invitation2 = invitationList2.get_Item(m); if (invitation2.Id == invitation.Id) { channelState.InvitationList.RemoveAt(m); break; } } } } else { channelState.Invitation.AddRange(stateChange.InvitationList); } channelData.m_channelState = channelState; if (flag) { if (flag2) { this.m_battleNet.Party.PartyPrivacyChanged(channelData.m_channelId, channelState.PrivacyLevel); } if (stateChange.InvitationList.get_Count() > 0) { uint?removeReason = default(uint?); if (stateChange.HasReason) { removeReason = new uint?(stateChange.Reason); } using (List <Invitation> .Enumerator enumerator = stateChange.InvitationList.GetEnumerator()) { while (enumerator.MoveNext()) { Invitation current = enumerator.get_Current(); this.m_battleNet.Party.PartyInvitationDelta(channelData.m_channelId, current, removeReason); } } } if (map != null) { foreach (KeyValuePair <string, Variant> current2 in map) { this.m_battleNet.Party.PartyAttributeChanged(channelData.m_channelId, current2.get_Key(), current2.get_Value()); } } } } }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) { switch (methodId) { case 1: { JoinNotification request = new JoinNotification(); request.MergeFrom(stream); BattlenetRpcErrorCode status = HandleOnJoin(request); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnJoin(bgs.protocol.channel.v1.JoinNotification: {1}) status: {2}.", GetCallerInfo(), request.ToString(), status); if (status != 0) { SendResponse(token, status); } break; } case 2: { MemberAddedNotification request = new MemberAddedNotification(); request.MergeFrom(stream); BattlenetRpcErrorCode status = HandleOnMemberAdded(request); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnMemberAdded(bgs.protocol.channel.v1.MemberAddedNotification: {1}) status: {2}.", GetCallerInfo(), request.ToString(), status); if (status != 0) { SendResponse(token, status); } break; } case 3: { LeaveNotification request = new LeaveNotification(); request.MergeFrom(stream); BattlenetRpcErrorCode status = HandleOnLeave(request); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnLeave(bgs.protocol.channel.v1.LeaveNotification: {1}) status: {2}.", GetCallerInfo(), request.ToString(), status); if (status != 0) { SendResponse(token, status); } break; } case 4: { MemberRemovedNotification request = new MemberRemovedNotification(); request.MergeFrom(stream); BattlenetRpcErrorCode status = HandleOnMemberRemoved(request); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnMemberRemoved(bgs.protocol.channel.v1.MemberRemovedNotification: {1}) status: {2}.", GetCallerInfo(), request.ToString(), status); if (status != 0) { SendResponse(token, status); } break; } case 5: { SendMessageNotification request = new SendMessageNotification(); request.MergeFrom(stream); BattlenetRpcErrorCode status = HandleOnSendMessage(request); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnSendMessage(bgs.protocol.channel.v1.SendMessageNotification: {1}) status: {2}.", GetCallerInfo(), request.ToString(), status); if (status != 0) { SendResponse(token, status); } break; } case 6: { UpdateChannelStateNotification request = new UpdateChannelStateNotification(); request.MergeFrom(stream); BattlenetRpcErrorCode status = HandleOnUpdateChannelState(request); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnUpdateChannelState(bgs.protocol.channel.v1.UpdateChannelStateNotification: {1}) status: {2}.", GetCallerInfo(), request.ToString(), status); if (status != 0) { SendResponse(token, status); } break; } case 7: { UpdateMemberStateNotification request = new UpdateMemberStateNotification(); request.MergeFrom(stream); BattlenetRpcErrorCode status = HandleOnUpdateMemberState(request); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ChannelListener.OnUpdateMemberState(bgs.protocol.channel.v1.UpdateMemberStateNotification: {1}) status: {2}.", GetCallerInfo(), request.ToString(), status); if (status != 0) { SendResponse(token, status); } break; } default: Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); break; } }
BattlenetRpcErrorCode HandleOnUpdateChannelState(UpdateChannelStateNotification request) { Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method ChannelListener.OnUpdateChannelState: {1}", GetCallerInfo(), request.ToString()); return(BattlenetRpcErrorCode.RpcNotImplemented); }
public override void NotifyUpdateChannelState(Google.ProtocolBuffers.IRpcController controller, UpdateChannelStateNotification request, Action <bnet.protocol.NO_RESPONSE> done) { throw new NotImplementedException(); }