comparison src/protocols/oscar/oscar.c @ 10246:a66cf83552dc

[gaim-migrate @ 11386] I changed gaim_find_conversation and gaim_find_conversation_with_account The first parameter is now one of GAIM_CONV_IM, GAIM_CONV_CHAT or GAIM_CONV_ANY. Unfortunately, this changes a bajillion files. Please look over this and make sure I use the correct type everywhere. Especially in Novell and MSN, and somewhat in SILC. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 23 Nov 2004 06:14:15 +0000
parents 95ca0db2d01d
children 9cafe038c95e
comparison
equal deleted inserted replaced
10245:c143a3fac58d 10246:a66cf83552dc
898 if (dim->connected) 898 if (dim->connected)
899 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), dim->name); 899 g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), dim->name);
900 else 900 else
901 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), dim->name); 901 g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), dim->name);
902 902
903 conv = gaim_find_conversation_with_account(dim->name, gaim_connection_get_account(dim->gc)); 903 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, dim->name,
904 gaim_connection_get_account(dim->gc));
904 if (conv) { 905 if (conv) {
905 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL)); 906 gaim_conversation_write(conv, NULL, buf, GAIM_MESSAGE_SYSTEM, time(NULL));
906 gaim_conversation_update_progress(conv, 0); 907 gaim_conversation_update_progress(conv, 0);
907 } else { 908 } else {
908 gaim_notify_error(dim->gc, NULL, _("Direct Connect failed"), buf); 909 gaim_notify_error(dim->gc, NULL, _("Direct Connect failed"), buf);
1149 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */ 1150 gaim_input_remove(dim->watcher); /* Otherwise, the callback will callback */
1150 /* The callback will callback? I don't get how that would happen here. */ 1151 /* The callback will callback? I don't get how that would happen here. */
1151 dim->watcher = 0; 1152 dim->watcher = 0;
1152 } 1153 }
1153 1154
1154 c = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc)); 1155 c = gaim_find_conversation_with_account(GAIM_CONV_IM, sn,
1156 gaim_connection_get_account(gc));
1155 if (c != NULL) 1157 if (c != NULL)
1156 gaim_conversation_update_progress(c, percent); 1158 gaim_conversation_update_progress(c, percent);
1157 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, 1159 dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
1158 oscar_callback, dim->conn); 1160 oscar_callback, dim->conn);
1159 1161
5343 5345
5344 static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, GaimConvImFlags); 5346 static int gaim_odc_send_im(aim_session_t *, aim_conn_t *, const char *, GaimConvImFlags);
5345 5347
5346 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags imflags) { 5348 static int oscar_send_im(GaimConnection *gc, const char *name, const char *message, GaimConvImFlags imflags) {
5347 OscarData *od = (OscarData *)gc->proto_data; 5349 OscarData *od = (OscarData *)gc->proto_data;
5350 GaimAccount *account = gaim_connection_get_account(gc);
5348 struct oscar_direct_im *dim = oscar_direct_im_find(od, name); 5351 struct oscar_direct_im *dim = oscar_direct_im_find(od, name);
5349 int ret = 0; 5352 int ret = 0;
5350 const char *iconfile = gaim_account_get_buddy_icon(gaim_connection_get_account(gc)); 5353 const char *iconfile = gaim_account_get_buddy_icon(account);
5351 char *tmpmsg = NULL, *tmpmsg2 = NULL; 5354 char *tmpmsg = NULL, *tmpmsg2 = NULL;
5352 5355
5353 if (dim && dim->connected) { 5356 if (dim && dim->connected) {
5354 /* If we're directly connected, send a direct IM */ 5357 /* If we're directly connected, send a direct IM */
5355 ret = gaim_odc_send_im(od->sess, dim->conn, message, imflags); 5358 ret = gaim_odc_send_im(od->sess, dim->conn, message, imflags);
5356 } else { 5359 } else {
5357 struct buddyinfo *bi; 5360 struct buddyinfo *bi;
5358 struct aim_sendimext_args args; 5361 struct aim_sendimext_args args;
5359 struct stat st; 5362 struct stat st;
5360 gsize len; 5363 gsize len;
5361 GaimConversation *conv = gaim_find_conversation_with_account(name, gaim_connection_get_account(gc)); 5364 GaimConversation *conv;
5365
5366 conv = gaim_find_conversation_with_account(GAIM_CONV_IM, name, account);
5362 5367
5363 if (strstr(message, "<IMG ")) 5368 if (strstr(message, "<IMG "))
5364 gaim_conversation_write(conv, "", 5369 gaim_conversation_write(conv, "",
5365 _("Your IM Image was not sent. " 5370 _("Your IM Image was not sent. "
5366 "You must be Direct Connected to send IM Images."), 5371 "You must be Direct Connected to send IM Images."),
5367 GAIM_MESSAGE_ERROR, time(NULL)); 5372 GAIM_MESSAGE_ERROR, time(NULL));
5368 5373
5369 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(gc->account, name)); 5374 bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(account, name));
5370 if (!bi) { 5375 if (!bi) {
5371 bi = g_new0(struct buddyinfo, 1); 5376 bi = g_new0(struct buddyinfo, 1);
5372 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(gc->account, name)), bi); 5377 g_hash_table_insert(od->buddyinfo, g_strdup(gaim_normalize(account, name)), bi);
5373 } 5378 }
5374 5379
5375 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES; 5380 args.flags = AIM_IMFLAGS_ACK | AIM_IMFLAGS_CUSTOMFEATURES;
5376 if (od->icq) { 5381 if (od->icq) {
5377 args.features = features_icq; 5382 args.features = features_icq;
5429 * If we're IMing an ICQ user then send newlines as CR/LF and 5434 * If we're IMing an ICQ user then send newlines as CR/LF and
5430 * strip all HTML 5435 * strip all HTML
5431 */ 5436 */
5432 if (aim_sn_is_icq(name) ) { 5437 if (aim_sn_is_icq(name) ) {
5433 /* being sent to an ICQ user */ 5438 /* being sent to an ICQ user */
5434 if (!aim_sn_is_icq(gaim_account_get_username(gc->account))) { 5439 if (!aim_sn_is_icq(gaim_account_get_username(account))) {
5435 /* from an AIM user - ICQ receiving from AIM *expects the messsage to be HTML formatted* */ 5440 /* from an AIM user - ICQ receiving from AIM *expects the messsage to be HTML formatted* */
5436 tmpmsg = gaim_str_add_cr(message); 5441 tmpmsg = gaim_str_add_cr(message);
5437 } else { 5442 } else {
5438 /* from an ICQ user - do nothing */ 5443 /* from an ICQ user - do nothing */
5439 tmpmsg = g_strdup(message); 5444 tmpmsg = g_strdup(message);
5440 } 5445 }
5441 } else { 5446 } else {
5442 /* being sent to an AIM user */ 5447 /* being sent to an AIM user */
5443 if (aim_sn_is_icq(gaim_account_get_username(gc->account))) { 5448 if (aim_sn_is_icq(gaim_account_get_username(account))) {
5444 /* from an ICQ user */ 5449 /* from an ICQ user */
5445 tmpmsg2 = gaim_strdup_withhtml(message); 5450 tmpmsg2 = gaim_strdup_withhtml(message);
5446 tmpmsg = gaim_escape_html(tmpmsg2); 5451 tmpmsg = gaim_escape_html(tmpmsg2);
5447 g_free(tmpmsg2); 5452 g_free(tmpmsg2);
5448 } else 5453 } else