comparison libpurple/protocols/oscar/family_oservice.c @ 23315:9c0ee2491ed1

Replaced family_*'s magic numbers of FLAP families with the constants defined in snactypes.h
author Evan Schoenberg <evan.s@dreskin.net>
date Sat, 07 Jun 2008 18:42:48 +0000
parents ab2322195dab
children 540a26a1a88d
comparison
equal deleted inserted replaced
23314:afdbbf36499e 23315:9c0ee2491ed1
52 byte_stream_put16(&bs, mod->toolid); 52 byte_stream_put16(&bs, mod->toolid);
53 byte_stream_put16(&bs, mod->toolversion); 53 byte_stream_put16(&bs, mod->toolversion);
54 } 54 }
55 } 55 }
56 56
57 snacid = aim_cachesnac(od, 0x0001, 0x0002, 0x0000, NULL, 0); 57 snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0002, 0x0000, NULL, 0);
58 flap_connection_send_snac(od, conn, 0x0001, 0x0002, 0x0000, snacid, &bs); 58 flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0002, 0x0000, snacid, &bs);
59 59
60 byte_stream_destroy(&bs); 60 byte_stream_destroy(&bs);
61 } 61 }
62 62
63 /* 63 /*
106 106
107 conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); 107 conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS);
108 if(!conn) 108 if(!conn)
109 return; 109 return;
110 110
111 aim_genericreq_s(od, conn, 0x0001, 0x0004, &serviceid); 111 aim_genericreq_s(od, conn, SNAC_FAMILY_OSERVICE, 0x0004, &serviceid);
112 } 112 }
113 113
114 /* 114 /*
115 * Join a room of name roomname. This is the first step to joining an 115 * Join a room of name roomname. This is the first step to joining an
116 * already created room. It's basically a Service Request for 116 * already created room. It's basically a Service Request for
144 144
145 aim_tlvlist_add_chatroom(&tlvlist, 0x0001, exchange, roomname, instance); 145 aim_tlvlist_add_chatroom(&tlvlist, 0x0001, exchange, roomname, instance);
146 aim_tlvlist_write(&bs, &tlvlist); 146 aim_tlvlist_write(&bs, &tlvlist);
147 aim_tlvlist_free(tlvlist); 147 aim_tlvlist_free(tlvlist);
148 148
149 snacid = aim_cachesnac(od, 0x0001, 0x0004, 0x0000, &csi, sizeof(csi)); 149 snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, &csi, sizeof(csi));
150 flap_connection_send_snac(od, conn, 0x0001, 0x0004, 0x0000, snacid, &bs); 150 flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0004, 0x0000, snacid, &bs);
151 151
152 byte_stream_destroy(&bs); 152 byte_stream_destroy(&bs);
153 153
154 return 0; 154 return 0;
155 } 155 }
208 208
209 /* Subtype 0x0006 - Request Rate Information. */ 209 /* Subtype 0x0006 - Request Rate Information. */
210 void 210 void
211 aim_srv_reqrates(OscarData *od, FlapConnection *conn) 211 aim_srv_reqrates(OscarData *od, FlapConnection *conn)
212 { 212 {
213 aim_genericreq_n_snacid(od, conn, 0x0001, 0x0006); 213 aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_OSERVICE, 0x0006);
214 } 214 }
215 215
216 /* 216 /*
217 * OSCAR defines several 'rate classes'. Each class has separate 217 * OSCAR defines several 'rate classes'. Each class has separate
218 * rate limiting properties (limit level, alert level, disconnect 218 * rate limiting properties (limit level, alert level, disconnect
387 struct rateclass *rateclass; 387 struct rateclass *rateclass;
388 rateclass = tmp->data; 388 rateclass = tmp->data;
389 byte_stream_put16(&bs, rateclass->classid); 389 byte_stream_put16(&bs, rateclass->classid);
390 } 390 }
391 391
392 snacid = aim_cachesnac(od, 0x0001, 0x0008, 0x0000, NULL, 0); 392 snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0008, 0x0000, NULL, 0);
393 flap_connection_send_snac(od, conn, 0x0001, 0x0008, 0x0000, snacid, &bs); 393 flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0008, 0x0000, snacid, &bs);
394 394
395 byte_stream_destroy(&bs); 395 byte_stream_destroy(&bs);
396 } 396 }
397 397
398 /* Subtype 0x0009 - Delete Rate Parameter */ 398 /* Subtype 0x0009 - Delete Rate Parameter */
410 struct rateclass *rateclass; 410 struct rateclass *rateclass;
411 rateclass = tmp->data; 411 rateclass = tmp->data;
412 byte_stream_put16(&bs, rateclass->classid); 412 byte_stream_put16(&bs, rateclass->classid);
413 } 413 }
414 414
415 snacid = aim_cachesnac(od, 0x0001, 0x0009, 0x0000, NULL, 0); 415 snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0009, 0x0000, NULL, 0);
416 flap_connection_send_snac(od, conn, 0x0001, 0x0009, 0x0000, snacid, &bs); 416 flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0009, 0x0000, snacid, &bs);
417 417
418 byte_stream_destroy(&bs); 418 byte_stream_destroy(&bs);
419 } 419 }
420 420
421 /* Subtype 0x000a - Rate Change */ 421 /* Subtype 0x000a - Rate Change */
501 * we want them all back after the migration. 501 * we want them all back after the migration.
502 */ 502 */
503 for (cur = conn->groups; cur != NULL; cur = cur->next) 503 for (cur = conn->groups; cur != NULL; cur = cur->next)
504 byte_stream_put16(&bs, GPOINTER_TO_UINT(cur->data)); 504 byte_stream_put16(&bs, GPOINTER_TO_UINT(cur->data));
505 505
506 snacid = aim_cachesnac(od, 0x0001, 0x000c, 0x0000, NULL, 0); 506 snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x000c, 0x0000, NULL, 0);
507 flap_connection_send_snac(od, conn, 0x0001, 0x000c, 0x0000, snacid, &bs); 507 flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x000c, 0x0000, snacid, &bs);
508 508
509 byte_stream_destroy(&bs); 509 byte_stream_destroy(&bs);
510 } 510 }
511 511
512 /* Subtype 0x000d - Service Resume */ 512 /* Subtype 0x000d - Service Resume */
524 524
525 /* Subtype 0x000e - Request self-info */ 525 /* Subtype 0x000e - Request self-info */
526 void 526 void
527 aim_srv_reqpersonalinfo(OscarData *od, FlapConnection *conn) 527 aim_srv_reqpersonalinfo(OscarData *od, FlapConnection *conn)
528 { 528 {
529 aim_genericreq_n_snacid(od, conn, 0x0001, 0x000e); 529 aim_genericreq_n_snacid(od, conn, SNAC_FAMILY_OSERVICE, 0x000e);
530 } 530 }
531 531
532 /* Subtype 0x000f - Self User Info */ 532 /* Subtype 0x000f - Self User Info */
533 static int 533 static int
534 selfinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) 534 selfinfo(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
587 587
588 conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS); 588 conn = flap_connection_findbygroup(od, SNAC_FAMILY_BOS);
589 if(!conn) 589 if(!conn)
590 return; 590 return;
591 591
592 aim_genericreq_l(od, conn, 0x0001, 0x0011, &idletime); 592 aim_genericreq_l(od, conn, SNAC_FAMILY_OSERVICE, 0x0011, &idletime);
593 } 593 }
594 594
595 /* 595 /*
596 * Subtype 0x0012 - Service Migrate 596 * Subtype 0x0012 - Service Migrate
597 * 597 *
696 * 696 *
697 */ 697 */
698 void 698 void
699 aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32 flags) 699 aim_srv_setprivacyflags(OscarData *od, FlapConnection *conn, guint32 flags)
700 { 700 {
701 aim_genericreq_l(od, conn, 0x0001, 0x0014, &flags); 701 aim_genericreq_l(od, conn, SNAC_FAMILY_OSERVICE, 0x0014, &flags);
702 } 702 }
703 703
704 /* 704 /*
705 * Subtype 0x0016 - No-op 705 * Subtype 0x0016 - No-op
706 * 706 *
711 * FLAP as a no-op... 711 * FLAP as a no-op...
712 */ 712 */
713 void 713 void
714 aim_srv_nop(OscarData *od, FlapConnection *conn) 714 aim_srv_nop(OscarData *od, FlapConnection *conn)
715 { 715 {
716 aim_genericreq_n(od, conn, 0x0001, 0x0016); 716 aim_genericreq_n(od, conn, SNAC_FAMILY_OSERVICE, 0x0016);
717 } 717 }
718 718
719 /* 719 /*
720 * Subtype 0x0017 - Set client versions 720 * Subtype 0x0017 - Set client versions
721 * 721 *
751 byte_stream_put16(&bs, mod->family); 751 byte_stream_put16(&bs, mod->family);
752 byte_stream_put16(&bs, mod->version); 752 byte_stream_put16(&bs, mod->version);
753 } 753 }
754 } 754 }
755 755
756 snacid = aim_cachesnac(od, 0x0001, 0x0017, 0x0000, NULL, 0); 756 snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0017, 0x0000, NULL, 0);
757 flap_connection_send_snac(od, conn, 0x0001, 0x0017, 0x0000, snacid, &bs); 757 flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0017, 0x0000, snacid, &bs);
758 758
759 byte_stream_destroy(&bs); 759 byte_stream_destroy(&bs);
760 } 760 }
761 761
762 /* Subtype 0x0018 - Host versions */ 762 /* Subtype 0x0018 - Host versions */
859 byte_stream_new(&bs, aim_tlvlist_size(tlvlist)); 859 byte_stream_new(&bs, aim_tlvlist_size(tlvlist));
860 860
861 aim_tlvlist_write(&bs, &tlvlist); 861 aim_tlvlist_write(&bs, &tlvlist);
862 aim_tlvlist_free(tlvlist); 862 aim_tlvlist_free(tlvlist);
863 863
864 snacid = aim_cachesnac(od, 0x0001, 0x001e, 0x0000, NULL, 0); 864 snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x001e, 0x0000, NULL, 0);
865 flap_connection_send_snac(od, conn, 0x0001, 0x001e, 0x0000, snacid, &bs); 865 flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x001e, 0x0000, snacid, &bs);
866 866
867 byte_stream_destroy(&bs); 867 byte_stream_destroy(&bs);
868 868
869 return 0; 869 return 0;
870 } 870 }
1010 } else 1010 } else
1011 purple_debug_warning("oscar", "sendmemblock: unknown hash request\n"); 1011 purple_debug_warning("oscar", "sendmemblock: unknown hash request\n");
1012 1012
1013 } 1013 }
1014 1014
1015 snacid = aim_cachesnac(od, 0x0001, 0x0020, 0x0000, NULL, 0); 1015 snacid = aim_cachesnac(od, SNAC_FAMILY_OSERVICE, 0x0020, 0x0000, NULL, 0);
1016 flap_connection_send_snac(od, conn, 0x0001, 0x0020, 0x0000, snacid, &bs); 1016 flap_connection_send_snac(od, conn, SNAC_FAMILY_OSERVICE, 0x0020, 0x0000, snacid, &bs);
1017 1017
1018 byte_stream_destroy(&bs); 1018 byte_stream_destroy(&bs);
1019 1019
1020 return 0; 1020 return 0;
1021 } 1021 }
1098 return 0; 1098 return 0;
1099 } 1099 }
1100 1100
1101 int service_modfirst(OscarData *od, aim_module_t *mod) 1101 int service_modfirst(OscarData *od, aim_module_t *mod)
1102 { 1102 {
1103 mod->family = 0x0001; 1103 mod->family = SNAC_FAMILY_OSERVICE;
1104 mod->version = 0x0003; 1104 mod->version = 0x0003;
1105 mod->toolid = 0x0110; 1105 mod->toolid = 0x0110;
1106 mod->toolversion = 0x0629; 1106 mod->toolversion = 0x0629;
1107 mod->flags = 0; 1107 mod->flags = 0;
1108 strncpy(mod->name, "oservice", sizeof(mod->name)); 1108 strncpy(mod->name, "oservice", sizeof(mod->name));