comparison libfaim/aim_login.c @ 446:6d78b988b479

[gaim-migrate @ 456] Can log into Oscar again. Thank god. I hate toc. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Fri, 30 Jun 2000 02:35:56 +0000
parents e4c34ca88d9b
children 58106806ac2b
comparison
equal deleted inserted replaced
445:e4c34ca88d9b 446:6d78b988b479
96 */ 96 */
97 if ((sn[0] >= '0') && (sn[0] <= '9')) { 97 if ((sn[0] >= '0') && (sn[0] <= '9')) {
98 icqmode = 1; /* needs a different password encoding */ 98 icqmode = 1; /* needs a different password encoding */
99 if (clientinfo && (clientinfo->major < 4)) { 99 if (clientinfo && (clientinfo->major < 4)) {
100 printf("faim: icq: version must be at least 4.30.3141 for ICQ OSCAR login\n"); 100 printf("faim: icq: version must be at least 4.30.3141 for ICQ OSCAR login\n");
101 return -1;
102 } 101 }
103 if (strlen(password) > 8) { 102 if (strlen(password) > 8) {
104 printf("faim: icq: password too long (8 char max)\n"); 103 printf("faim: icq: password too long (8 char max)\n");
105 return -1;
106 } 104 }
107 } 105 }
108 106
109 #ifdef SNACLOGIN 107 #ifdef SNACLOGIN
110 newpacket->commandlen = 10; 108 newpacket->commandlen = 10;
133 curbyte+= aim_puttlv_str(newpacket->data+curbyte, 0x0001, 0x0002, clientinfo->lang); 131 curbyte+= aim_puttlv_str(newpacket->data+curbyte, 0x0001, 0x0002, clientinfo->lang);
134 curbyte+= aim_puttlv_32(newpacket->data+curbyte, 0x0014, 0x0000002a); 132 curbyte+= aim_puttlv_32(newpacket->data+curbyte, 0x0014, 0x0000002a);
135 curbyte+= aim_puttlv_16(newpacket->data+curbyte, 0x0009, 0x0015); 133 curbyte+= aim_puttlv_16(newpacket->data+curbyte, 0x0009, 0x0015);
136 #else 134 #else
137 135
138 newpacket->commandlen = 4 + 4 + strlen(sn) + 4+strlen(password) + 6;
139
140 newpacket->commandlen += 8; /* tlv 0x0014 */
141
142 if (clientinfo) {
143 if (strlen(clientinfo->clientstring))
144 newpacket->commandlen += 4+strlen(clientinfo->clientstring);
145 newpacket->commandlen += 6+6+6+6;
146 if (strlen(clientinfo->country))
147 newpacket->commandlen += 4+strlen(clientinfo->country);
148 if (strlen(clientinfo->lang))
149 newpacket->commandlen += 4+strlen(clientinfo->lang);
150 }
151
152 newpacket->lock = 1; 136 newpacket->lock = 1;
153 newpacket->hdr.oscar.type = 0x01; 137 newpacket->hdr.oscar.type = 0x01;
154 138
139 /*
140 * These four bytes are actually the FLAP version information.
141 * They're sent here for convenience. I suppose they could
142 * be seperated out into a seperate FLAP, but this is where
143 * everyone else sends them.
144 */
155 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000); 145 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0000);
156 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); 146 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001);
157 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0001); 147
158 curbyte += aimutil_put16(newpacket->data+curbyte, strlen(sn)); 148 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0001, strlen(sn), sn);
159 curbyte += aimutil_putstr(newpacket->data+curbyte, sn, strlen(sn)); 149
160
161 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0002);
162 curbyte += aimutil_put16(newpacket->data+curbyte, strlen(password));
163 password_encoded = (char *) malloc(strlen(password)); 150 password_encoded = (char *) malloc(strlen(password));
164 aim_encode_password(password, password_encoded); 151 aim_encode_password(password, password_encoded);
165 curbyte += aimutil_putstr(newpacket->data+curbyte, password_encoded, strlen(password)); 152 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0002, strlen(password), password_encoded);
166 free(password_encoded); 153 free(password_encoded);
167 154
168 if (strlen(clientinfo->clientstring)) { 155 /* XXX is clientstring required by oscar? */
169 curbyte += aimutil_put16(newpacket->data+curbyte, 0x0003); 156 if (strlen(clientinfo->clientstring))
170 curbyte += aimutil_put16(newpacket->data+curbyte, strlen(clientinfo->clientstring)); 157 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x0003, strlen(clientinfo->clientstring), clientinfo->clientstring);
171 curbyte += aimutil_putstr(newpacket->data+curbyte, clientinfo->clientstring, strlen(clientinfo->clientstring)); 158
172 } 159 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0016, clientinfo->major2);
173 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0016, /*0x010a*/ 0x0004); 160 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0017, clientinfo->major);
174 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0017, clientinfo->major /*0x0001*/); 161 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0018, clientinfo->minor);
175 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0018, clientinfo->minor /*0x0001*/); 162 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0019, clientinfo->minor2);
176 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x0019, 0x0001); 163 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x001a, clientinfo->build);
177 curbyte += aim_puttlv_16(newpacket->data+curbyte, 0x001a, clientinfo->build /*0x0013*/); 164
178 165 curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, clientinfo->unknown);
179 curbyte += aim_puttlv_32(newpacket->data+curbyte, 0x0014, 0x00000055); 166
180 167 if (strlen(clientinfo->country))
181 if (strlen(clientinfo->country)) { 168 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000e, strlen(clientinfo->country), clientinfo->country);
182 curbyte += aimutil_put16(newpacket->data+curbyte, 0x000e); 169 else
183 curbyte += aimutil_put16(newpacket->data+curbyte, strlen(clientinfo->country)); 170 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000e, 2, "us");
184 curbyte += aimutil_putstr(newpacket->data+curbyte, clientinfo->country, strlen(clientinfo->country)); 171
185 } 172 if (strlen(clientinfo->lang))
186 if (strlen(clientinfo->lang)) { 173 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000f, strlen(clientinfo->lang), clientinfo->lang);
187 curbyte += aimutil_put16(newpacket->data+curbyte, 0x000f); 174 else
188 curbyte += aimutil_put16(newpacket->data+curbyte, strlen(clientinfo->lang)); 175 curbyte += aim_puttlv_str(newpacket->data+curbyte, 0x000f, 2, "en");
189 curbyte += aimutil_putstr(newpacket->data+curbyte, clientinfo->lang, strlen(clientinfo->lang)); 176
190 } 177 newpacket->commandlen = curbyte;
191
192 #endif 178 #endif
193 179
194 newpacket->lock = 0; 180 newpacket->lock = 0;
195 return aim_tx_enqueue(sess, newpacket); 181 return aim_tx_enqueue(sess, newpacket);
196 } 182 }
438 if (!(tx = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 1152))) 424 if (!(tx = aim_tx_new(AIM_FRAMETYPE_OSCAR, 0x0002, conn, 1152)))
439 return -1; 425 return -1;
440 426
441 tx->lock = 1; 427 tx->lock = 1;
442 428
443 i += aimutil_put16(tx->data+i, 0x0001); 429 i += aim_putsnac(tx->data+i, 0x0001, 0x0005, 0x0000, 0x00000000);
444 i += aimutil_put16(tx->data+i, 0x0005);
445 i += aimutil_put16(tx->data+i, 0x0000);
446 i += aimutil_put16(tx->data+i, 0x0000);
447 i += aimutil_put16(tx->data+i, 0x0000);
448 430
449 aim_addtlvtochain16(&tlvlist, 0x000d, servid); 431 aim_addtlvtochain16(&tlvlist, 0x000d, servid);
450 aim_addtlvtochain_str(&tlvlist, 0x0005, ip, strlen(ip)); 432 aim_addtlvtochain_str(&tlvlist, 0x0005, ip, strlen(ip));
451 aim_addtlvtochain_str(&tlvlist, 0x0006, cookie, AIM_COOKIELEN); 433 aim_addtlvtochain_str(&tlvlist, 0x0006, cookie, AIM_COOKIELEN);
452 434