Yahoo!Coder's Cookbook menu left background
Yahoo!Coder's Cookbook menu right background
YCC Trainer 1.1.0

Description:
YCC Trainer is a program that can be used to better understand how the Yahoo! Messenger protocol works. The intention is to teach through example and source code.
Language:
Visual Basic.NET 2005
Screenshot:
YCC Trainer screenshot

(Additional screen shots below)

Virus Scan:

Introduction

YCC Trainer is designed to teach the logic needed to make your own Yahoo! Messenger client. YCC Trainer is geared towards programmers with little to moderate experience and an understanding of the .NET languages. YCC Trainer is written in Visual Basic.NET 2005 and is part of a larger project at Yahoo! Coder’s Cookbook intended to teach you everything you need to know about the Yahoo! Messenger protocol. The Yahoo! Messenger protocol version used by YCC Trainer is 15.

YCC Trainer is the next version of the Yahoo! Trainer. You can think of it as Yahoo! Trainer 2.0. The reason that I scraped the original version is because I wanted to make good clean code that anyone can understand.

Design

YCC Trainer Program Structure

YCC Trainer currently consists of two different projects, the front end GUI and the backend protocol engine. The backend is designed to be separated from the GUI and used for any number of tasks. Since the goal of YCC Trainer is to show how the Yahoo! Messenger protocol works, I will primarily focus on the backend called YCC_YMSG_Functions

YCC Trainer program structure diagram

YCC_YMSG_Functions

YCC_YMSG_Functions consists of four modules, modUser, modYFunctions, modByteFunctions, and modSockets. The only module that will need to be accessed is modUser as this is the place that all state data, function calls, and events reside. 

YCC Trainer YMSG_Functions diagram

All high level communication within YUser is contained in a structure called uPacket. A uPacket contains all the header information and payload in an easy to access structure without having to manually parse the information. The process for converting a packet to raw byte data and vice versa is contained in modYFunctions. When sending a YMSG message you should call modYFunctions.PacketToByte and when receiving a YMSG message you should convert it to a uPacket by calling modYFunctions.ByteToPacket. The third module, modByteFunctions, holds methods for byte operations such as byte concatenation, which is used throughout YUser. Lastly, modSockets is the network facing module that converts the byte data into an asynchronous Windows API socket.

Because communications within the Yahoo! Messenger Protocol is asynchronous, data can be sent and received independently and at any time. To send data simply call the associated method in modUsers. Receiving data is more complicated but is handled by the socket_receive and modUser_ProcessPacket functions. socket_receive handles all of the special cases that a YMSG packet can contain and modUser_ProcessPacket takes action on a particular YMSG services.

Creating a GUI

The first step in creating a front end to modUser is to create a new instance of YUser. After this has been done, call modUser.Login. In this case Login can be considered the New function because it initializes your instance of YUser and makes it ready to become fully operational. The Login function is also special because it kicks off the packet sequence needed to validate a user against the Yahoo! servers. Once the AuthResp packet has been correctly sent, you can consider your user to be logged onto Yahoo!

Dim yUser As New YCC_YMSG_Functions.modUser
Dim UserData As New YCC_YMSG_Functions.modUser.uUserData
Dim ServerData As New YCC_YMSG_Functions.modUser.uServerData
_YUser = yUser

yUser.Login(UserData, ServerData)

While you are creating a new instance of yUser you should also add handlers for the many modUser events that can be triggered. Some of these include LogonSuccess, LogonFail, BuddyListUpdate, and NewMail.

AddHandler yUser.PacketRecieved, AddressOf debug.modUser_PacketRecieved
AddHandler yUser.PacketSent, AddressOf debug.modUser_PacketSent
AddHandler yUser.LoginFail, AddressOf yUser_LoginFail
AddHandler yUser.NewMail, AddressOf yUser_NewMail
AddHandler yUser.BuddyListUpdate, AddressOf yUser_BuddyListUpdate
AddHandler yUser.ErrorMessage, AddressOf yUser_ErrorMessage
AddHandler yUser.MessageRecieve, AddressOf yUser_MessageRecieve
AddHandler yUser.NotifyRecieve, AddressOf yUser_NotifyRecieve

Bugs and Gottchas

This should be considered ALPHA version software. The maturity of this software is akin to a 3 month old baby. With that said, the information contained within this program is still very valuable and I feel that it would be a waste to hold it back any longer. When running this code please expect crashes of all sorts.

Requirements

Changes

Version 1.1.0

  • It will now fully logon. 
  • A programming error during the AuthResp did not properly process the response challenge strings.
  • Uses YMSG protocol version 15.
  • New program structure. The high level unit of data is now the uPacket. Multiple YMSG packets within a TCP packet can be handled.
  • A YMSG message spanning multiple TCP packets can be handled.
  • Buddy list properly implemented.
  • Separate ignore list.
  • Invisible logon.
  • Basic message handling.
  • Basic typing notify handling.
  • A few experimental procedures. Nothing interesting to report yet.
  • Much more but these are the major fixes.

To Do

  • For now the debug window should be considered broken. It does its very basic job but I have a lot of work to do on the presentation. I have also implemented a custom data structure for the queue. The default size is 25 and I have not tested it over this limit. If it crashes after 25 sent or received messages then this is mostly likely the culprit.
  • Implement custom packet maker.
  • Ability to update the buddy list status.
  • Add, accept, or remove buddies.
  • There is a bug during log off. Apparently instead of YMSG, the server sends ****.

License Agreement

The software, YCC Trainer, is distributed under the Creative Commons GNU General Public License which can be found at http://creativecommons.org/licenses/GPL/2.0/ The major points follow:

  1. No commercial distribution without permission.
  2. You are allowed to modify the program and source, all I ask is you keep the original credit.
  3. If you do modify the program it will fall under the same license agreement.

I have chosen this license to allow users to do pretty much what they want with the program. The big thing that I ask is please don't redistribute this software without acknowledgment to YCC and a link back to http://ycoderscookbook.com. I would love to hear what you think about the program and if you have made useful changes. A forum for YCC YCC Trainer can be found at http://www.ycoderscookbook.com/forums/viewforum.php under the Programs directory.

As with any piece of freeware, I have made every effort to make the software useable and friendly. With that said I take no responsibility for damage created by this program or the user’s actions. You may be violating the Yahoo! Terms of Service by using this program. The user takes full responsibility for their actions.

Source and Executible

Full source code is provided. Please feel free to modify YCC Trainer as long as you read and understand the license agreement.

YCC Trainer Source

Additional Screeshots

YCC Trainer debug screenshot

Debug Window

YCC Trainer IM window screenshot

IM Window

Search Yahoo! Coder's Cookbook via Google search
Last Modified:
Visitors: