diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llimpanel.cpp | 70 |
1 files changed, 31 insertions, 39 deletions
diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp index 4ea3a4c..7ccf49c 100644 --- a/linden/indra/newview/llimpanel.cpp +++ b/linden/indra/newview/llimpanel.cpp | |||
@@ -1413,6 +1413,7 @@ BOOL LLFloaterIMPanel::postBuild() | |||
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 | childSetCommitCallback("otr_btn", onClickOtr, this); | ||
1416 | LLComboBox *combo = getChild<LLComboBox>("otr_btn"); | 1417 | LLComboBox *combo = getChild<LLComboBox>("otr_btn"); |
1417 | if (!combo) | 1418 | if (!combo) |
1418 | { | 1419 | { |
@@ -2429,20 +2430,16 @@ void LLFloaterIMPanel::doOtrMenu() | |||
2429 | } | 2430 | } |
2430 | else | 2431 | else |
2431 | { | 2432 | { |
2432 | std::string choice = combo->getSimple(); | 2433 | ConnContext *context = getOtrContext(); |
2433 | if ((combo->getValue().asString() == "otr_start_entry") || | 2434 | U32 otrpref = gSavedSettings.getU32("EmeraldUseOTR"); |
2434 | (combo->getValue().asString() == "otr_restart_entry") || | 2435 | if (combo->getValue().asString() == "otr_auth_entry") |
2435 | (combo->getValue().asString() == "otr_refresh_entry")) | ||
2436 | { | 2436 | { |
2437 | doOtrStart(); | 2437 | // Instant crash when doing this with someone that has no OTR capability. |
2438 | } | 2438 | // So guard it if no encryption is happening. |
2439 | else if (combo->getValue().asString() == "otr_stop_entry") | 2439 | if (context && (OTRL_MSGSTATE_ENCRYPTED == context->msgstate)) |
2440 | { | 2440 | { |
2441 | doOtrStop(); | 2441 | doOtrAuth(); |
2442 | } | 2442 | } |
2443 | else if (combo->getValue().asString() == "otr_auth_entry") | ||
2444 | { | ||
2445 | doOtrAuth(); | ||
2446 | } | 2443 | } |
2447 | else if (combo->getValue().asString() == "otr_help_entry") | 2444 | else if (combo->getValue().asString() == "otr_help_entry") |
2448 | { | 2445 | { |
@@ -2454,9 +2451,28 @@ void LLFloaterIMPanel::doOtrMenu() | |||
2454 | llinfos << "$PLOTR$ otr levels help" << llendl; | 2451 | llinfos << "$PLOTR$ otr levels help" << llendl; |
2455 | 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"); |
2456 | } | 2453 | } |
2457 | else | 2454 | else // Clicked the flyout itself. Sort out what level to put them in based on the old level. |
2458 | { | 2455 | { |
2459 | 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 | } | ||
2460 | } | 2476 | } |
2461 | } | 2477 | } |
2462 | } | 2478 | } |
@@ -2519,22 +2535,10 @@ void LLFloaterIMPanel::showOtrStatus() | |||
2519 | { | 2535 | { |
2520 | doOtrStop(); | 2536 | doOtrStop(); |
2521 | } | 2537 | } |
2522 | // combo->removeall(); | ||
2523 | // combo->add(getString("otr_start_entry"), ADD_BOTTOM, TRUE); // to tell them where to turn it back on | ||
2524 | // combo->add(getString("otr_stop_entry"), ADD_BOTTOM, FALSE); | ||
2525 | // combo->add(getString("otr_auth_entry"), ADD_BOTTOM, FALSE); | ||
2526 | // combo->add(getString("otr_help_entry"), ADD_BOTTOM, TRUE); | ||
2527 | // combo->add(getString("otr_levels_entry"), ADD_BOTTOM, TRUE); | ||
2528 | combo->setLabel(getString("otr_not_private")); | 2538 | combo->setLabel(getString("otr_not_private")); |
2529 | } | 2539 | } |
2530 | else if (context && (OTRL_MSGSTATE_ENCRYPTED == context->msgstate)) | 2540 | else if (context && (OTRL_MSGSTATE_ENCRYPTED == context->msgstate)) |
2531 | { | 2541 | { |
2532 | // combo->removeall(); | ||
2533 | // combo->add(getString("otr_refresh_entry"), ADD_BOTTOM, TRUE); | ||
2534 | // combo->add(getString("otr_stop_entry"), ADD_BOTTOM, TRUE); | ||
2535 | // combo->add(getString("otr_auth_entry"), ADD_BOTTOM, TRUE); | ||
2536 | // combo->add(getString("otr_help_entry"), ADD_BOTTOM, TRUE); | ||
2537 | // combo->add(getString("otr_levels_entry"), ADD_BOTTOM, TRUE); | ||
2538 | if (otherIsOtrAuthenticated()) | 2542 | if (otherIsOtrAuthenticated()) |
2539 | combo->setLabel(getString("otr_private")); | 2543 | combo->setLabel(getString("otr_private")); |
2540 | else | 2544 | else |
@@ -2549,22 +2553,10 @@ void LLFloaterIMPanel::showOtrStatus() | |||
2549 | else | 2553 | else |
2550 | otrLogMessageGetstringName("otr_prog_they_stop_unverified"); | 2554 | otrLogMessageGetstringName("otr_prog_they_stop_unverified"); |
2551 | } | 2555 | } |
2552 | // combo->removeall(); | ||
2553 | // combo->add(getString("otr_restart_entry"), ADD_BOTTOM, TRUE); | ||
2554 | // combo->add(getString("otr_stop_entry"), ADD_BOTTOM, TRUE); | ||
2555 | // combo->add(getString("otr_auth_entry"), ADD_BOTTOM, FALSE); | ||
2556 | // combo->add(getString("otr_help_entry"), ADD_BOTTOM, TRUE); | ||
2557 | // combo->add(getString("otr_levels_entry"), ADD_BOTTOM, TRUE); | ||
2558 | combo->setLabel(getString("otr_finished")); | 2556 | combo->setLabel(getString("otr_finished")); |
2559 | } | 2557 | } |
2560 | else // OTRL_MSGSTATE_PLAINTEXT, or no context yet | 2558 | else // OTRL_MSGSTATE_PLAINTEXT, or no context yet |
2561 | { | 2559 | { |
2562 | // combo->removeall(); | ||
2563 | // combo->add(getString("otr_start_entry"), ADD_BOTTOM, TRUE); | ||
2564 | // combo->add(getString("otr_stop_entry"), ADD_BOTTOM, FALSE); | ||
2565 | // combo->add(getString("otr_auth_entry"), ADD_BOTTOM, FALSE); | ||
2566 | // combo->add(getString("otr_help_entry"), ADD_BOTTOM, TRUE); | ||
2567 | // combo->add(getString("otr_levels_entry"), ADD_BOTTOM, TRUE); | ||
2568 | combo->setLabel(getString("otr_not_private")); | 2560 | combo->setLabel(getString("otr_not_private")); |
2569 | } | 2561 | } |
2570 | if (context) | 2562 | if (context) |