comparison src/protocols/oscar/aim_internal.h @ 3952:07283934dedd

[gaim-migrate @ 4133] Ok, big commit with little functionality change. Most of it is me shuffling crap around because I'm one of them neat freaks. Lots of general code cleanup too. I'm trying to move to that whole "one-family-per-file" thing. The details... I added libfaim support for aim's new search family, 0x000f. I only tested this briefly, so if anyone uses it for anything, be aware that it could be buggy. I'll add oscar support sometime. Advantages of this family are... when you search for someone, you get the directory info for that person. So like, first name, middle name, last name, maiden name, city, state, country, zip, address, interests, nickname, and maybe some other stuff. Basically all the info that they've set in their directory info thing. Info. Oh, and I'm calling it "new search" because seach was already taken, and cookie monster ate my right brain. The reason I didn't add support to oscar.c... the new search family requires making a connection to another server. While moving stuff around I realized that I didn't really like how new connections are made. It's kind of sloppy. I'm thinking it would be nice to have an outgoing queue for each type of connection, and then let the client queue messages as much as they want. Then, if libfaim sees that there is a message for a certain type of connection, and there is no open connection of that type, it will connect, and then flush the queue when the connection is made. This seems a lot cleaner, but it also seems like a pain in the ass. I should do ssi for icq first, anyway :-) Also, I think it would be neat if there was an ICBM file that handled channels 1 through 4. Then im.c and chat.c could pass the ICBM part to the icbm stuff and it could get parsed there. im.c is really huge right now. I applied a patch from Graham Booker that paves the way for unicode in direct IMs. Thanks Graham. Now we just need Paco-Paco to git a little free time and write a patch for this. http://sourceforge.net/tracker/index.php?func=detail&aid=633589&group_id=235&atid=300235 I applied 2 patches from Will Mahan dealing with file transfer/oft/rendezous/whatever. Here's some info on them, from The Man himself: Patch 1 "Currently the Rendezvous code is rather messy; this patch attempts to bring it up to speed with the rest of the Oscar prpl. Its changes include: * Rewrite several ft.c functions to use bstreams. Apparently the code in question was written before bstreams were implemented. * Handle incoming Rendezvous packets through the rxqueue like FLAP packets, rather than handling them as a special case as soon as they are received. This takes advantage of the bstream cleanup to unify some code and simplify the aim_frame_t struct. * Change some names used to try to clarify the distinction between OFT, which refers specifically to file transfer, and Rendezvous, which encompasses OFT as well as other types of client-to-client connections." Patch 2 "* Add some comments I inadvertently left out of my last patch. * Fix a double-free that occurs when connections time out. * Correct a bug causing filenames to be truncated by 4 characters on some clients. * Preserve directory structure when sending multiple files. * Handle (throw away) resource forks sent by Mac clients." I also changed all indents to tabs in ft.c. And split all the bstream stuff from rxqueue.c and put it in bstream.c. It really is a separate thing. Especially since it can be used for outgoing connections. Also, I was going to look over the whole patch tonight to make sure it's all good, but it's like 6000 lines, so, uh, I'll do it later. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 13 Nov 2002 07:01:37 +0000
parents b32474e522fa
children 2532f1192da3
comparison
equal deleted inserted replaced
3951:32942c49dced 3952:07283934dedd
53 faim_internal int translate_modfirst(aim_session_t *sess, aim_module_t *mod); 53 faim_internal int translate_modfirst(aim_session_t *sess, aim_module_t *mod);
54 faim_internal int popups_modfirst(aim_session_t *sess, aim_module_t *mod); 54 faim_internal int popups_modfirst(aim_session_t *sess, aim_module_t *mod);
55 faim_internal int adverts_modfirst(aim_session_t *sess, aim_module_t *mod); 55 faim_internal int adverts_modfirst(aim_session_t *sess, aim_module_t *mod);
56 faim_internal int icq_modfirst(aim_session_t *sess, aim_module_t *mod); 56 faim_internal int icq_modfirst(aim_session_t *sess, aim_module_t *mod);
57 faim_internal int email_modfirst(aim_session_t *sess, aim_module_t *mod); 57 faim_internal int email_modfirst(aim_session_t *sess, aim_module_t *mod);
58 faim_internal int newsearch_modfirst(aim_session_t *sess, aim_module_t *mod);
58 59
59 faim_internal int aim_genericreq_n(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t subtype); 60 faim_internal int aim_genericreq_n(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t subtype);
60 faim_internal int aim_genericreq_n_snacid(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t subtype); 61 faim_internal int aim_genericreq_n_snacid(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t subtype);
61 faim_internal int aim_genericreq_l(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t subtype, fu32_t *); 62 faim_internal int aim_genericreq_l(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t subtype, fu32_t *);
62 faim_internal int aim_genericreq_s(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t subtype, fu16_t *); 63 faim_internal int aim_genericreq_s(aim_session_t *, aim_conn_t *conn, fu16_t family, fu16_t subtype, fu16_t *);
63 64
64 #define AIMBS_CURPOSPAIR(x) ((x)->data + (x)->offset), ((x)->len - (x)->offset) 65 #define AIMBS_CURPOSPAIR(x) ((x)->data + (x)->offset), ((x)->len - (x)->offset)
65 66
66 faim_internal void aim_rxqueue_cleanbyconn(aim_session_t *sess, aim_conn_t *conn); 67 /* bstream.c */
67 faim_internal int aim_recv(int fd, void *buf, size_t count);
68 faim_internal int aim_bstream_recv(aim_bstream_t *bs, int fd, size_t count);
69 faim_internal int aim_bstream_init(aim_bstream_t *bs, fu8_t *data, int len); 68 faim_internal int aim_bstream_init(aim_bstream_t *bs, fu8_t *data, int len);
70 faim_internal int aim_bstream_empty(aim_bstream_t *bs); 69 faim_internal int aim_bstream_empty(aim_bstream_t *bs);
71 faim_internal int aim_bstream_curpos(aim_bstream_t *bs); 70 faim_internal int aim_bstream_curpos(aim_bstream_t *bs);
72 faim_internal int aim_bstream_setpos(aim_bstream_t *bs, int off); 71 faim_internal int aim_bstream_setpos(aim_bstream_t *bs, int off);
73 faim_internal void aim_bstream_rewind(aim_bstream_t *bs); 72 faim_internal void aim_bstream_rewind(aim_bstream_t *bs);
88 faim_internal fu8_t *aimbs_getraw(aim_bstream_t *bs, int len); 87 faim_internal fu8_t *aimbs_getraw(aim_bstream_t *bs, int len);
89 faim_internal char *aimbs_getstr(aim_bstream_t *bs, int len); 88 faim_internal char *aimbs_getstr(aim_bstream_t *bs, int len);
90 faim_internal int aimbs_putraw(aim_bstream_t *bs, const fu8_t *v, int len); 89 faim_internal int aimbs_putraw(aim_bstream_t *bs, const fu8_t *v, int len);
91 faim_internal int aimbs_putbs(aim_bstream_t *bs, aim_bstream_t *srcbs, int len); 90 faim_internal int aimbs_putbs(aim_bstream_t *bs, aim_bstream_t *srcbs, int len);
92 91
93 faim_internal int aim_get_command_rendezvous(aim_session_t *sess, aim_conn_t *conn); 92 /* conn.c */
94 93 faim_internal aim_conn_t *aim_cloneconn(aim_session_t *sess, aim_conn_t *src);
95 faim_internal int aim_tx_sendframe(aim_session_t *sess, aim_frame_t *cur); 94
96 faim_internal flap_seqnum_t aim_get_next_txseqnum(aim_conn_t *); 95 /* ft.c */
97 faim_internal aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, fu8_t framing, fu16_t chan, int datalen); 96 faim_internal int aim_rxdispatch_rendezvous(aim_session_t *sess, aim_frame_t *fr);
98 faim_internal void aim_frame_destroy(aim_frame_t *); 97
99 faim_internal int aim_tx_enqueue(aim_session_t *, aim_frame_t *); 98 /* rxhandlers.c */
100 faim_internal int aim_tx_printqueue(aim_session_t *);
101 faim_internal void aim_tx_cleanqueue(aim_session_t *, aim_conn_t *);
102
103 faim_internal aim_rxcallback_t aim_callhandler(aim_session_t *sess, aim_conn_t *conn, u_short family, u_short type); 99 faim_internal aim_rxcallback_t aim_callhandler(aim_session_t *sess, aim_conn_t *conn, u_short family, u_short type);
104 faim_internal int aim_callhandler_noparam(aim_session_t *sess, aim_conn_t *conn, fu16_t family, fu16_t type, aim_frame_t *ptr); 100 faim_internal int aim_callhandler_noparam(aim_session_t *sess, aim_conn_t *conn, fu16_t family, fu16_t type, aim_frame_t *ptr);
101 faim_internal int aim_parse_unknown(aim_session_t *, aim_frame_t *, ...);
102 faim_internal void aim_clonehandlers(aim_session_t *sess, aim_conn_t *dest, aim_conn_t *src);
103
104 /* rxqueue.c */
105 faim_internal int aim_recv(int fd, void *buf, size_t count);
106 faim_internal int aim_bstream_recv(aim_bstream_t *bs, int fd, size_t count);
107 faim_internal void aim_rxqueue_cleanbyconn(aim_session_t *sess, aim_conn_t *conn);
108 faim_internal void aim_frame_destroy(aim_frame_t *);
109
110 /* txqueue.c */
111 faim_internal aim_frame_t *aim_tx_new(aim_session_t *sess, aim_conn_t *conn, fu8_t framing, fu16_t chan, int datalen);
112 faim_internal int aim_tx_enqueue(aim_session_t *, aim_frame_t *);
113 faim_internal flap_seqnum_t aim_get_next_txseqnum(aim_conn_t *);
114 faim_internal int aim_tx_sendframe(aim_session_t *sess, aim_frame_t *cur);
115 faim_internal void aim_tx_cleanqueue(aim_session_t *, aim_conn_t *);
116
117 /* XXX - What is this? faim_internal int aim_tx_printqueue(aim_session_t *); */
105 118
106 /* 119 /*
107 * Generic SNAC structure. Rarely if ever used. 120 * Generic SNAC structure. Rarely if ever used.
108 */ 121 */
109 typedef struct aim_snac_s { 122 typedef struct aim_snac_s {
119 struct aim_snac_destructor { 132 struct aim_snac_destructor {
120 aim_conn_t *conn; 133 aim_conn_t *conn;
121 void *data; 134 void *data;
122 }; 135 };
123 136
137 /* snac.c */
124 faim_internal void aim_initsnachash(aim_session_t *sess); 138 faim_internal void aim_initsnachash(aim_session_t *sess);
125 faim_internal aim_snacid_t aim_newsnac(aim_session_t *, aim_snac_t *newsnac); 139 faim_internal aim_snacid_t aim_newsnac(aim_session_t *, aim_snac_t *newsnac);
126 faim_internal aim_snacid_t aim_cachesnac(aim_session_t *sess, const fu16_t family, const fu16_t type, const fu16_t flags, const void *data, const int datalen); 140 faim_internal aim_snacid_t aim_cachesnac(aim_session_t *sess, const fu16_t family, const fu16_t type, const fu16_t flags, const void *data, const int datalen);
127 faim_internal aim_snac_t *aim_remsnac(aim_session_t *, aim_snacid_t id); 141 faim_internal aim_snac_t *aim_remsnac(aim_session_t *, aim_snacid_t id);
128 faim_internal void aim_cleansnacs(aim_session_t *, int maxage); 142 faim_internal void aim_cleansnacs(aim_session_t *, int maxage);
129 faim_internal int aim_putsnac(aim_bstream_t *, fu16_t family, fu16_t type, fu16_t flags, aim_snacid_t id); 143 faim_internal int aim_putsnac(aim_bstream_t *, fu16_t family, fu16_t type, fu16_t flags, aim_snacid_t id);
130
131 faim_internal aim_conn_t *aim_cloneconn(aim_session_t *sess, aim_conn_t *src);
132 faim_internal void aim_clonehandlers(aim_session_t *sess, aim_conn_t *dest, aim_conn_t *src);
133
134 faim_internal int aim_oft_buildheader(unsigned char *,struct aim_fileheader_t *);
135
136 faim_internal int aim_parse_unknown(aim_session_t *, aim_frame_t *, ...);
137 144
138 /* Stored in ->priv of the service request SNAC for chats. */ 145 /* Stored in ->priv of the service request SNAC for chats. */
139 struct chatsnacinfo { 146 struct chatsnacinfo {
140 fu16_t exchange; 147 fu16_t exchange;
141 char name[128]; 148 char name[128];