comparison libpurple/protocols/oscar/family_oservice.c @ 29703:9f298b02e0d8

There's no reason to call into oscar.c anymore, so move this icon stuff directly into family_oservice.c 2 files changed, 38 insertions(+), 71 deletions(-) But more importantly, this is simpler and oscar.c is smaller.
author Mark Doliner <mark@kingant.net>
date Sun, 11 Apr 2010 10:02:02 +0000
parents ab168cf2713e
children 3ada0cc7d2c5
comparison
equal deleted inserted replaced
29702:708c35476cff 29703:9f298b02e0d8
1092 * needs to upload an SSI buddy icon... who engineers this stuff, anyway? 1092 * needs to upload an SSI buddy icon... who engineers this stuff, anyway?
1093 */ 1093 */
1094 static int 1094 static int
1095 aim_parse_extstatus(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) 1095 aim_parse_extstatus(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
1096 { 1096 {
1097 int ret = 0;
1098 aim_rxcallback_t userfunc;
1099 guint16 type; 1097 guint16 type;
1100 guint8 flags, length; 1098 guint8 flags, length;
1101 1099
1102 type = byte_stream_get16(bs); 1100 type = byte_stream_get16(bs);
1103 flags = byte_stream_get8(bs); 1101 flags = byte_stream_get8(bs);
1106 /* 1104 /*
1107 * A flag of 0x01 could mean "this is the checksum we have for you" 1105 * A flag of 0x01 could mean "this is the checksum we have for you"
1108 * A flag of 0x40 could mean "I don't have your icon, upload it" 1106 * A flag of 0x40 could mean "I don't have your icon, upload it"
1109 */ 1107 */
1110 1108
1111 if ((userfunc = aim_callhandler(od, snac->family, snac->subtype))) { 1109 switch (type) {
1112 switch (type) {
1113 case 0x0000: 1110 case 0x0000:
1114 case 0x0001: { /* buddy icon checksum */ 1111 case 0x0001: { /* buddy icon checksum */
1115 /* not sure what the difference between 1 and 0 is */ 1112 /* not sure what the difference between 1 and 0 is */
1116 guint8 *md5 = byte_stream_getraw(bs, length); 1113 guint8 *md5 = byte_stream_getraw(bs, length);
1117 ret = userfunc(od, conn, frame, type, flags, length, md5); 1114
1115 if ((flags == 0x00) || (flags == 0x41)) {
1116 if (!flap_connection_getbytype(od, SNAC_FAMILY_BART) && !od->iconconnecting) {
1117 od->iconconnecting = TRUE;
1118 od->set_icon = TRUE;
1119 aim_srv_requestnew(od, SNAC_FAMILY_BART);
1120 } else {
1121 PurpleAccount *account = purple_connection_get_account(od->gc);
1122 PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account);
1123 if (img == NULL) {
1124 aim_ssi_delicon(od);
1125 } else {
1126
1127 purple_debug_info("oscar",
1128 "Uploading icon to icon server\n");
1129 aim_bart_upload(od, purple_imgstore_get_data(img),
1130 purple_imgstore_get_size(img));
1131 purple_imgstore_unref(img);
1132 }
1133 }
1134 } else if (flags == 0x81) {
1135 PurpleAccount *account = purple_connection_get_account(od->gc);
1136 PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account);
1137 if (img == NULL)
1138 aim_ssi_delicon(od);
1139 else {
1140 aim_ssi_seticon(od, md5, length);
1141 purple_imgstore_unref(img);
1142 }
1143 }
1144
1118 g_free(md5); 1145 g_free(md5);
1119 } break; 1146 } break;
1120 case 0x0002: { /* available message */ 1147
1148 case 0x0002: {
1149 /* We just set an available message? */
1121 /* there is a second length that is just for the message */ 1150 /* there is a second length that is just for the message */
1122 char *msg = byte_stream_getstr(bs, byte_stream_get16(bs)); 1151 char *msg = byte_stream_getstr(bs, byte_stream_get16(bs));
1123 ret = userfunc(od, conn, frame, type, msg);
1124 g_free(msg); 1152 g_free(msg);
1125 } break; 1153 } break;
1126 } 1154 }
1127 } 1155
1128 1156 return 0;
1129 return ret;
1130 } 1157 }
1131 1158
1132 static int 1159 static int
1133 snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs) 1160 snachandler(OscarData *od, FlapConnection *conn, aim_module_t *mod, FlapFrame *frame, aim_modsnac_t *snac, ByteStream *bs)
1134 { 1161 {