120
120
/* Send ACK if the sys message needs an ACK */
121
121
static void _qq_send_packet_ack_msg_sys(PurpleConnection *gc, guint8 code, guint32 from, guint16 seq)
123
guint8 bar, *ack, *cursor;
125
126
gint ack_len, bytes;
128
qd = (qq_data *) gc->proto_data;
127
130
str = g_strdup_printf("%d", from);
129
132
ack_len = 1 + 1 + strlen(str) + 1 + 2;
130
133
ack = g_newa(guint8, ack_len);
134
bytes += create_packet_b(ack, &cursor, code);
135
bytes += create_packet_b(ack, &cursor, bar);
136
bytes += create_packet_data(ack, &cursor, (guint8 *) str, strlen(str));
137
bytes += create_packet_b(ack, &cursor, bar);
138
bytes += create_packet_w(ack, &cursor, seq);
136
bytes += qq_put8(ack + bytes, code);
137
bytes += qq_put8(ack + bytes, bar);
138
bytes += qq_putdata(ack + bytes, (guint8 *) str, strlen(str));
139
bytes += qq_put8(ack + bytes, bar);
140
bytes += qq_put16(ack + bytes, seq);
142
144
if (bytes == ack_len) /* creation OK */
143
qq_send_cmd(gc, QQ_CMD_ACK_SYS_MSG, TRUE, 0, FALSE, ack, ack_len);
145
qq_send_cmd_detail(qd, QQ_CMD_ACK_SYS_MSG, 0, FALSE, ack, ack_len);
145
147
purple_debug(PURPLE_DEBUG_ERROR, "QQ",
146
148
"Fail creating sys msg ACK, expect %d bytes, build %d bytes\n", ack_len, bytes);