comparison HACKING @ 4491:3196d9044a45

[gaim-migrate @ 4766] aim_user is dead. long live gaim_account. committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 31 Jan 2003 13:03:47 +0000
parents 0e70fe072ab4
children c7986b4d182a
comparison
equal deleted inserted replaced
4490:70b892694e0b 4491:3196d9044a45
36 two trees, or even two copies of the same file). Then when you're ready to 36 two trees, or even two copies of the same file). Then when you're ready to
37 make your patch, simply run 'cvs diff -u >my.patch' and send it off; 37 make your patch, simply run 'cvs diff -u >my.patch' and send it off;
38 either post it on sf.net/projects/gaim in the patches section, or email it 38 either post it on sf.net/projects/gaim in the patches section, or email it
39 to gaim@marko.net. 39 to gaim@marko.net.
40 40
41 This file was last modified by $Author: warmenhoven $ on 41 This file was last modified by $Author: faceprint $ on
42 $Date: 2001-12-09 09:06:36 -0500 (Sun, 09 Dec 2001) $. Do not expect any information contained 42 $Date: 2003-01-31 08:03:47 -0500 (Fri, 31 Jan 2003) $. Do not expect any information contained
43 within to be current or correct. 43 within to be current or correct.
44 44
45 Here's something new. Someone requested that I comment the code. No. I'm a 45 Here's something new. Someone requested that I comment the code. No. I'm a
46 lazy bastard, and I understand most of the code, so I don't need the 46 lazy bastard, and I understand most of the code, so I don't need the
47 comments. I understand that some of you do though. So give me the names of 47 comments. I understand that some of you do though. So give me the names of
115 even between connections, and only one buddy_show per group_show per 115 even between connections, and only one buddy_show per group_show per
116 buddy name, even between connections. (If that's not confusing enough, 116 buddy name, even between connections. (If that's not confusing enough,
117 wait until I really start describing how the buddy list works.) 117 wait until I really start describing how the buddy list works.)
118 118
119 New connections happen the exact same way as described above. Each 119 New connections happen the exact same way as described above. Each
120 aim_user can have one gaim_connection associated with it. aim_user and 120 gaim_account can have one gaim_connection associated with it. gaim_account
121 gaim_connection both have a protocol field. This is kind of confusing: 121 and gaim_connection both have a protocol field. This is kind of confusing:
122 gaim, except for the account editor screen and when the user signs on, 122 gaim, except for the account editor screen and when the user signs on,
123 ignores the user's protocl field, and only uses the connection's protocol 123 ignores the user's protocl field, and only uses the connection's protocol
124 field. You can change the connection's protocol field once it's created 124 field. You can change the connection's protocol field once it's created
125 and been assigned a PRPL to use to change certain behavior (Oscar does 125 and been assigned a PRPL to use to change certain behavior (Oscar does
126 this because it handles both AIM and ICQ). I'll talk about the 126 this because it handles both AIM and ICQ). I'll talk about the
434 434
435 MULTIPLE CONNECTIONS AND PRPLS 435 MULTIPLE CONNECTIONS AND PRPLS
436 ============================== 436 ==============================
437 437
438 OK, let's start with the basics. There are users. Each user is contained 438 OK, let's start with the basics. There are users. Each user is contained
439 in an aim_user struct, and kept track of in the aim_users GList (GSList?). 439 in an gaim_account struct, and kept track of in the gaim_accounts GSList.
440 Each aim_user has certain features: a username, a password, and user_info. 440 Each gaim_account has certain features: a username, a password, and
441 It also has certain options, and the protocol it uses to sign on (kept 441 user_info. It also has certain options, and the protocol it uses to sign
442 as an int which is #define'd in prpl.h). 442 on (kept as an int which is #define'd in prpl.h).
443 443
444 Now then, there are protocols that gaim knows about. Each protocol is 444 Now then, there are protocols that gaim knows about. Each protocol is
445 in a prpl struct and kept track of in the protocols GSList. The way the 445 in a prpl struct and kept track of in the protocols GSList. The way the
446 management of the protocols is, there will only ever be one prpl per 446 management of the protocols is, there will only ever be one prpl per
447 numeric protocol. Each prpl defines a basic set of functions: login, 447 numeric protocol. Each prpl defines a basic set of functions: login,
457 457
458 Here's how struct gaim_connection fits into all of this. At some point 458 Here's how struct gaim_connection fits into all of this. At some point
459 the User (capitalized to indicate a person and not a name) will try to 459 the User (capitalized to indicate a person and not a name) will try to
460 sign on one of Their users. serv_login is then called for that user. It 460 sign on one of Their users. serv_login is then called for that user. It
461 searches for the prpl that is assigned to that user, and calls that prpl's 461 searches for the prpl that is assigned to that user, and calls that prpl's
462 login function, passing it the aim_user struct that is attempting to sign 462 login function, passing it the gaim_account struct that is attempting to
463 on. The prpl is then responsible for seeing that the gaim_connection 463 sign on. The prpl is then responsible for seeing that the gaim_connection
464 is created (by calling new_gaim_connection), and registering it as 464 is created (by calling new_gaim_connection), and registering it as
465 being online (by calling account_online and passing it the aim_user and 465 being online (by calling account_online and passing it the gaim_account and
466 gaim_connection structs). At that point, the aim_user and gaim_connection 466 gaim_connection structs). At that point, the gaim_account and gaim_connection
467 structs have pointers to each other, and the gaim_connection struct has 467 structs have pointers to each other, and the gaim_connection struct has
468 a pointer to the prpl struct that it is using. The gaim_connections are 468 a pointer to the prpl struct that it is using. The gaim_connections are
469 stored in the connections GSList. The way connection management works is, 469 stored in the connections GSList. The way connection management works is,
470 there will always only be one gaim_connection per user, and the prpl that 470 there will always only be one gaim_connection per user, and the prpl that
471 the gaim_connection uses will be constant for the gaim_connection's life. 471 the gaim_connection uses will be constant for the gaim_connection's life.