# This file is part of bish-bosh. It is subject to the licence terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/raphaelcohn/bish-bosh/master/COPYRIGHT. No part of bish-bosh, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
# Copyright © 2014-2015 The developers of bish-bosh. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/raphaelcohn/bish-bosh/master/COPYRIGHT.


core_usesIn bishbosh/connection error
bishbosh_connection_read_controlpacket_UNSUBACK()
{
	bishbosh_connection_error_ifRemainingLengthNot UNSUBACK 2

	local packetIdentifier
	bishbosh_connection_read_packetIdentifier
	
	local ourPacketIdentifierFolderPath
	bishbosh_connection_packetIdentifier_ourPacketIdentifierFolderPath
	
	local unknownPacketIdentifier
	if [ -f "$ourPacketIdentifierFolderPath"/unsubscribe ]; then
		unknownPacketIdentifier=0
	else
		unknownPacketIdentifier=1
		
		core_message WARN "Received an UNSUBACK with packet identifier '$packetIdentifier' for an UNSUBSCRIBE that doesn't appear to be ours'"
	fi
	
	bishbosh_connection_handler_UNSUBACK
	
	bishbosh_connection_packetIdentifier_retireOneOfOurs
}
