Marwan's Open Source Project -------------------------------------------------------------------------------------------------------- ******************************************************************************************************* 4/9/2003 ******************************************************************************************************* After searching for an open source project for the assigenment. Took me couple of hours to find something suitable, and I finally deciding to work with this particular one becuase of being short with time looking for an interesting problem that would itch me, but this is a not bad starting point, I'd probably will work and find more bug to mess around with later on, whether in class or out of class for more experiance. The project that I choose to fix a bug in is gaim. here is a summary for the information: [ 716575 ] IM windows pop above xscreensaver You may monitor this Tracker item after you login (register an account, if you do not already have one). Submitted By: John Taylor (odinsdream) Date Submitted: 2003-04-06 22:55 Last Updated By: bsponline - Comment added Date Last Updated: 2003-04-07 21:11 Category: None Group: None Assigned To: Nobody/Anonymous (nobody) Priority: 5 Status: Open Resolution: None Summary: IM windows pop above xscreensaver I recently upgraded to the lastest gaim-cvs, and while my screensaver was running, I received an instant message. The screensaver continued running, but the instant message window appeared. I moved the mouse, and the screensaver froze to ask for my password, at this time, the window receeded beneath the visuals. To me, this is somewhat undesireable. I did 'make' and 'makeinstall', and im in the process of reading, making some trivial changes in the code, and looking at the problem, and thinking of how to fix the bug that was asked. 'configure','make','make install' successfully done. I'm browsing the software and making changes. ******************************************************************************************* 4/9/2003 ****************************************************************************************** Looking at the various peices of code that I have, understanding what each file does, and different function, trying to related and analyse, build a virtual model of how the software works. While doing that, ill be thinking of how to target my problem, becuase I have no idea of where to start with it, I have never done such a thing before. I will come back later, I already spent around 2 or 3 hours. ********************************************************************************************* 4/9/2003 ********************************************************************************************* Still in the process of tracking down the program and figuring out where the bug would be. At this point, I think after reading the files of several hours, I have narrowed down the amount of files I should be scanning. The files: conversation.h, conversation.c, gtkconv.c, gtkconv.h and there might be couple more than I need to focus more into. Around 2.5 hours spent. ********************************************************************************************* 4/10/2003 ********************************************************************************************* There are number of functions that could lead me to the key, which are: void gaim_window_destroy(struct gaim_window *win); /** * Shows the specified conversation window. * * @param win The window. */ void gaim_window_hide(struct gaim_window *win); /** * Raises the specified conversation window. * * @param win The window. */ void gaim_window_raise(struct gaim_window *win); /** * Causes the window to flash for IM notification, if the UI supports this. * * @param win The window. */ -There are another set of functions that are kind of confusing me, whether they could have something worth it or not, which are: void gaim_window_switch_conversation(struct gaim_window *win, unsigned int index); /** * Returns the active conversation in the window. * * @param win The window. * * @return The active conversation. */ struct gaim_conversation *gaim_window_get_active_conversation( const struct gaim_window *win); /** * Returns the list of conversations in the specified window. * * @param win The window. * * @return The list of conversations. */ GList *gaim_window_get_conversations(const struct gaim_window *win); /** * Returns a list of all windows. * * @return A list of windows. */ GList *gaim_get_windows(void); /** * Returns the first window containing a conversation of the specified type. * * @param type The conversation type. * * @return The window if found, or @c NULL if not found. */ struct gaim_window *gaim_get_first_window_with_type(GaimConversationType type); /** * Returns the last window containing a conversation of the specified type. * * @param type The conversation type. * * @return The window if found, or @c NULL if not found. */ struct gaim_window *gaim_get_last_window_with_type(GaimConversationType type); - Around 1.5 hours spent. ******************************************************************************************** 4/13/2003 ******************************************************************************************** Not having alot of knowledge in the "background" aspect might make life a bit harder for me, I might be wrong that I really do not need any knowledge of how the "windows" and other stuff handles background issues. Finally, I think I have found the scope of where the bug could be. The file idle.c might be the answer i'v been looking for. here is a fragment of a code if it makes sense( I know alot of thigns might not be understandable, becuase they are not straight_forward issues). #define IDLEMARK 600 /* 10 minutes! */ gint check_idle(gpointer data) { struct gaim_connection *gc = data; time_t t; #ifdef USE_SCREENSAVER #ifndef _WIN32 static XScreenSaverInfo *mit_info = NULL; #endif #endif int idle_time; plugin_event(event_blist_update); time(&t); #ifdef USE_SCREENSAVER if (report_idle == IDLE_SCREENSAVER) { #ifndef _WIN32 int event_base, error_base; if (XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base)) { if (mit_info == NULL) { mit_info = XScreenSaverAllocInfo(); } XScreenSaverQueryInfo(GDK_DISPLAY(), GDK_ROOT_WINDOW(), mit_info); idle_time = (mit_info->idle) / 1000; } else idle_time = 0; #else idle_time = (GetTickCount() - wgaim_get_lastactive()) / 1000; #endif } else #endif /* USE_SCREENSAVER */ idle_time = t - gc->lastsent; if ((away_options & OPT_AWAY_AUTO) && (idle_time > (60 * auto_away)) && (!gc->is_auto_away)) { if (!gc->away) { debug_printf("making %s away automatically\n", gc->username); if (g_slist_length(connections) == 1) do_away_message(NULL, default_away); else if (default_away) serv_set_away(gc, GAIM_AWAY_CUSTOM, default_away->message); gc->is_auto_away = 1; set_default_away(NULL, (gpointer)g_slist_index(away_messages, default_away)); } else gc->is_auto_away = 2; } else if (gc->is_auto_away && idle_time < 60 * auto_away) { if (gc->is_auto_away == 2) { gc->is_auto_away = 0; return TRUE; } gc->is_auto_away = 0; if (awaymessage == NULL) { debug_printf("removing auto-away message for %s\n", gc->username); serv_set_away(gc, GAIM_AWAY_CUSTOM, NULL); } else { if (g_slist_length(connections) == 1) do_im_back(0, 0); else { debug_printf("replacing auto-away with global for %s\n", gc->username); serv_set_away(gc, GAIM_AWAY_CUSTOM, awaymessage->message); } } } /* If we're not reporting idle times to the server, still use Gaim usage for auto-away, but quit here so we don't report to the server */ if (report_idle == IDLE_NONE) { return TRUE; } if (idle_time >= IDLEMARK && !gc->is_idle) { debug_printf("setting %s idle %d seconds\n", gc->username, idle_time); serv_set_idle(gc, idle_time); gc->is_idle = 1; system_log(log_idle, gc, NULL, OPT_LOG_BUDDY_IDLE | OPT_LOG_MY_SIGNON); } else if (idle_time < IDLEMARK && gc->is_idle) { debug_printf("setting %s unidle\n", gc->username); serv_touch_idle(gc); system_log(log_unidle, gc, NULL, OPT_LOG_BUDDY_IDLE | OPT_LOG_MY_SIGNON); } return TRUE; } -I really think that I have found the scope of the problem, but the problem is I do not understand evrything that is going on. The reason why I think I have found the scope of the bug is because the function is dealing with screensavers and with Idle times. -I went over the file again, but things are most confusing than they should be, im kind of lost. 2-3 hours spent. ******************************************************************************** 4/15 ******************************************************************************** Discovering that I should consider changing my first open source project. I'm starting to look for a simpler project. more reserach to do ******************************************************************************* 4/16 ******************************************************************************* I spent around an hour to two hours looking for a simpler bug to fix. I found a bug that deals with the URLs, like when you are chatting with a friend, and you send them a URL and then it gets desplayed on the conversation the URL doesnt get shown to you as a URl that you can click on to be displayed, while if your friend sends you the URL, you can click on it and it will open a brawser and everything will be fine. I downloaded the necessary files and all that, and gunziped them and untarred them, but the new problem that i faced is that I cant log in an get online on gaim. I let it try to connect for a while, but nothing happened. Then I got another idea to look for a different bug. I was pointed out that there could be a bug in ddd, when you first launch the program, and gives you the tip of the day, the tip of the day gets printed twice, or the last line gets printed twice, incase there was more than one line in tip. I went to get the source code for ddd, I managed to do that, downloaded it, gunzipped it, but its either taking for ever to untar it, or something is wrong with the file. After messing with it for about 1 hour. I decided to stop. **************************************************************************** 4/19 **************************************************************************** Trying to compile ddd and make sure its working fine, in order to start fixing the bug which is when you first launch the software, there will be two similar lines of "Tips of the day" printed rather than only one. So far im having difficulty compiling and "making" without errors. And the problem is not a quota problem, some other errors in "./configure" and "make" spent 2hrs. ***************************************************************************** 4/20 ***************************************************************************** Going back to the same problem. Still not working fine. So far i tried all 3 different versions of the ddd, and i fianlly settled on the 3.3.1, the latest version. I think, everything is working fine at the moment, the compiling finished proprely, and now im looking at the code. The problem as I said deals with the tips of the day, so I need to backtrace the software, since its the first thing that gets launched and see where the bug lies. I spent couple of hours just looking at the different files and understanding them. spent 3hrs all together. ***************************************************************************** 4/21 ***************************************************************************** I think I know where the problem lies. Im just a bit confused by the data structure and too many function calling. But I think I narrowed down the scope of my problem alot, and I just need a bit more time, and things hopefully with work out. I'm not sure about this fragment of the code, // Read ~/.ddd/tips resources XrmDatabase dddtips = GetFileDatabase(session_tips_file()); if (dddtips != 0) XrmMergeDatabases(dddtips, &dddinit); // Let command-line arguments override ~/.ddd/init XrmParseCommand(&dddinit, options, XtNumber(options), DDD_CLASS_NAME, &argc, (char**)argv); spent 1hr. ********************************************************************************* 4/22 ********************************************************************************* I'm still tracing the problem, and the above function doesnt seem to lead me to the right track, it gets called from ddd.C, then goes to mainloop.C and then I get confused. I tried putting some cout statement to see where Ill be in the software, but that wasnt very helpfull, and I tried messing with the code, for example commenting out the if statment in the above fragement and stuff like that, to see the effect. But no use. searched in ddd.C, tips.C, mainloop.C, beucase I have a feeling the answer may strongly be found in either one of them, but I might be mistaken. spent 2 hrs. ********************************************************************************** 4/23 ********************************************************************************** Messed around with gdb, trying to figure out something but it was like im walking blind, withouth knowing where to go. I tried the "awatch" to put a watch point but that didnt work, and I sent charliep an email with the error that I got. And I tried setting a break point, but that was no use. Search the code, keep looking around for something that might help me. But no use. spent 1.5 hours. *************************************************************************** 4/24 ************************************************************************** I tried the awatch command on the variable button_tips_w and few other variables, but i'm confused and i'm not very sure about whats going while i'm going from one line to another. Not much progress is being made, although alot of effort is defenately made. I think a one on one session would help acheive something, and Ill show you what im doing and how im doing, and we will see if what im doing is right or wrong or it is going to lead me to the answer for my problem. spent 2 hrs. *********************************************************************** weekend on 4/25-4/27 *********************************************************************** I asked Hassan to help me debug my problem. We spent number of hours messing with it. We managed to change the name of the bar that displays the tips_of_the_day, but we couldnt mess with the tip it self to make it display correct. I will talk to Charlie on Monday (4/28) to discuss what I will do next. spent around than 5 hrs (all weekend long) ************************************************************************* 4/29 and 4/30 ************************************************************************* I continued working with ddd. I do not think I will be able to fix the original bug, put I managed to edit and make corrections in the title of the tips themselves. The code was intense c language, and there are many ambigious parts involved. I think I will stop at this point with this bug, becuase I'm putting too much effort in, but I certainly did learn and achieve something out of this project. keep reading to know the number of hours spent. ------------------------------------------------------------------------- Bug # 2 ------------------------------------------------------------------------- In the same day, I started in another problem, which was the error that popps when you launch the software. I do not think it is still there. As we said in class, after getting somewhere in the first part, this part will be easier than the first time, and I defenately experianced that. I solved this will much less time, although I put enough time for it. spent less than 7 hours all together in the past two days. ************************************************************************ ************************************************************************ Reflection about open-source ************************************************************************ ************************************************************************ Since this was my first open source project that comes in my way, there are certainly number of things that I have learned, enjoyed, and also didn't like. It was a good experiance to mess around with a real code. Looking at something like this will give me an idea of how code might look like in the real world, and code that I may either generate or work with. As we all know, there are two sides for ever coin. Unfortunately, the bad side came my way first. As I struggled and made alot of effort trying to debig "gaim", and descovering that I am facing a dead end. So I changed the hole project, hoping ill will find a near exit to take. It wasn't very successful. I certainly did go something with the ddd software. Although I did not fully fix the original bug that I wanted to fix, but I think i was pretty much close to it. I managed to change the title of the same interface. The code was intense c language, and the hackers style wasn't very clear and easy to interpret. Even with the help that I got I couldn't reach where I wanted to reach, but I played and messed with other issues. For example, there use to be some errors that poppos out once you launch the software, and I do not think it still exists. It would have a better experiance if I found my way earlier and had a less harsh life with open source. I as a matter of fact put more than enough effort in this project and I think although I didn't fix the original bug that I intended to fix, but I acheived more experiance and other stuff. ************************************************************************ ************************************************************************