comparison src/protocols/oscar/oscar.c @ 4838:60d8c5ad77f9

[gaim-migrate @ 5163] Aside from my usually bit o' cleanup, this commit changes the function used to send away messages auto-responses. The auto-response is now sent with the same function as normal messages, instead of calling a simpler abstracted function in libfaim which then called the normal function. This has 2 positive effects: 1) Auto-responses will have the correct encoding set 2) Auto-responses will contain the "I have an icon" flag. If the other user sends you 1 more message after they get your away message, they are able to get your buddy icon. Something about dreams as fragile as bubbles Well perhaps it won't apply committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 20 Mar 2003 06:14:21 +0000
parents 0ed37c803503
children 7bdda84b5431
comparison
equal deleted inserted replaced
4837:3411fdaa54fa 4838:60d8c5ad77f9
4081 struct oscar_data *od = (struct oscar_data *)gc->proto_data; 4081 struct oscar_data *od = (struct oscar_data *)gc->proto_data;
4082 struct direct_im *dim = find_direct_im(od, name); 4082 struct direct_im *dim = find_direct_im(od, name);
4083 int ret = 0; 4083 int ret = 0;
4084 GError *err = NULL; 4084 GError *err = NULL;
4085 4085
4086 if (dim) { 4086 if (dim && dim->connected) {
4087 if (dim->connected) { /* If we're not connected yet, send through server */ 4087 /* If we're directly connected, send a direct IM */
4088 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */ 4088 /* XXX - The last parameter below is the encoding. Let Paco-Paco do something with it. */
4089 ret = aim_odc_send_im(od->sess, dim->conn, message, len == -1 ? strlen(message) : len, 0); 4089 ret = aim_odc_send_im(od->sess, dim->conn, message, len == -1 ? strlen(message) : len, 0);
4090 if (ret == 0)
4091 return 1;
4092 else return ret;
4093 }
4094 debug_printf("Direct IM pending, but not connected; sending through server\n");
4095 } else if (len != -1) { 4090 } else if (len != -1) {
4096 /* Trying to send an IM image outside of a direct connection. */ 4091 /* Trying to send an IM image outside of a direct connection. */
4097 oscar_ask_direct_im(gc, name); 4092 oscar_ask_direct_im(gc, name);
4098 return -ENOTCONN; 4093 ret = -ENOTCONN;
4099 }
4100
4101 if (imflags & IM_FLAG_AWAY) {
4102 ret = aim_im_sendch1(od->sess, name, AIM_IMFLAGS_AWAY, message);
4103 } else { 4094 } else {
4104 struct buddyinfo *bi; 4095 struct buddyinfo *bi;
4105 struct aim_sendimext_args args; 4096 struct aim_sendimext_args args;
4106 struct stat st; 4097 struct stat st;
4107 int len; 4098 int len;
4120 } else { 4111 } else {
4121 args.features = features_aim; 4112 args.features = features_aim;
4122 args.featureslen = sizeof(features_aim); 4113 args.featureslen = sizeof(features_aim);
4123 } 4114 }
4124 4115
4116 if (imflags & IM_FLAG_AWAY)
4117 args.flags |= AIM_IMFLAGS_AWAY;
4118
4125 if (bi->ico_need) { 4119 if (bi->ico_need) {
4126 debug_printf("Sending buddy icon request with message\n"); 4120 debug_printf("Sending buddy icon request with message\n");
4127 args.flags |= AIM_IMFLAGS_BUDDYREQ; 4121 args.flags |= AIM_IMFLAGS_BUDDYREQ;
4128 bi->ico_need = FALSE; 4122 bi->ico_need = FALSE;
4129 } 4123 }
4147 bi->ico_me_len = args.iconlen; 4141 bi->ico_me_len = args.iconlen;
4148 bi->ico_me_csum = args.iconsum; 4142 bi->ico_me_csum = args.iconsum;
4149 bi->ico_me_time = args.iconstamp; 4143 bi->ico_me_time = args.iconstamp;
4150 bi->ico_informed = TRUE; 4144 bi->ico_informed = TRUE;
4151 } 4145 }
4152
4153 4146
4154 fclose(file); 4147 fclose(file);
4155 g_free(buf); 4148 g_free(buf);
4156 } 4149 }
4157 } 4150 }
4196 } 4189 }
4197 args.msglen = len; 4190 args.msglen = len;
4198 4191
4199 ret = aim_im_sendch1_ext(od->sess, &args); 4192 ret = aim_im_sendch1_ext(od->sess, &args);
4200 } 4193 }
4194
4201 if (ret >= 0) 4195 if (ret >= 0)
4202 return 1; 4196 return 1;
4203 return ret; 4197 return ret;
4204 } 4198 }
4205 4199