comparison src/prpl.c @ 4333:cc2f780c0505

[gaim-migrate @ 4597] I needed to make gc->login_time set before do_proto_menu was called, so I moved that line into account_online instead of serv_finish_login. serv_finish_login is called directly after account_online, and gc->login_time isn't used for anything anyway, so it shouldn't matter. I use gc->login_time to determine if a gc's protocol actions menu is ready to be drawn or not (should not be draw for accounts that are in the process of signing online). I made the "Show Buddies Awaiting Authorization" thing show something reasonable for when you aren't waiting for authorization from anyone. I swapped the ok and cancel buttons for the search for buddy by information and clear log file so they follow the HIG. I gave the right side of the log viewer a shadowed border. I Robot. I applied a patch from Ryan McCabe that doesn't really do anything for gaim (yet, anyway), but it allows clients using libfaim to call cleansnacs cleanly, which stops a potential build up of SNACs in memory when you don't send an IM for a long period of time. I applied another patch from Mr. McCabe that fixes a potential crash in ssi.c when your buddy list is a few lions short of a pride, if you know what I mean. I re-prettified an authorization dialog or two. The bold stuff and the non-bold stuff got backwardcised somehow. I added support for those messages from the ICQ server. Like the one that tells you not to give your password to anyone when you first signon. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 18 Jan 2003 01:58:00 +0000
parents 5978e3d53f29
children 0c68d402f59f
comparison
equal deleted inserted replaced
4332:c8f374cadbd9 4333:cc2f780c0505
313 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(des_win), window); 313 g_signal_connect(GTK_OBJECT(button), "clicked", G_CALLBACK(des_win), window);
314 314
315 gtk_widget_show_all(window); 315 gtk_widget_show_all(window);
316 } 316 }
317 317
318 static void proto_act(GtkObject *obj, struct gaim_connection *gc) 318 static void proto_act(GtkObject *obj, struct proto_actions_menu *pam)
319 { 319 {
320 char *act = gtk_object_get_user_data(obj); 320 if (pam->callback && pam->gc)
321 gc->prpl->do_action(gc, act); 321 pam->callback(pam->gc);
322 } 322 }
323 323
324 void do_proto_menu() 324 void do_proto_menu()
325 { 325 {
326 GtkWidget *menuitem; 326 GtkWidget *menuitem;
327 GtkWidget *submenu; 327 GtkWidget *submenu;
328 GList *l; 328 GList *l;
329 GSList *c = connections; 329 GSList *c = connections;
330 struct proto_actions_menu *pam;
330 struct gaim_connection *gc = NULL; 331 struct gaim_connection *gc = NULL;
331 int count = 0; 332 int count = 0;
332 char buf[256]; 333 char buf[256];
333 334
334 if (!protomenu) 335 if (!protomenu)
335 return; 336 return;
336 337
337 l = gtk_container_children(GTK_CONTAINER(protomenu)); 338 l = gtk_container_children(GTK_CONTAINER(protomenu));
338 while (l) { 339 while (l) {
339 gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(l->data)); 340 menuitem = l->data;
341 pam = gtk_object_get_data(GTK_OBJECT(menuitem), "user_data");
342 if (pam)
343 g_free(pam);
344 gtk_container_remove(GTK_CONTAINER(protomenu), GTK_WIDGET(menuitem));
340 l = l->next; 345 l = l->next;
341 } 346 }
342 347
343 while (c) { 348 while (c) {
344 gc = c->data; 349 gc = c->data;
345 if (gc->prpl->actions && gc->prpl->do_action) 350 if (gc->prpl->actions && gc->login_time)
346 count++; 351 count++;
347 c = g_slist_next(c); 352 c = g_slist_next(c);
348 } 353 }
349 c = connections; 354 c = connections;
350 355
351 if (!count) { 356 if (!count) {
352 g_snprintf(buf, sizeof(buf), "No actions available"); 357 g_snprintf(buf, sizeof(buf), _("No actions available"));
353 menuitem = gtk_menu_item_new_with_label(buf); 358 menuitem = gtk_menu_item_new_with_label(buf);
354 gtk_menu_append(GTK_MENU(protomenu), menuitem); 359 gtk_menu_append(GTK_MENU(protomenu), menuitem);
355 gtk_widget_show(menuitem); 360 gtk_widget_show(menuitem);
356 return; 361 return;
357 } 362 }
358 363
359 if (count == 1) { 364 if (count == 1) {
360 GList *tmp, *act; 365 GList *act;
361 while (c) { 366 while (c) {
362 gc = c->data; 367 gc = c->data;
363 if (gc->prpl->actions && gc->prpl->do_action) 368 if (gc->prpl->actions && gc->login_time)
364 break; 369 break;
365 c = g_slist_next(c); 370 c = g_slist_next(c);
366 } 371 }
367 372
368 tmp = act = gc->prpl->actions(); 373 act = gc->prpl->actions(gc);
369 374
370 while (act) { 375 while (act) {
371 if (act->data == NULL) { 376 if (act->data) {
377 struct proto_actions_menu *pam = act->data;
378 menuitem = gtk_menu_item_new_with_label(pam->label);
379 gtk_menu_append(GTK_MENU(protomenu), menuitem);
380 g_signal_connect(GTK_OBJECT(menuitem), "activate",
381 G_CALLBACK(proto_act), pam);
382 gtk_object_set_data(GTK_OBJECT(menuitem), "user_data", pam);
383 gtk_widget_show(menuitem);
384 } else {
372 gaim_separator(protomenu); 385 gaim_separator(protomenu);
373 act = g_list_next(act);
374 continue;
375 } 386 }
376
377 menuitem = gtk_menu_item_new_with_label(act->data);
378 gtk_object_set_user_data(GTK_OBJECT(menuitem), act->data);
379 gtk_menu_append(GTK_MENU(protomenu), menuitem);
380 g_signal_connect(GTK_OBJECT(menuitem), "activate",
381 G_CALLBACK(proto_act), gc);
382 gtk_widget_show(menuitem);
383
384 act = g_list_next(act); 387 act = g_list_next(act);
385 } 388 }
386
387 g_list_free(tmp);
388 } else { 389 } else {
389 while (c) { 390 while (c) {
390 GList *tmp, *act; 391 GList *act;
391 gc = c->data; 392 gc = c->data;
392 if (!gc->prpl->actions || !gc->prpl->do_action) { 393 if (!gc->prpl->actions || !gc->login_time) {
393 c = g_slist_next(c); 394 c = g_slist_next(c);
394 continue; 395 continue;
395 } 396 }
396 397
397 g_snprintf(buf, sizeof(buf), "%s (%s)", gc->username, gc->prpl->name); 398 g_snprintf(buf, sizeof(buf), "%s (%s)", gc->username, gc->prpl->name);
401 402
402 submenu = gtk_menu_new(); 403 submenu = gtk_menu_new();
403 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); 404 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
404 gtk_widget_show(submenu); 405 gtk_widget_show(submenu);
405 406
406 tmp = act = gc->prpl->actions(); 407 act = gc->prpl->actions(gc);
407 408
408 while (act) { 409 while (act) {
409 if (act->data == NULL) { 410 if (act->data) {
411 struct proto_actions_menu *pam = act->data;
412 menuitem = gtk_menu_item_new_with_label(pam->label);
413 gtk_menu_append(GTK_MENU(submenu), menuitem);
414 g_signal_connect(GTK_OBJECT(menuitem), "activate",
415 G_CALLBACK(proto_act), pam);
416 gtk_object_set_data(GTK_OBJECT(menuitem), "user_data", pam);
417 gtk_widget_show(menuitem);
418 } else {
410 gaim_separator(submenu); 419 gaim_separator(submenu);
411 act = g_list_next(act);
412 continue;
413 } 420 }
414
415 menuitem = gtk_menu_item_new_with_label(act->data);
416 gtk_object_set_user_data(GTK_OBJECT(menuitem), act->data);
417 gtk_menu_append(GTK_MENU(submenu), menuitem);
418 g_signal_connect(GTK_OBJECT(menuitem), "activate",
419 G_CALLBACK(proto_act), gc);
420 gtk_widget_show(menuitem);
421
422 act = g_list_next(act); 421 act = g_list_next(act);
423 } 422 }
424
425 g_list_free(tmp);
426 c = g_slist_next(c); 423 c = g_slist_next(c);
427 } 424 }
428 } 425 }
429 } 426 }
430 427
662 id ? id : gc->displayname[0] ? gc->displayname : gc->username, 659 id ? id : gc->displayname[0] ? gc->displayname : gc->username,
663 msg ? ": " : ".", 660 msg ? ": " : ".",
664 msg ? msg : "", 661 msg ? msg : "",
665 find_buddy(gc, ga->who) ? "" : _("\n\nDo you wish to add him or her to your buddy list?")); 662 find_buddy(gc, ga->who) ? "" : _("\n\nDo you wish to add him or her to your buddy list?"));
666 if (find_buddy(gc, ga->who)) 663 if (find_buddy(gc, ga->who))
667 do_error_dialog(buf, _("Gaim - Information"), GAIM_INFO); 664 do_error_dialog(_("Gaim - Information"), buf, GAIM_INFO);
668 else 665 else
669 do_ask_dialog(buf, _("Gaim - Confirm"), ga, _("Add"), do_add, _("Cancel"), dont_add, NULL, FALSE); 666 do_ask_dialog(_("Gaim - Confirm"), buf, ga, _("Add"), do_add, _("Cancel"), dont_add, NULL, FALSE);
670 } 667 }
671 668
672 static GtkWidget *regdlg = NULL; 669 static GtkWidget *regdlg = NULL;
673 static GtkWidget *reg_list = NULL; 670 static GtkWidget *reg_list = NULL;
674 static GtkWidget *reg_area = NULL; 671 static GtkWidget *reg_area = NULL;