Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/family_icbm.c @ 22337:a8c025929245
Add support for offline messages for AIM, thanks to some info from
Matthew Goldstein. The new protocol bits used for offline messaging
for AIM are very nice. It fits in with the rest of the oscar protocol
very well (the old, ICQ-style offline messages were a bit of a hack).
The offline messages arrive in the same way as every other message
(except that they have a timestamp), so we can use the same message
parsing that we use for all other IMs. This means that all our
encoding stuff works just as well with offline messages.
AND the new offline message stuff works for ICQ accounts, too. So I
switched ICQ over to use it, which fixes offline message timestamps
(if that was still a problem, I'm not sure) and offline message encoding
bugs.
Fixes #1229 (feature request for AIM offline messages)
Fixes #1761 (ICQ offline message timestamp is wrong)
Fixes #4300 (crash when receiving offline messages)
Fixes #4464 (can't send IMs to invisible users)
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Wed, 27 Feb 2008 09:18:06 +0000 |
parents | bb1190d6961c |
children | 03b2b21b4c42 969a2aeae461 |
comparison
equal
deleted
inserted
replaced
22336:382bc33e8824 | 22337:a8c025929245 |
---|---|
219 params.maxmsglen = byte_stream_get16(bs); | 219 params.maxmsglen = byte_stream_get16(bs); |
220 params.maxsenderwarn = byte_stream_get16(bs); | 220 params.maxsenderwarn = byte_stream_get16(bs); |
221 params.maxrecverwarn = byte_stream_get16(bs); | 221 params.maxrecverwarn = byte_stream_get16(bs); |
222 params.minmsginterval = byte_stream_get32(bs); | 222 params.minmsginterval = byte_stream_get32(bs); |
223 | 223 |
224 params.flags = 0x0000000b; | 224 params.flags = 0x0000000b | AIM_IMPARAM_FLAG_SUPPORT_OFFLINEMSGS; |
225 params.maxmsglen = 8000; | 225 params.maxmsglen = 8000; |
226 params.minmsginterval = 0; | 226 params.minmsginterval = 0; |
227 | 227 |
228 aim_im_setparams(od, ¶ms); | 228 aim_im_setparams(od, ¶ms); |
229 | 229 |
1624 | 1624 |
1625 args.icbmflags |= AIM_IMFLAGS_AWAY; | 1625 args.icbmflags |= AIM_IMFLAGS_AWAY; |
1626 | 1626 |
1627 } else if (type == 0x0006) { /* Message was received offline. */ | 1627 } else if (type == 0x0006) { /* Message was received offline. */ |
1628 | 1628 |
1629 /* XXX - not sure if this actually gets sent. */ | 1629 /* |
1630 * This flag is set on incoming offline messages for both | |
1631 * AIM and ICQ accounts. | |
1632 */ | |
1630 args.icbmflags |= AIM_IMFLAGS_OFFLINE; | 1633 args.icbmflags |= AIM_IMFLAGS_OFFLINE; |
1631 | 1634 |
1632 } else if (type == 0x0008) { /* I-HAVE-A-REALLY-PURTY-ICON Flag */ | 1635 } else if (type == 0x0008) { /* I-HAVE-A-REALLY-PURTY-ICON Flag */ |
1633 | 1636 |
1634 args.iconlen = byte_stream_get32(bs); | 1637 args.iconlen = byte_stream_get32(bs); |
1654 args.icbmflags |= AIM_IMFLAGS_BUDDYREQ; | 1657 args.icbmflags |= AIM_IMFLAGS_BUDDYREQ; |
1655 | 1658 |
1656 } else if (type == 0x000b) { /* Non-direct connect typing notification */ | 1659 } else if (type == 0x000b) { /* Non-direct connect typing notification */ |
1657 | 1660 |
1658 args.icbmflags |= AIM_IMFLAGS_TYPINGNOT; | 1661 args.icbmflags |= AIM_IMFLAGS_TYPINGNOT; |
1662 | |
1663 } else if (type == 0x0016) { | |
1664 | |
1665 /* | |
1666 * UTC timestamp for when the message was sent. Only | |
1667 * provided for offline messages. | |
1668 */ | |
1669 args.timestamp = byte_stream_get32(bs); | |
1659 | 1670 |
1660 } else if (type == 0x0017) { | 1671 } else if (type == 0x0017) { |
1661 | 1672 |
1662 if (length > byte_stream_empty(bs)) | 1673 if (length > byte_stream_empty(bs)) |
1663 { | 1674 { |
2587 | 2598 |
2588 return ret; | 2599 return ret; |
2589 } | 2600 } |
2590 | 2601 |
2591 /* | 2602 /* |
2603 * Subtype 0x0010 - Request any offline messages that are waiting for | |
2604 * us. This is the "new" way of handling offline messages which is | |
2605 * used for both AIM and ICQ. The old way is to use the ugly | |
2606 * aim_icq_reqofflinemsgs() function, but that is no longer necessary. | |
2607 * | |
2608 * We set the 0x00000100 flag on the ICBM message parameters, which | |
2609 * tells the oscar servers that we support offline messages. When we | |
2610 * set that flag the servers do not automatically send us offline | |
2611 * messages. Instead we must request them using this function. This | |
2612 * should happen after sending the 0x0001/0x0002 "client online" SNAC. | |
2613 */ | |
2614 int aim_im_reqofflinemsgs(OscarData *od) | |
2615 { | |
2616 FlapConnection *conn; | |
2617 | |
2618 if (!od || !(conn = flap_connection_findbygroup(od, 0x0002))) | |
2619 return -EINVAL; | |
2620 | |
2621 aim_genericreq_n(od, conn, 0x0004, 0x0010); | |
2622 | |
2623 return 0; | |
2624 } | |
2625 | |
2626 /* | |
2592 * Subtype 0x0014 - Send a mini typing notification (mtn) packet. | 2627 * Subtype 0x0014 - Send a mini typing notification (mtn) packet. |
2593 * | 2628 * |
2594 * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, | 2629 * This is supported by winaim5 and newer, MacAIM bleh and newer, iChat bleh and newer, |
2595 * and Purple 0.60 and newer. | 2630 * and Purple 0.60 and newer. |
2596 * | 2631 * |