aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llimpanel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llimpanel.cpp')
-rw-r--r--linden/indra/newview/llimpanel.cpp111
1 files changed, 52 insertions, 59 deletions
diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp
index de57225..7ccf49c 100644
--- a/linden/indra/newview/llimpanel.cpp
+++ b/linden/indra/newview/llimpanel.cpp
@@ -1412,21 +1412,22 @@ BOOL LLFloaterIMPanel::postBuild()
1412#if USE_OTR // [$PLOTR$] 1412#if USE_OTR // [$PLOTR$]
1413 if (!gOTR) OTR_Wrapper::init(); 1413 if (!gOTR) OTR_Wrapper::init();
1414 if (gOTR && (IM_NOTHING_SPECIAL == mDialog)) 1414 if (gOTR && (IM_NOTHING_SPECIAL == mDialog))
1415 { 1415 {
1416 LLComboBox *combo = getChild<LLComboBox>("otr_combo"); 1416 childSetCommitCallback("otr_btn", onClickOtr, this);
1417 if (!combo) 1417 LLComboBox *combo = getChild<LLComboBox>("otr_btn");
1418 { 1418 if (!combo)
1419 llwarns << "$PLOTR$ Can't find OTR control/status" << llendl; 1419 {
1420 } 1420 llwarns << "$PLOTR$ Can't find OTR control/status" << llendl;
1421 else 1421 }
1422 { 1422 else
1423 llinfos << "$PLOTR$ found OTR control/status" << llendl; 1423 {
1424 combo->setCommitCallback(onClickOtr); 1424 llinfos << "$PLOTR$ found OTR control/status" << llendl;
1425 combo->setCallbackUserData(this); 1425 combo->setCommitCallback(onClickOtr);
1426 combo->setAllowTextEntry(FALSE, 0, FALSE); 1426 combo->setCallbackUserData(this);
1427 showOtrStatus(); 1427 combo->setAllowTextEntry(FALSE, 0, FALSE);
1428 } 1428 showOtrStatus();
1429 } 1429 }
1430 }
1430#endif // USE_OTR // [/$PLOTR$] 1431#endif // USE_OTR // [/$PLOTR$]
1431 1432
1432 setDefaultBtn("send_btn"); 1433 setDefaultBtn("send_btn");
@@ -2417,45 +2418,61 @@ void LLFloaterIMPanel::doOtrAuth()
2417 } 2418 }
2418} 2419}
2419 2420
2421
2420void LLFloaterIMPanel::doOtrMenu() 2422void LLFloaterIMPanel::doOtrMenu()
2421{ 2423{
2422 if (gOTR && (IM_NOTHING_SPECIAL == mDialog)) 2424 if (gOTR && (IM_NOTHING_SPECIAL == mDialog))
2423 { 2425 {
2424 LLComboBox *combo = getChild<LLComboBox>("otr_combo"); 2426 LLComboBox *combo = getChild<LLComboBox>("otr_btn");
2425 if (!combo) 2427 if (!combo)
2426 { 2428 {
2427 llwarns << "$PLOTR$ Can't find OTR control/status" << llendl; 2429 llwarns << "$PLOTR$ Can't find OTR control/status" << llendl;
2428 } 2430 }
2429 else 2431 else
2430 { 2432 {
2431 std::string choice = combo->getSimple(); 2433 ConnContext *context = getOtrContext();
2432 if ((getString("otr_start") == choice) || 2434 U32 otrpref = gSavedSettings.getU32("EmeraldUseOTR");
2433 (getString("otr_restart") == choice) || 2435 if (combo->getValue().asString() == "otr_auth_entry")
2434 (getString("otr_refresh") == choice))
2435 {
2436 doOtrStart();
2437 }
2438 else if (getString("otr_stop") == choice)
2439 {
2440 doOtrStop();
2441 }
2442 else if (getString("otr_auth") == choice)
2443 { 2436 {
2444 doOtrAuth(); 2437 // Instant crash when doing this with someone that has no OTR capability.
2438 // So guard it if no encryption is happening.
2439 if (context && (OTRL_MSGSTATE_ENCRYPTED == context->msgstate))
2440 {
2441 doOtrAuth();
2442 }
2445 } 2443 }
2446 else if (getString("otr_help") == choice) 2444 else if (combo->getValue().asString() == "otr_help_entry")
2447 { 2445 {
2448 llinfos << "$PLOTR$ otr help" << llendl; 2446 llinfos << "$PLOTR$ otr help" << llendl;
2449 LLWeb::loadURL("http://www.cypherpunks.ca/otr/"); 2447 LLWeb::loadURL("http://www.cypherpunks.ca/otr/");
2450 } 2448 }
2451 else if (getString("otr_levels") == choice) 2449 else if (combo->getValue().asString() == "otr_levels_entry")
2452 { 2450 {
2453 llinfos << "$PLOTR$ otr levels help" << llendl; 2451 llinfos << "$PLOTR$ otr levels help" << llendl;
2454 LLWeb::loadURL("http://www.cypherpunks.ca/otr/help/3.2.0/levels.php"); 2452 LLWeb::loadURL("http://www.cypherpunks.ca/otr/help/3.2.0/levels.php");
2455 } 2453 }
2456 else 2454 else // Clicked the flyout itself. Sort out what level to put them in based on the old level.
2457 { 2455 {
2458 llwarns << "$PLOTR$ unknown menu item" << llendl; 2456 // otrpref: 0 == Require OTR, 1 == Request OTR, 2 == Accept OTR, 3 == Decline OTR
2457 if (3 == otrpref)
2458 {
2459 if (context && (OTRL_MSGSTATE_ENCRYPTED == context->msgstate))
2460 {
2461 doOtrStop();
2462 }
2463 }
2464 else if (context && (OTRL_MSGSTATE_ENCRYPTED == context->msgstate))
2465 {
2466 doOtrStop();
2467 }
2468 else if (context && (OTRL_MSGSTATE_FINISHED == context->msgstate))
2469 {
2470 doOtrStop();
2471 }
2472 else // OTRL_MSGSTATE_PLAINTEXT, or no context yet
2473 {
2474 doOtrStart();
2475 }
2459 } 2476 }
2460 } 2477 }
2461 } 2478 }
@@ -2502,10 +2519,10 @@ void LLFloaterIMPanel::showOtrStatus()
2502{ 2519{
2503 if (gOTR && (IM_NOTHING_SPECIAL == mDialog)) 2520 if (gOTR && (IM_NOTHING_SPECIAL == mDialog))
2504 { 2521 {
2505 LLComboBox *combo = getChild<LLComboBox>("otr_combo"); 2522 LLFlyoutButton *combo = (LLFlyoutButton *) getChild<LLComboBox>("otr_btn");
2506 if (!combo) 2523 if (!combo)
2507 { 2524 {
2508 llwarns << "$PLOTR$ Can't find OTR control/status" << llendl; 2525 llerrs << "$PLOTR$ Can't find OTR control/status" << llendl;
2509 } 2526 }
2510 else 2527 else
2511 { 2528 {
@@ -2518,22 +2535,10 @@ void LLFloaterIMPanel::showOtrStatus()
2518 { 2535 {
2519 doOtrStop(); 2536 doOtrStop();
2520 } 2537 }
2521 combo->removeall();
2522 combo->add(getString("otr_start"), ADD_BOTTOM, TRUE); // to tell them where to turn it back on
2523 combo->add(getString("otr_stop"), ADD_BOTTOM, FALSE);
2524 combo->add(getString("otr_auth"), ADD_BOTTOM, FALSE);
2525 combo->add(getString("otr_help"), ADD_BOTTOM, TRUE);
2526 combo->add(getString("otr_levels"), ADD_BOTTOM, TRUE);
2527 combo->setLabel(getString("otr_not_private")); 2538 combo->setLabel(getString("otr_not_private"));
2528 } 2539 }
2529 else if (context && (OTRL_MSGSTATE_ENCRYPTED == context->msgstate)) 2540 else if (context && (OTRL_MSGSTATE_ENCRYPTED == context->msgstate))
2530 { 2541 {
2531 combo->removeall();
2532 combo->add(getString("otr_refresh"), ADD_BOTTOM, TRUE);
2533 combo->add(getString("otr_stop"), ADD_BOTTOM, TRUE);
2534 combo->add(getString("otr_auth"), ADD_BOTTOM, TRUE);
2535 combo->add(getString("otr_help"), ADD_BOTTOM, TRUE);
2536 combo->add(getString("otr_levels"), ADD_BOTTOM, TRUE);
2537 if (otherIsOtrAuthenticated()) 2542 if (otherIsOtrAuthenticated())
2538 combo->setLabel(getString("otr_private")); 2543 combo->setLabel(getString("otr_private"));
2539 else 2544 else
@@ -2548,22 +2553,10 @@ void LLFloaterIMPanel::showOtrStatus()
2548 else 2553 else
2549 otrLogMessageGetstringName("otr_prog_they_stop_unverified"); 2554 otrLogMessageGetstringName("otr_prog_they_stop_unverified");
2550 } 2555 }
2551 combo->removeall();
2552 combo->add(getString("otr_restart"), ADD_BOTTOM, TRUE);
2553 combo->add(getString("otr_stop"), ADD_BOTTOM, TRUE);
2554 combo->add(getString("otr_auth"), ADD_BOTTOM, FALSE);
2555 combo->add(getString("otr_help"), ADD_BOTTOM, TRUE);
2556 combo->add(getString("otr_levels"), ADD_BOTTOM, TRUE);
2557 combo->setLabel(getString("otr_finished")); 2556 combo->setLabel(getString("otr_finished"));
2558 } 2557 }
2559 else // OTRL_MSGSTATE_PLAINTEXT, or no context yet 2558 else // OTRL_MSGSTATE_PLAINTEXT, or no context yet
2560 { 2559 {
2561 combo->removeall();
2562 combo->add(getString("otr_start"), ADD_BOTTOM, TRUE);
2563 combo->add(getString("otr_stop"), ADD_BOTTOM, FALSE);
2564 combo->add(getString("otr_auth"), ADD_BOTTOM, FALSE);
2565 combo->add(getString("otr_help"), ADD_BOTTOM, TRUE);
2566 combo->add(getString("otr_levels"), ADD_BOTTOM, TRUE);
2567 combo->setLabel(getString("otr_not_private")); 2560 combo->setLabel(getString("otr_not_private"));
2568 } 2561 }
2569 if (context) 2562 if (context)