Skip to content
oferfrid edited this page May 1, 2011 · 1 revision

Changes from the original version.

all the changes made are implemented in the MessageManager class.

Adding the implementation to handle SNAC(04,07):channel 4.

   private void ProcessMessage(DataPacket dp)
		{
			// Pull apart the fixed part of the message
			byte[] message_cookie = dp.Data.ReadByteArray(8);
			ushort channel = dp.Data.ReadUshort();
			UserInfo ui = dp.Data.ReadUserInfo();

			IM message = new IM(ui);
			message.Cookie = Cookie.GetReceivedCookie(message_cookie);

			// End of the fixed part. Pull apart the channel-specific data
			switch (channel)
			{
				case 0x0001:
					ProcessChannelOneMessage(dp.Data, ui);
					break;
				case 0x0002:
					ProcessChannelTwoMessage(dp.Data, ui);
					break;
				case 0x0004: //SMS From ISRAEL
					ProcessChannelFourMessage(dp.Data, ui);
					break;
				default:
					parent.OnWarning(ServerErrorCode.UnknownMessageChannel);
					break;
			}
		}

After the standard TLVs fixed part described here http://iserverd.khstu.ru/oscar/snac_04_07.html the SNAC(04,07):channel 4 contains a message in XML format under the TLV with ID 5

<sms_message>
	<source>ICQ</source>
	<destination_UIN>#########</destination_UIN>
	<sender>+972##########</sender>
	<text>Test1234</text>
	<time>Sun, 01 May 2011 03:50:17 EDT</time>
</sms_message>

this format wasn't documented but I used sender as the UserID and the text as the message text.