Mercurial > pidgin
annotate HACKING @ 961:9189916471f5
[gaim-migrate @ 971]
And the fun begins...
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Tue, 10 Oct 2000 03:36:11 +0000 |
parents | fa681641643d |
children | ae6d13c11570 |
rev | line source |
---|---|
639 | 1 A lot of people have tried to hack gaim, but haven't been able to because |
2 the code is just so horrid. Well, the code isn't getting better anytime | |
3 soon, so to help all you would-be hackers help out gaim, here's a brief | |
4 tutorial on how gaim works. I'll quickly describe the logical flow of | |
5 things, then what you'll find in each of the source files. Hopefully | |
6 that's enough to get most of you going. | |
7 | |
708
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
8 If you're going to hack gaim, PLEASE, PLEASE PLEASE PLEASE send patches |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
9 against the absolute latest CVS. I get really annoyed when I get patches |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
10 against the last released version, especially since I don't usually have |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
11 a copy of it on my computer, and gaim tends to change a lot between |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
12 versions. (I sometimes get annoyed when they're against CVS from 3 days |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
13 ago, but can't complain because it's usually my fault that I haven't |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
14 looked at the patch yet.) To get gaim from CVS (if you haven't already), |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
15 run the following commands: |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
16 |
774
b61607d6c2af
[gaim-migrate @ 784]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
749
diff
changeset
|
17 $ export CVSROOT=:pserver:anonymous@cvs.gaim.sourceforge.net:/cvsroot/gaim |
708
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
18 $ cvs login |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
19 (hit enter as the password) |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
20 $ cvs co gaim |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
21 (you'll see it getting all of the files) |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
22 $ cd gaim |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
23 $ ./gen |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
24 |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
25 You'll now have your normal gaim tree with ./configure and all. (If you |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
26 want to make your life really simple, learn how CVS works. CVS is your |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
27 friend.) |
3ff8b997cd37
[gaim-migrate @ 718]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
706
diff
changeset
|
28 |
639 | 29 There's one little thing that's just a pet peeve, and it's really stupid. |
706
a9758452f3c4
[gaim-migrate @ 716]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
684
diff
changeset
|
30 In ./configure there's an --enable-debug option. This does two things: |
639 | 31 compiles with -Wall, and prints debugging information to stdout. The |
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 | |
34 of the information that's printed is useless anyway though; so the | |
35 --enable-debug option really doesn't do a whole lot. | |
36 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
958
diff
changeset
|
37 This file was last modified by $Author: warmenhoven $ on $Date: 2000-10-09 20:02:02 -0400 (Mon, 09 Oct 2000) $. |
684
b29c92be568b
[gaim-migrate @ 694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
639
diff
changeset
|
38 |
639 | 39 |
40 PROGRAM FLOW | |
41 ============ | |
42 | |
960
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
958
diff
changeset
|
43 This has completely changed since multiple connections were added. Please |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
958
diff
changeset
|
44 be patient; as soon as the code starts to settle this will get rewritten. |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
958
diff
changeset
|
45 Most of the source files stayed the same though; only the one that got |
fa681641643d
[gaim-migrate @ 970]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
958
diff
changeset
|
46 added (multi.c) isn't covered below. |
639 | 47 |
48 | |
49 SOURCE FILES | |
50 ============ | |
51 | |
52 about.c: | |
53 Not much to say here, just a few basic functions. | |
54 | |
55 aim.c: | |
56 This is where the main() function is. It takes care of a lot of the | |
57 initialization stuff, and showing the login window. It's pretty tiny | |
58 and there's not really much to edit in it. Watch out for bad Oscar | |
59 sign in hacks. | |
60 | |
61 away.c: | |
62 This takes care of most of the away stuff: setting the away message | |
63 (do_im_away); coming back (do_im_back); drawing the away window; | |
64 etc. To be honest I haven't looked at this file in months. | |
65 | |
66 browser.c: | |
67 Code for opening a browser window. Most of the code is trying to deal | |
68 with Netscape. The most important function here is open_url. Have fun. | |
69 | |
70 buddy.c: | |
71 This takes care of not only nearly everything buddy-related (the buddy | |
72 list, the permit/deny lists, and the window), but also a lot of the | |
73 code flow and util functions. Look for good things like find_buddy, | |
74 set_buddy, and signoff() here. | |
75 | |
76 buddy_chat.c: | |
77 This takes care of the buddy chat stuff. This used to be a lot bigger | |
78 until the chat and IM windows got merged in the code. Now it mostly | |
79 just takes care of chat-specific stuff, like ignoring people and | |
80 keeping track of who's in the room. This is also where the chat window | |
81 is created. | |
82 | |
83 conversation.c: | |
84 This is where most of the functions dealing with the IM and chat windows | |
85 are hidden. It tries to abstract things as much as possible, but doesn't | |
86 do a very good job. This is also where things like "Enter sends" and | |
87 "Ctrl-{B/I/U/S}" options get carried out (look for send_callback). The | |
88 chat and IM toolbar (with the B/I/U/S buttons) are both built from the | |
89 same function, build_conv_toolbar. | |
90 | |
91 dialogs.c: | |
92 A massive file with a lot of little utility functions. This is where | |
93 all of those little dialog windows are created. Things like the warn | |
94 dialog and the add buddy dialog are here. Not all of the dialogs in | |
95 gaim are in this file, though. But most of them are. This is also | |
96 where do_import is housed, to import buddy lists. | |
97 | |
98 gaimrc.c: | |
99 This controls everything about the .gaimrc file. There's not really much | |
100 to say about it; this is probably one of the better designed and easier | |
101 to follow files in gaim. The important functions are towards the bottom. | |
102 | |
103 gnome_applet_mgr.c: | |
104 A hideous creation from the days before I started working on gaim. Most | |
105 of it works, but it has functionsLikeThis. I hate looking at this | |
106 file, but I'm too lazy to change the functions. The best functions | |
107 are things like set_applet_draw_open, whose sole purpose is to set a | |
749
94edd99b7302
[gaim-migrate @ 759]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
708
diff
changeset
|
108 global variable to TRUE. [ note 8/22/00 - I finally changed this file. ] |
639 | 109 |
110 gtkhtml.c: | |
111 This is really just one big hack. It started off as an HTML widget that | |
112 was written for Gnome as far as I can tell. The current version is | |
113 huge, requires way too many libs, and is too hard to upgrade to. But | |
114 we've managed to hack this poor old version into basically what we | |
115 need it for. I recommend not looking at this file if you want to save | |
116 your sanity. | |
117 | |
118 gtkticker.c: | |
119 Syd, our resident GTK God, wrote a GtkWidget, GtkTicker. This is that | |
120 widget. It's cool, and it's tiny. | |
121 | |
122 html.c: | |
123 Don't ask my why this is called html.c. Most of it is just grab_url, | |
124 which does like the name says; it downloads a URL to show in the | |
125 GtkHTML widget. http.c would be a more appropriate name, but that's OK. | |
126 | |
127 idle.c: | |
128 There is a very good reason why this file is still on version 1.1 | |
129 in CVS. The entire thing is #if 0'd out. I haven't ever really taken | |
130 a good look at it, but I think what it was supposed to have done is | |
131 set you as being away when a screensaver came on. | |
132 | |
133 network.c: | |
134 This has two functions: get_address and connect_address, both of which | |
135 call proxy functions. If you want to see how these are used, look at | |
136 toc.c and/or rvous.c. These are really just front-ends to the proxy | |
137 stuff; use these instead of calling the proxy functions. | |
138 | |
139 oscar.c: | |
140 One big hack of copied code. This is supposed to be the libfaim tie-in | |
141 in gaim. Most of it is just copied straight from faimtest, the small | |
142 program that comes with libfaim. I'm not even sure how half of it works, | |
143 if that makes you feel any better. | |
144 | |
145 perl.c: | |
146 This was basically copied straight from X-Chat through the power of | |
147 the GPL. Perl is the biggest, most confusing piece of C code I've ever | |
148 seen in my life (and keep in mind I'm a gaim hacker). I have a basic | |
149 idea of what's going on in it, but I couldn't tell you exactly. The | |
150 top half sets up perl and tells it what's going on and the bottom half | |
151 implements the AIM module. | |
152 | |
153 plugins.c: | |
154 This is the "plugin plug", as the file states. This file is probably | |
155 the only file in all of gaim that at the top has all of the functions | |
156 and global and static variables named out for you. It makes reading | |
157 it a little easier, but not by much. A lot of the code in here deals | |
158 with the plugin window rather than the plugins themselves. | |
159 | |
160 prefs.c: | |
161 The important function in here is build_prefs, but the most useful | |
162 function is gaim_button. build_prefs draws the window, and calls | |
163 gaim_button probably 30 or 40 times. (I don't really wanna run grep | |
164 | wc to count.) This is where you add the toggle button for gaim | |
165 preferences. It's very simple, and if you look at a couple of the | |
166 calls to gaim_button you'll figure it out right away. | |
167 | |
168 proxy.c: | |
169 This is where the bulk of the actual networking code is done. The big | |
170 function here is proxy_connect, which will connect through the proxy | |
171 setup you've chosen (most of which don't work...) or just regularly. | |
172 | |
173 rvous.c: | |
174 This was originally going to be the stuff for all of the Buddy Icon | |
175 and Voice Chat stuff, but I got really sick of protocol hacking really | |
176 quick. Now it only houses the file transfer stuff, which only works | |
177 for TOC. | |
178 | |
179 server.c: | |
180 This is where all of the differentiation between TOC and Oscar is | |
181 done. Nearly everything that's network related goes through here | |
182 at one point or another. This has good things like serv_send_im and | |
183 serv_got_update. Most of it should be pretty self-explanatory. | |
184 | |
185 sound.c: | |
186 The big important function is play_sound, which plays one of 4 (actually | |
187 6) sounds. One of the sounds is called in 3 different events, which | |
188 is why there are actually 6 sounds. This then calls play which then | |
189 checks for esd, then nas if that's not available, then falls back | |
190 to /dev/audio. | |
191 | |
192 ticker.c: | |
193 Syd is just so cool. I really can't get over it. He let me come | |
194 visit him at Netscape one day, and I got to see all of their toys | |
195 (don't worry, I'm under an NDA). Anyway, this file is for the buddy | |
196 ticker. This is also a damn cool file because it's got all of the | |
197 functions that you'd want right up at the top. Someday I want to be | |
198 as cool as Syd. | |
199 | |
200 toc.c: | |
201 This handles everything TOC-related, including parsing gaim's buddy | |
202 list. Most of this file is toc_callback, which parses the incoming | |
203 information from the server. I really don't like TOC though. | |
204 | |
205 util.c: | |
206 There's not really a lot of cohesion to this file; it's just a lot of | |
207 stuff that happened to be thrown into it for no apparent reason. None | |
208 of it is particularly tasty; it's all just utility functions. Just | |
209 like the name says. | |
210 | |
211 | |
212 So that's our little tour of the internals of Gaim. It's really not | |
213 difficult to figure out if you've spent any time with GTK. I'm looking | |
214 forward to getting all of your patches :) |