Posted by kay21s in August 16, 2010
The Fedora Summer Coding project — Libyahoo2 chat room support has been completed.
My code is on the github, Link : http://github.com/kay21s/Libyahoo2
The work before mid-term evaluation:
Work from mid-term evaluation to final:
In this process, I have learned quite a lot. Some good skills in programming, some useful tools and the way of communicating with community.
I can do it better if I tried to understand other parts in the code and get some knowledge on the usual function tools that are used. So that I can keep consistent with the origin style. What’s more, It is better that the community organizer can be a bit more efficient, such as having a firm deadline, reply to questions ASAP and so on.
I’d like to say thanks to my mentor, Siddhesh Poyarekar. You are nice and patient, never tires of answering my questions, even it sounds fool sometimes. And Philip Tellis, thank you for your suggestions on libyahoo2-dev mailing list. Vera, thanks for your great work and your support, I appreciate it more than I can say.
Posted by kay21s in July 25, 2010
This is extracted as a function which takes a raw packet as the input and gives out a structured one.
The structured packet has the following fields: HTTP version(1.0/1.1), HTTP response number, all name-value pairs and the content. Now we no longer use the strstr() or strchr() to locate a field or the information we want which is also fallible.
In this way, the application can use it to get the information they need by using the fields in the struct directly. It is more convenient for not only the captcha processing function to find the location field but also for other functions which needs information from the HTTP packet.
Posted by kay21s in July 24, 2010
In the previous blog, it can get all categories via “CHL 0″, then the libyahoo2 will receive the response from server and handle it to the sample client which will analyze its XML content and displays all the categories. Each category is given an ID.
Now using the ID of a category, such as 1015, can get all the chat rooms in that category. “CHL 1015″ command can be used. It will display the information of the each chat room, such as user number, number of users with webcam and so on.
In the process, I have encountered one problem which have puzzled me for a long time: the malloc got to be wrong when allocating a bulk of memory. At last, I have found that’s because the strcpy operation before the malloc has copied a string to a memory space smaller than the size of the string, thus it destroys the stack of malloc and lead to the errors.
Posted by kay21s in July 19, 2010
Getting chat room categories is an important function, since users can see the categories and then can select one they are most interested in to enter.
At first, I defined a struct myself to store the chat room category information. My mentor told me that it is better to use the already-defined structure, struct YList. Then I implemented it with the YList struct and store the specified information in a self-defined structure which is stored in the data field of the YList struct, it is a general way to store information.
In the implementation, the prev pointer of YList is used as a pointer to the subcategories of the current one. Now using CHL 0 can get all the categories of Yahoo chat rooms.
Thanks to Philip Tellis, after I have send a query in the dev-libyahoo2 mailling list, he pointed that the URL of the captcha image should be found in the Location field of the HTTP header, but not the HTTP content. Since the HTTP content may not be sent, the Location field is a better way in a HTTP 301 response.
I have implemented it in this way, thanks to his suggestions!
Posted by kay21s in July 13, 2010
Thanks for my mentor’s help, this function has been completed.
When accessing a chat room, yahoo sends a image and only is given the correct captcha will be allowed to enter the chat room. If what is typed in is wrong, yahoo will respond with a URL of a new image to verify again. Previously, we did not handle the situation when what is typed is wrong.
I add a new connection type YAHOO_CAPTCHA_CONNECTION to handle the connection used for post the captcha and parse the responds from the server. There comes a problem when I am writing the code, I kept on receiving the same packet sent from the server after typing the wrong captcha and do not know why. Mentor told me to close the connection each time before sending the new captcha again because HTTP 1.1 does not close its connection automatically.
Now the lib can kept on receiving the response and handle the new URL to the client after a wrong captcha is typed by the user until a correct one is received.
Posted by kay21s in June 28, 2010
Until now, most of the project has been completed.
I have finished the following works in the passing days:
1. Implement the chat logon message.
2. Implement the chat join message.
3. Extract the URL of the verification image in the received message, using callback function to let the user input the verification code. Then using the http functions inside the Libyahoo2 to send the identifying code to the server.
4. Implement the logout message.
5. Updated some fields in the previous version
6. Write a detailed documentation of the chat room support and the chat room-related YMSG protocol.
Posted by kay21s in June 6, 2010
I spent the week trying to understand the chat room protocol dumps I got from the yahoo messenger program. I have documented it in the $(top_srcdir)/doc/ymsg-chatroom.txt
The first job going to finish: the login process.
1.Chat online. A few new keys, such as language and country, are added and some keys in the previous version are dropped.
2.Chat login. Different from the previous version, yahoo messenger now has a mechanism to prevent spam and bot. A image URL is sent from the server, this URL should be handed to client. The client gets the image and gets the user’s input. Library should have a function which is called by the client to send the characters user typed in.
Posted by kay21s in June 5, 2010
Service : Chat Logout (160 0xa0)
Client –> Server
Server –> Client
Posted by kay21s in June 5, 2010
Service : Keep Alive(138 0x8a)
Client –> Server
Service : Comment(168 0xa8)
Client –> Server
Server –> Client
Service : Chat Join (152 0×98)
Server –> Client :
Service : Chat Exit(155 0x9b)
Server –> Client