comparison src/buddy.c @ 4476:62c1e5e656d0

[gaim-migrate @ 4751] gaim_conversation_new() now takes an aim_user parameter. This should fix the new placement grouping bugs, as the default "user" (account) selected was the first account in the list of connections. There may be side-effects, especially with perl plugins, but I'm not sure. Please report anything odd that you see as a result of this. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 30 Jan 2003 18:45:50 +0000
parents e73c4e8e2d03
children 3196d9044a45
comparison
equal deleted inserted replaced
4475:1f3241831734 4476:62c1e5e656d0
438 { 438 {
439 struct gaim_conversation *c; 439 struct gaim_conversation *c;
440 440
441 c = gaim_find_conversation(b->name); 441 c = gaim_find_conversation(b->name);
442 442
443 if (c != NULL)
444 gaim_window_show(gaim_conversation_get_window(c));
445 else
446 c = gaim_conversation_new(GAIM_CONV_IM, b->user, b->name);
447 }
448
449 void pressed_im(GtkWidget *widget, struct buddy_show *b)
450 {
451 struct gaim_conversation *c;
452
453 c = gaim_find_conversation(b->name);
454
443 if (c != NULL) { 455 if (c != NULL) {
444 gaim_window_show(gaim_conversation_get_window(c)); 456 gaim_window_show(gaim_conversation_get_window(c));
445 } else { 457 } else {
446 c = gaim_conversation_new(GAIM_CONV_IM, b->name); 458 struct aim_user *user;
447 459
448 gaim_conversation_set_user(c, b->user); 460 user = ((struct gaim_connection *)b->connlist->data)->user;
449 } 461 c = gaim_conversation_new(GAIM_CONV_IM, user, b->name);
450 }
451
452 void pressed_im(GtkWidget *widget, struct buddy_show *b)
453 {
454 struct gaim_conversation *c;
455
456 c = gaim_find_conversation(b->name);
457
458 if (c != NULL) {
459 gaim_window_show(gaim_conversation_get_window(c));
460 } else {
461 struct gaim_connection *gc;
462
463 gc = (struct gaim_connection *)b->connlist->data;
464 c = gaim_conversation_new(GAIM_CONV_IM, b->name);
465
466 gaim_conversation_set_user(c, gc->user);
467 } 462 }
468 } 463 }
469 464
470 void pressed_log(GtkWidget *widget, char *name) 465 void pressed_log(GtkWidget *widget, char *name)
471 { 466 {
498 493
499 static int handle_click_buddy(GtkWidget *widget, GdkEventButton *event, struct buddy_show *b) 494 static int handle_click_buddy(GtkWidget *widget, GdkEventButton *event, struct buddy_show *b)
500 { 495 {
501 if (!b->connlist) 496 if (!b->connlist)
502 return FALSE; 497 return FALSE;
498
503 if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { 499 if (event->type == GDK_2BUTTON_PRESS && event->button == 1) {
504 struct gaim_conversation *c; 500 struct gaim_conversation *c;
505 struct gaim_connection *gc; 501 struct aim_user *user;
502
503 user = ((struct gaim_connection *)b->connlist->data)->user;
506 504
507 c = gaim_find_conversation(b->name); 505 c = gaim_find_conversation(b->name);
508 506
509 if (c != NULL) { 507 if (c != NULL) {
510 struct gaim_window *win = gaim_conversation_get_window(c); 508 struct gaim_window *win = gaim_conversation_get_window(c);
511 size_t index = gaim_conversation_get_index(c); 509 size_t index = gaim_conversation_get_index(c);
512 510
513 gaim_window_switch_conversation(win, index); 511 gaim_window_switch_conversation(win, index);
514 gaim_window_show(win); 512 gaim_window_show(win);
513
514 gaim_conversation_set_user(c, user);
515 } 515 }
516 else 516 else
517 c = gaim_conversation_new(GAIM_CONV_IM, b->name); 517 c = gaim_conversation_new(GAIM_CONV_IM, user, b->name);
518
519 gc = (struct gaim_connection *)b->connlist->data;
520 gaim_conversation_set_user(c, gc->user);
521 518
522 gaim_window_switch_conversation(gaim_conversation_get_window(c), 519 gaim_window_switch_conversation(gaim_conversation_get_window(c),
523 gaim_conversation_get_index(c)); 520 gaim_conversation_get_index(c));
521
522 gaim_window_raise(gaim_conversation_get_window(c));
524 523
525 /* XXX-GTK gtk_widget_grab_focus(c->entry); */ 524 /* XXX-GTK gtk_widget_grab_focus(c->entry); */
526 } else if (event->type == GDK_BUTTON_PRESS && event->button == 3) { 525 } else if (event->type == GDK_BUTTON_PRESS && event->button == 3) {
527 static GtkWidget *menu = NULL; 526 static GtkWidget *menu = NULL;
528 static GList *mo_top = NULL; 527 static GList *mo_top = NULL;
1290 return; 1289 return;
1291 } 1290 }
1292 if (!b->name) 1291 if (!b->name)
1293 return; 1292 return;
1294 1293
1294 user = ((struct gaim_connection *)b->connlist->data)->user;
1295
1295 c = gaim_find_conversation(b->name); 1296 c = gaim_find_conversation(b->name);
1296 1297
1297 if (c == NULL) 1298 if (c == NULL)
1298 c = gaim_conversation_new(GAIM_CONV_IM, b->name); 1299 c = gaim_conversation_new(GAIM_CONV_IM, user, b->name);
1299 else 1300 else {
1301 gaim_conversation_set_user(c, user);
1300 gaim_window_raise(gaim_conversation_get_window(c)); 1302 gaim_window_raise(gaim_conversation_get_window(c));
1301 1303 }
1302 user = ((struct gaim_connection *)b->connlist->data)->user;
1303 gaim_conversation_set_user(c, user);
1304 } 1304 }
1305 1305
1306 static void info_callback(GtkWidget *widget, GtkTree *tree) 1306 static void info_callback(GtkWidget *widget, GtkTree *tree)
1307 { 1307 {
1308 GList *i; 1308 GList *i;
1396 if (!g_strcasecmp(who, normalize (b->name))) { /* find someone to pounce */ 1396 if (!g_strcasecmp(who, normalize (b->name))) { /* find someone to pounce */
1397 if (b->options & OPT_POUNCE_POPUP) { 1397 if (b->options & OPT_POUNCE_POPUP) {
1398 c = gaim_find_conversation(name); 1398 c = gaim_find_conversation(name);
1399 1399
1400 if (c == NULL) 1400 if (c == NULL)
1401 c = gaim_conversation_new(GAIM_CONV_IM, name); 1401 c = gaim_conversation_new(GAIM_CONV_IM, u, name);
1402 1402 else
1403 gaim_conversation_set_user(c, u); 1403 gaim_conversation_set_user(c, u);
1404 } 1404 }
1405 if (b->options & OPT_POUNCE_NOTIFY) { 1405 if (b->options & OPT_POUNCE_NOTIFY) {
1406 char tmp[1024]; 1406 char tmp[1024];
1407 1407
1408 /* I know the line below is really ugly. I only did it this way 1408 /* I know the line below is really ugly. I only did it this way
1419 if (b->options & OPT_POUNCE_SEND_IM) { 1419 if (b->options & OPT_POUNCE_SEND_IM) {
1420 if (strlen(b->message) > 0) { 1420 if (strlen(b->message) > 0) {
1421 c = gaim_find_conversation(name); 1421 c = gaim_find_conversation(name);
1422 1422
1423 if (c == NULL) 1423 if (c == NULL)
1424 c = gaim_conversation_new(GAIM_CONV_IM, name); 1424 c = gaim_conversation_new(GAIM_CONV_IM, u, name);
1425 1425 else
1426 gaim_conversation_set_user(c, u); 1426 gaim_conversation_set_user(c, u);
1427 1427
1428 gaim_conversation_write(c, NULL, b->message, -1, 1428 gaim_conversation_write(c, NULL, b->message, -1,
1429 WFLAG_SEND, time(NULL)); 1429 WFLAG_SEND, time(NULL));
1430 1430
1431 serv_send_im(u->gc, name, b->message, -1, 0); 1431 serv_send_im(u->gc, name, b->message, -1, 0);