comparison libfaim/aim_info.c @ 1302:4c5c2fcb83cd

[gaim-migrate @ 1312] libfaim stuff committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 19 Dec 2000 03:08:06 +0000
parents 920c86b753d7
children aedeb1218a0a
comparison
equal deleted inserted replaced
1301:e973ef7a8a87 1302:4c5c2fcb83cd
92 } 92 }
93 93
94 /* 94 /*
95 * Capability blocks. 95 * Capability blocks.
96 */ 96 */
97 u_char aim_caps[6][16] = { 97 u_char aim_caps[8][16] = {
98 98
99 /* Buddy icon */ 99 /* Buddy icon */
100 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1, 100 {0x09, 0x46, 0x13, 0x46, 0x4c, 0x7f, 0x11, 0xd1,
101 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}, 101 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
102 102
116 {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1, 116 {0x09, 0x46, 0x13, 0x48, 0x4c, 0x7f, 0x11, 0xd1,
117 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00}, 117 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
118 118
119 /* Send file */ 119 /* Send file */
120 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1, 120 {0x09, 0x46, 0x13, 0x43, 0x4c, 0x7f, 0x11, 0xd1,
121 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00} 121 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
122
123 /* Saves stock portfolios */
124 {0x09, 0x46, 0x13, 0x47, 0x4c, 0x7f, 0x11, 0xd1,
125 0x82, 0x22, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
126
127 /* Games */
128 {0x09, 0x46, 0x13, 0x4a, 0x4c, 0x7f, 0x11, 0xd1,
129 0x22, 0x82, 0x44, 0x45, 0x53, 0x54, 0x00, 0x00},
122 }; 130 };
123 131
124 faim_internal unsigned short aim_getcap(unsigned char *capblock, int buflen) 132 faim_internal unsigned short aim_getcap(unsigned char *capblock, int buflen)
125 { 133 {
126 u_short ret = 0; 134 u_short ret = 0;
127 int y; 135 int y;
128 int offset = 0; 136 int offset = 0;
137 int identified;
129 138
130 while (offset < buflen) { 139 while (offset < buflen) {
140 identified = 0;
131 for(y=0; y < (sizeof(aim_caps)/0x10); y++) { 141 for(y=0; y < (sizeof(aim_caps)/0x10); y++) {
132 if (memcmp(&aim_caps[y], capblock+offset, 0x10) == 0) { 142 if (memcmp(&aim_caps[y], capblock+offset, 0x10) == 0) {
133 switch(y) { 143 switch(y) {
134 case 0: ret |= AIM_CAPS_BUDDYICON; break; 144 case 0: ret |= AIM_CAPS_BUDDYICON; identified++; break;
135 case 1: ret |= AIM_CAPS_VOICE; break; 145 case 1: ret |= AIM_CAPS_VOICE; identified++; break;
136 case 2: ret |= AIM_CAPS_IMIMAGE; break; 146 case 2: ret |= AIM_CAPS_IMIMAGE; identified++; break;
137 case 3: ret |= AIM_CAPS_CHAT; break; 147 case 3: ret |= AIM_CAPS_CHAT; identified++; break;
138 case 4: ret |= AIM_CAPS_GETFILE; break; 148 case 4: ret |= AIM_CAPS_GETFILE; identified++; break;
139 case 5: ret |= AIM_CAPS_SENDFILE; break; 149 case 5: ret |= AIM_CAPS_SENDFILE; identified++; break;
140 default: ret |= 0xff00; break; 150 case 6: ret |= AIM_CAPS_GAMES; identified++; break;
151 case 7: ret |= AIM_CAPS_SAVESTOCKS; identified++; break;
141 } 152 }
142 } 153 }
143 } 154 }
155 if (!identified) {
156 printf("faim: unknown capability!\n");
157 ret |= 0xff00;
158 }
159
144 offset += 0x10; 160 offset += 0x10;
145 } 161 }
146 return ret; 162 return ret;
147 } 163 }
148 164
174 offset += sizeof(aim_caps[4]); 190 offset += sizeof(aim_caps[4]);
175 } 191 }
176 if ((caps & AIM_CAPS_SENDFILE) && (offset < buflen)) { 192 if ((caps & AIM_CAPS_SENDFILE) && (offset < buflen)) {
177 memcpy(capblock+offset, aim_caps[5], sizeof(aim_caps[5])); 193 memcpy(capblock+offset, aim_caps[5], sizeof(aim_caps[5]));
178 offset += sizeof(aim_caps[5]); 194 offset += sizeof(aim_caps[5]);
195 }
196 if ((caps & AIM_CAPS_GAMES) && (offset < buflen)) {
197 memcpy(capblock+offset, aim_caps[6], sizeof(aim_caps[6]));
198 offset += sizeof(aim_caps[6]);
199 }
200 if ((caps & AIM_CAPS_SAVESTOCKS) && (offset < buflen)) {
201 memcpy(capblock+offset, aim_caps[7], sizeof(aim_caps[7]));
202 offset += sizeof(aim_caps[7]);
179 } 203 }
180 204
181 return offset; 205 return offset;
182 } 206 }
183 207