- struct aim_tool_version tools[] = {
- {0x0001, 0x0003, AIM_TOOL_NEWWIN, 0x0361},
- {0x0007, 0x0001, AIM_TOOL_NEWWIN, 0x0361},
- };
- int i,j;
- struct command_tx_struct *newpacket;
- int toolcount = sizeof(tools)/sizeof(struct aim_tool_version);
-
- if (!(newpacket = aim_tx_new(sess, conn, AIM_FRAMETYPE_OSCAR, 0x0002, 1152)))
- return -1;
-
- newpacket->lock = 1;
-
- i = aim_putsnac(newpacket->data, 0x0001, 0x0002, 0x0000, sess->snac_nextid);
- aim_cachesnac(sess, 0x0001, 0x0002, 0x0000, NULL, 0);
-
- for (j = 0; j < toolcount; j++) {
- i += aimutil_put16(newpacket->data+i, tools[j].group);
- i += aimutil_put16(newpacket->data+i, tools[j].version);
- i += aimutil_put16(newpacket->data+i, tools[j].tool);
- i += aimutil_put16(newpacket->data+i, tools[j].toolversion);
- }
-
- newpacket->commandlen = i;
- newpacket->lock = 0;
-
- aim_tx_enqueue(sess, newpacket);
-
- return sess->snac_nextid;
+ static const struct aim_tool_version tools[] = {
+ {0x0001, 0x0003, AIM_TOOL_NEWWIN, 0x0361},
+ {0x0007, 0x0001, AIM_TOOL_NEWWIN, 0x0361},
+ };
+ int j;
+ aim_frame_t *tx;
+ int toolcount = sizeof(tools) / sizeof(struct aim_tool_version);
+ aim_snacid_t snacid;
+
+ if (!(tx = aim_tx_new(sess, conn, AIM_FRAMETYPE_FLAP, 0x0002, 1152)))
+ return -ENOMEM;
+
+ snacid = aim_cachesnac(sess, 0x0001, 0x0002, 0x0000, NULL, 0);
+ aim_putsnac(&tx->data, 0x0001, 0x0002, 0x0000, snacid);
+
+ for (j = 0; j < toolcount; j++) {
+ aimbs_put16(&tx->data, tools[j].group);
+ aimbs_put16(&tx->data, tools[j].version);
+ aimbs_put16(&tx->data, tools[j].tool);
+ aimbs_put16(&tx->data, tools[j].toolversion);
+ }
+
+ aim_tx_enqueue(sess, tx);
+
+ return 0;