comparison HACKING @ 1038:daad2440a642

[gaim-migrate @ 1048] i have homework i need to be doing. it's due in less than 7 hours, and i haven't started and i need to sleep. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 31 Oct 2000 10:49:53 +0000
parents 82c5865f7cfe
children e1408fb04c36
comparison
equal deleted inserted replaced
1037:1c663beef29d 1038:daad2440a642
32 debugging information is printed to the debug window (which can be turned 32 debugging information is printed to the debug window (which can be turned
33 on in the preferences) whether or not --enable-debug was selected. Most 33 on in the preferences) whether or not --enable-debug was selected. Most
34 of the information that's printed is useless anyway though; so the 34 of the information that's printed is useless anyway though; so the
35 --enable-debug option really doesn't do a whole lot. 35 --enable-debug option really doesn't do a whole lot.
36 36
37 This file was last modified by $Author: warmenhoven $ on $Date: 2000-10-12 14:59:36 -0400 (Thu, 12 Oct 2000) $. 37 This file was last modified by $Author: warmenhoven $ on $Date: 2000-10-31 05:49:53 -0500 (Tue, 31 Oct 2000) $.
38 38
39 39
40 PROGRAM FLOW 40 PROGRAM FLOW
41 ============ 41 ============
42 42
43 Before gaim does anything you can see, it initializes itself, which is 43 Before gaim does anything you can see, it initializes itself, which is
44 mostly just reading .gaimrc (handled by the functions in gaimrc.c). It 44 mostly just reading .gaimrc (handled by the functions in gaimrc.c) and
45 then draws the login window by calling show_login, and waits for input. 45 parsing command-line options. It then draws the login window by calling
46 show_login, and waits for input.
46 47
47 At the login window, when "Accounts" is clicked, account_editor() is 48 At the login window, when "Accounts" is clicked, account_editor() is
48 called. (NOTE: the login window will probably be changed soon.) This 49 called. This then displays all of the users and various information about
49 then displays all of the users and various information about them. 50 them. If the user clicks the "Signon" button instead, serv_login is called.
50 51
51 When the "Sign on/off" button is clicked, serv_login is passed the 52 When the "Sign on/off" button is clicked, serv_login is passed the
52 username and the password for the account. If the password length is 53 username and the password for the account. If the password length is
53 zero (the password field is a character array rather than pointer so 54 zero (the password field is a character array rather than pointer so
54 it will not be NULL) then the Signon callback will prompt for the 55 it will not be NULL) then the Signon callback will prompt for the
59 60
60 After you're signed in (I'll skip that discussion - I doubt many people 61 After you're signed in (I'll skip that discussion - I doubt many people
61 are going to change the login process, since it pretty much just follows 62 are going to change the login process, since it pretty much just follows
62 PROTOCOL), Gaim draws the buddy list by calling show_buddy_list, and 63 PROTOCOL), Gaim draws the buddy list by calling show_buddy_list, and
63 waits for input from two places: the server and the user. The first place 64 waits for input from two places: the server and the user. The first place
64 it gets input from after signon is invariably the server, when the server 65 it gets input from after signon is usually the server, when the server
65 tells Gaim which buddies are signed on. 66 tells Gaim which buddies are signed on.
66 67
67 When there is information ready to be read from the server, toc_callback 68 When there is information ready to be read from the server, toc_callback
68 is called (by GDK) to parse the incoming information. On an UPDATE, 69 is called (by GDK) to parse the incoming information. On an UPDATE,
69 serv_got_update is called, which takes care of things like notifying 70 serv_got_update is called, which takes care of things like notifying
70 conversation windows of the update if need be; notifying the plugins; 71 conversation windows of the update if need be; notifying the plugins;
71 and finally, calling set_buddy. 72 and finally, calling set_buddy.
72
73 set_buddy is one of the most frequently called functions in gaim, one of
74 the largest functions in gaim, and probably one of the buggiest functions
75 in gaim. It is responsible for updating the pixmaps in the buddy list;
76 notifying plugins of various events; updating the tooltips for buddies;
77 making sounds; and updating the ticker. It's also called once per online
78 buddy every 20 seconds per connection (by GTK through update_all_buddies).
79 73
80 New connections happen the exact same way as described above. Each aim_user 74 New connections happen the exact same way as described above. Each aim_user
81 can have one gaim_connection associated with it. aim_user and gaim_connection 75 can have one gaim_connection associated with it. aim_user and gaim_connection
82 both have a protocol field; gaim_connection's should be constant once it is 76 both have a protocol field; gaim_connection's should be constant once it is
83 set in the appropriate (protocol)_login function. There are lots of details 77 set in the appropriate (protocol)_login function. There are lots of details
86 80
87 When the user opens a new conversation window, new_conversation is called. 81 When the user opens a new conversation window, new_conversation is called.
88 That's easy enough. If there isn't a conversation with the person already 82 That's easy enough. If there isn't a conversation with the person already
89 open (checked by calling find_conversation), show_conv is called to 83 open (checked by calling find_conversation), show_conv is called to
90 create the new window. All sorts of neat things happen there, but it's 84 create the new window. All sorts of neat things happen there, but it's
91 mostly drawing the window. show_conv is the best place to edit the UI. Be 85 mostly drawing the window. show_conv is the best place to edit the UI.
92 prepared for some incredibly bad GTK programming. (Rob's fixing this as
93 we speak no doubt.)
94 86
95 That's pretty much it for the quick tutorial. I know it wasn't much but 87 That's pretty much it for the quick tutorial. I know it wasn't much but
96 it's enough to get you started. Make sure you know GTK before you get too 88 it's enough to get you started. Make sure you know GTK before you get too
97 involved. Most of the back-end stuff is pretty basic; most of gaim is GTK. 89 involved. Most of the back-end stuff is pretty basic; most of gaim is GTK.
98 90
174 Don't ask my why this is called html.c. Most of it is just grab_url, 166 Don't ask my why this is called html.c. Most of it is just grab_url,
175 which does like the name says; it downloads a URL to show in the 167 which does like the name says; it downloads a URL to show in the
176 GtkHTML widget. http.c would be a more appropriate name, but that's OK. 168 GtkHTML widget. http.c would be a more appropriate name, but that's OK.
177 169
178 idle.c: 170 idle.c:
179 There is a very good reason why this file is still on version 1.1 171 This file used to be entirely #if 0'd out of existance. However, thanks
180 in CVS. The entire thing is #if 0'd out. I haven't ever really taken 172 to some very generous people who submitted patches, this takes care of
181 a good look at it, but I think what it was supposed to have done is 173 reporting idle time (imagine that). It's a pretty straight-forward file.
182 set you as being away when a screensaver came on.
183 174
184 multi.c: 175 multi.c:
185 This is the file that tries to take care of most of the major issues 176 This is the file that tries to take care of most of the major issues
186 with multiple connections. The best function in here by far is the 177 with multiple connections. The best function in here by far is the
187 account_editor(). auto_login() is also in here (I'm just reading 178 account_editor(). auto_login() is also in here (I'm just reading
188 multi.h now...); auto_login has problems. Someone please fix it. 179 multi.h now...); auto_login has problems. Someone please fix it.
189 account_editor is really the only function that the UI needs to be 180 account_editor is really the only function that the UI needs to be
190 concerned with. If you want to remove multiconnectivity from gaim, 181 concerned with. If you want to remove multiconnectivity from gaim,
191 all you would really need to do is comment out any lines that make 182 all you would really need to do is comment out any lines that make
192 reference to this function (there are only two - one in aim.c and one 183 reference to this function (there are only two - one in aim.c and one
193 in buddy.c). The login window UI would have to be changed but it would 184 in buddy.c). Or you could just run ./configure --disable-multi.
194 be simple to take an old version of gaim and copy code (it won't drop-in
195 because there were other changes, but it should be simple to hand-edit).
196 185
197 network.c: 186 network.c:
198 This has two functions: get_address and connect_address, both of which 187 This has two functions: get_address and connect_address, both of which
199 call proxy functions. If you want to see how these are used, look at 188 call proxy functions. If you want to see how these are used, look at
200 toc.c and/or rvous.c. These are really just front-ends to the proxy 189 toc.c and/or rvous.c. These are really just front-ends to the proxy
227 gaim_button probably 30 or 40 times. (I don't really wanna run grep 216 gaim_button probably 30 or 40 times. (I don't really wanna run grep
228 | wc to count.) This is where you add the toggle button for gaim 217 | wc to count.) This is where you add the toggle button for gaim
229 preferences. It's very simple, and if you look at a couple of the 218 preferences. It's very simple, and if you look at a couple of the
230 calls to gaim_button you'll figure it out right away. 219 calls to gaim_button you'll figure it out right away.
231 220
221 prpl.c:
222 This file is what lets gaim dynamically load protocols, sort of. All of
223 the actual dlopen(), dlsym() stuff is in plugins.c. But this contains
224 all of the functions that the protocol plugin needs to call, and manages
225 all of the protocols. It's a pretty simple file actually.
226
232 proxy.c: 227 proxy.c:
233 This is where the bulk of the actual networking code is done. The big 228 This is where the bulk of the actual networking code is done. The big
234 function here is proxy_connect, which will connect through the proxy 229 function here is proxy_connect, which will connect through the proxy
235 setup you've chosen (most of which don't work...) or just regularly. 230 setup you've chosen (most of which don't work...) or just regularly.
236 231
245 done. Nearly everything that's network related goes through here 240 done. Nearly everything that's network related goes through here
246 at one point or another. This has good things like serv_send_im and 241 at one point or another. This has good things like serv_send_im and
247 serv_got_update. Most of it should be pretty self-explanatory. 242 serv_got_update. Most of it should be pretty self-explanatory.
248 243
249 sound.c: 244 sound.c:
250 The big important function is play_sound, which plays one of 4 (actually 245 The main function in this file is play_sound, which plays one of 8
251 6) sounds. One of the sounds is called in 3 different events, which 246 (maybe 9?) sounds based on preferences. All that the rest of the
252 is why there are actually 6 sounds. This then calls play which then 247 code should have to do is call play_sound(BUDDY_ARRIVE), for example,
253 checks for esd, then nas if that's not available, then falls back 248 and this file will take care of determining if a sound should be played
254 to /dev/audio. 249 and which file should be played.
255 250
256 ticker.c: 251 ticker.c:
257 Syd is just so cool. I really can't get over it. He let me come 252 Syd is just so cool. I really can't get over it. He let me come
258 visit him at Netscape one day, and I got to see all of their toys 253 visit him at Netscape one day, and I got to see all of their toys
259 (don't worry, I'm under an NDA). Anyway, this file is for the buddy 254 (don't worry, I'm under an NDA). Anyway, this file is for the buddy