[ekg2-commit] r4234 - trunk/plugins/icq: trunk/plugins/icq/icq.c trunk/plugins/icq/icq_snac_handlers_01service.c trunk/plugins/icq/icq_snac_handlers_04message.c
SVN commit
svn w toxygen.net
Pią, 8 Sie 2008, 15:00:22 CEST
Author: darkjames
Date: 2008-08-08 15:00:21 +0200 (Fri, 08 Aug 2008)
New Revision: 4234
Modified:
trunk/plugins/icq/icq.c
trunk/plugins/icq/icq_snac_handlers_01service.c
trunk/plugins/icq/icq_snac_handlers_04message.c
Log:
cleanup.
Modified: trunk/plugins/icq/icq.c
===================================================================
--- trunk/plugins/icq/icq.c 2008-08-08 12:26:17 UTC (rev 4233)
+++ trunk/plugins/icq/icq.c 2008-08-08 13:00:21 UTC (rev 4234)
@@ -105,10 +105,10 @@
/* XXX, cookie */
- /* packTLV(&packet, 0x03, 0x21, (LPBYTE)"text/x-aolrtf; charset=\"utf-8\""); */ /* XXX, 0x21? why? */
+ pkt = icq_pack("TT",
+ icq_pack_tlv_str(0x03, "text/x-aolrtf; charset=\"utf-8\""),
+ icq_pack_tlv_str(0x04, msg));
- pkt = icq_pack("T", icq_pack_tlv_str(0x04, msg));
-
icq_makesnac(s, pkt, 0x02, 0x04, 0, 0);
icq_send_pkt(s, pkt);
@@ -131,87 +131,95 @@
return 1;
}
-void icq_session_connected(session_t *s) {
- icq_private_t *j = s->priv;
- string_t pkt;
+int icq_write_info(session_t *s) {
+ icq_private_t *j;
+
+ if (!s || !(j = s->priv))
+ return -1;
- {
- #define m_bAvatarsEnabled 0
- #define m_bUtfEnabled 0
+#define m_bAvatarsEnabled 0
+#define m_bUtfEnabled 0
- string_t pkt, tlv_5;
+ string_t pkt, tlv_5;
- tlv_5 = string_init(NULL);
+ tlv_5 = string_init(NULL);
#ifdef DBG_CAPMTN
- icq_pack_append(tlv_5, "I", (uint32_t) 0x563FC809); /* CAP_TYPING */
- icq_pack_append(tlv_5, "I", (uint32_t) 0x0B6F41BD);
- icq_pack_append(tlv_5, "I", (uint32_t) 0x9F794226);
- icq_pack_append(tlv_5, "I", (uint32_t) 0x09DFA2F3);
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x563FC809); /* CAP_TYPING */
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x0B6F41BD);
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x9F794226);
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x09DFA2F3);
#endif
- icq_pack_append(tlv_5, "P", (uint32_t) 0x1349); /* AIM_CAPS_ICQSERVERRELAY */
-
- /* Broadcasts the capability to receive UTF8 encoded messages */
- if (m_bUtfEnabled)
- icq_pack_append(tlv_5, "I", (uint32_t) 0x134E); /* CAP_UTF8MSGS */
+ icq_pack_append(tlv_5, "P", (uint32_t) 0x1349); /* AIM_CAPS_ICQSERVERRELAY */
+
+ /* Broadcasts the capability to receive UTF8 encoded messages */
+ if (m_bUtfEnabled)
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x134E); /* CAP_UTF8MSGS */
#ifdef DBG_NEWCAPS
- /* Tells server we understand to new format of caps */
- icq_pack_append(tlv_5, "I", (uint32_t) 0x0000); /* CAP_NEWCAPS */
+ /* Tells server we understand to new format of caps */
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x0000); /* CAP_NEWCAPS */
#endif
#ifdef DBG_CAPXTRAZ
- icq_pack_append(tlv_5, "I", (uint32_t) 0x1a093c6c); /* CAP_XTRAZ */
- icq_pack_append(tlv_5, "I", (uint32_t) 0xd7fd4ec5); /* Broadcasts the capability to handle */
- icq_pack_append(tlv_5, "I", (uint32_t) 0x9d51a647); /* Xtraz */
- icq_pack_append(tlv_5, "I", (uint32_t) 0x4e34f5a0);
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x1a093c6c); /* CAP_XTRAZ */
+ icq_pack_append(tlv_5, "I", (uint32_t) 0xd7fd4ec5); /* Broadcasts the capability to handle */
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x9d51a647); /* Xtraz */
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x4e34f5a0);
#endif
- if (m_bAvatarsEnabled)
- icq_pack_append(tlv_5, "I", (uint32_t) 0x134C); /* CAP_DEVILS */
+ if (m_bAvatarsEnabled)
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x134C); /* CAP_DEVILS */
#ifdef DBG_OSCARFT
- /* Broadcasts the capability to receive Oscar File Transfers */
- icq_pack_append(tlv_5, "P", (uint32_t) 0x1343); /* CAP_AIM_FILE */
+ /* Broadcasts the capability to receive Oscar File Transfers */
+ icq_pack_append(tlv_5, "P", (uint32_t) 0x1343); /* CAP_AIM_FILE */
#endif
- if (j->aim)
- icq_pack_append(tlv_5, "I", (uint32_t) 0x134D); /* Tells the server we can speak to AIM */
+ if (j->aim)
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x134D); /* Tells the server we can speak to AIM */
#ifdef DBG_AIMCONTACTSEND
- icq_pack_append(tlv_5, "P", (uint32_t) 0x134B); /* CAP_AIM_SENDBUDDYLIST */
+ icq_pack_append(tlv_5, "P", (uint32_t) 0x134B); /* CAP_AIM_SENDBUDDYLIST */
#endif
#if 0
- BYTE bXStatus = getContactXStatus(NULL);
- if (bXStatus)
- {
- packBuffer(tlv_5, capXStatus[bXStatus-1], 0x10);
- }
+ BYTE bXStatus = getContactXStatus(NULL);
+ if (bXStatus)
+ {
+ packBuffer(tlv_5, capXStatus[bXStatus-1], 0x10);
+ }
#endif
- icq_pack_append(tlv_5, "P", (uint32_t) 0x1344); /* AIM_CAPS_ICQDIRECT */
+ icq_pack_append(tlv_5, "P", (uint32_t) 0x1344); /* AIM_CAPS_ICQDIRECT */
- /*packDWord(&packet, 0x178c2d9b); // Unknown cap
- packDWord(&packet, 0xdaa545bb);
- packDWord(&packet, 0x8ddbf3bd);
- packDWord(&packet, 0xbd53a10a);*/
+ /*packDWord(&packet, 0x178c2d9b); // Unknown cap
+ packDWord(&packet, 0xdaa545bb);
+ packDWord(&packet, 0x8ddbf3bd);
+ packDWord(&packet, 0xbd53a10a);*/
#ifdef DBG_CAPHTML
- icq_pack_append(tlv_5, "I", (uint32_t) 0x0138ca7b); /* CAP_HTMLMSGS */
- icq_pack_append(tlv_5, "I", (uint32_t) 0x769a4915); /* Broadcasts the capability to receive */
- icq_pack_append(tlv_5, "I", (uint32_t) 0x88f213fc); /* HTML messages */
- icq_pack_append(tlv_5, "I", (uint32_t) 0x00979ea8);
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x0138ca7b); /* CAP_HTMLMSGS */
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x769a4915); /* Broadcasts the capability to receive */
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x88f213fc); /* HTML messages */
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x00979ea8);
#endif
- icq_pack_append(tlv_5, "I", (uint32_t) 0x4D697261); /* Miranda Signature */
- icq_pack_append(tlv_5, "I", (uint32_t) 0x6E64614D);
- icq_pack_append(tlv_5, "I", (uint32_t) 0x12345678); /* XXX, MIRANDA_VERSION */
- icq_pack_append(tlv_5, "I", (uint32_t) 0x80050003);
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x4D697261); /* Miranda Signature */
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x6E64614D);
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x12345678); /* XXX, MIRANDA_VERSION */
+ icq_pack_append(tlv_5, "I", (uint32_t) 0x80050003);
- pkt = icq_pack("T", icq_pack_tlv(0x05, tlv_5->str, tlv_5->len));
-
- icq_makesnac(s, pkt, 0x02, 0x04, 0, 0);
- icq_send_pkt(s, pkt);
+ pkt = icq_pack("T", icq_pack_tlv(0x05, tlv_5->str, tlv_5->len));
- string_free(tlv_5, 1);
- }
+ icq_makesnac(s, pkt, 0x02, 0x04, 0, 0);
+ icq_send_pkt(s, pkt);
+ string_free(tlv_5, 1);
+ return 0;
+}
+
+void icq_session_connected(session_t *s) {
+ icq_private_t *j = s->priv;
+ string_t pkt;
+
+ icq_write_info(s);
+
/* SNAC 3,4: Tell server who's on our list */
if (s->userlist) {
pkt = string_init(NULL);
@@ -878,6 +886,7 @@
ekg_update_status(session);
if (session->connected) {
+ icq_write_info(session);
icq_write_status(session);
icq_write_status_msg(session);
}
Modified: trunk/plugins/icq/icq_snac_handlers_01service.c
===================================================================
--- trunk/plugins/icq/icq_snac_handlers_01service.c 2008-08-08 12:26:17 UTC (rev 4233)
+++ trunk/plugins/icq/icq_snac_handlers_01service.c 2008-08-08 13:00:21 UTC (rev 4234)
@@ -314,8 +314,9 @@
}
SNAC_SUBHANDLER(icq_snac_service_extstatus) {
- debug_error("!!! icq_snac_service_extstatus() XXX\n");
- return -3;
+ debug_function("icq_snac_service_extstatus() Received our avatar hash & status. XXX\n");
+ icq_hexdump(DEBUG_ERROR, buf, len);
+ return 0;
}
SNAC_HANDLER(icq_snac_service_handler) {
Modified: trunk/plugins/icq/icq_snac_handlers_04message.c
===================================================================
--- trunk/plugins/icq/icq_snac_handlers_04message.c 2008-08-08 12:26:17 UTC (rev 4233)
+++ trunk/plugins/icq/icq_snac_handlers_04message.c 2008-08-08 13:00:21 UTC (rev 4234)
@@ -35,8 +35,25 @@
return 0;
}
-SNAC_SUBHANDLER(icq_snac_message_replyicbm) {
+static void icq_snac_message_set_msg_channel(session_t *s, uint16_t chan, uint32_t flags) {
string_t pkt;
+
+ pkt = icq_pack("WIWWWWW",
+ (uint32_t) chan, (uint32_t) flags, /* channel, flags */
+ (uint16_t) 8000, (uint32_t) 999, /* max-message-snac-size, max-sender-warning-level */
+ (uint32_t) 999, (uint32_t) 0, /* max-rcv-warning-level, minimum message-interval-in-secons */
+ (uint32_t) 0); /* unknown */
+ icq_makesnac(s, pkt, 0x04, 0x02, 0, 0);
+ icq_send_pkt(s, pkt);
+}
+
+SNAC_SUBHANDLER(icq_snac_message_replyicbm) {
+#if 1
+ icq_snac_message_set_msg_channel(s, 0x01, 0x0b);
+ icq_snac_message_set_msg_channel(s, 0x02, 0x03);
+ icq_snac_message_set_msg_channel(s, 0x04, 0x03);
+
+#else /* Miranda-like */
uint32_t flags;
/* Set message parameters for all channels (imitate ICQ 6) */
@@ -47,33 +64,10 @@
#ifdef DBG_CAPMTN
flags |= 0x00000008;
#endif
- /* SnacCliSeticbm() */
-flags = 0x0b;
- pkt = icq_pack("WIWWWWW",
- (uint32_t) 0x0001, (uint32_t) flags, /* channel, flags */
- (uint16_t) 8000, (uint32_t) 999, /* max-message-snac-size, max-sender-warning-level */
- (uint32_t) 999, (uint32_t) 0, /* max-rcv-warning-level, minimum message-interval-in-secons */
- (uint32_t) 0); /* unknown */
- icq_makesnac(s, pkt, 0x04, 0x02, 0, 0);
- icq_send_pkt(s, pkt);
-flags = 0x03;
- pkt = icq_pack("WIWWWWW",
- (uint32_t) 0x0002, (uint32_t) flags, /* channel, flags */
- (uint16_t) 8000, (uint32_t) 999, /* max-message-snac-size, max-sender-warning-level */
- (uint32_t) 999, (uint32_t) 0, /* max-rcv-warning-level, minimum message-interval-in-secons */
- (uint32_t) 0); /* unknown */
- icq_makesnac(s, pkt, 0x04, 0x02, 0, 0);
- icq_send_pkt(s, pkt);
+ icq_snac_message_set_msg_channel(s, 0x00, flags);
+#endif
- pkt = icq_pack("WIWWWWW",
- (uint32_t) 0x0004, (uint32_t) flags, /* channel, flags */
- (uint16_t) 8000, (uint32_t) 999, /* max-message-snac-size, max-sender-warning-level */
- (uint32_t) 999, (uint32_t) 0, /* max-rcv-warning-level, minimum message-interval-in-secons */
- (uint32_t) 0); /* unknown */
- icq_makesnac(s, pkt, 0x04, 0x02, 0, 0);
- icq_send_pkt(s, pkt);
-
return 0;
}
@@ -335,7 +329,7 @@
if (len < 2)
return -1;
- reason = xstrndup(buf + 2, len);
+ reason = xstrndup((char *) buf + 2, len);
icq_snac_message_status_reply(s, "SNAC(4.B)", pkt.uid, version, msg_type, reason);
xfree(reason);
return 0;
Więcej informacji o liście dyskusyjnej ekg2-commit