1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/**
* @file floaterotr.cpp
* @brief Custom OTR settings for meta-impy
*
* $LicenseInfo:firstyear=2009&license=viewergpl$
*
* Copyright (c) 2011, David Seikel
*
* meta-impy Viewer Source Code
* The source code in this file ("Source Code") is provided to you
* under the terms of the GNU General Public License, version 2.0
* ("GPL"). Terms of the GPL can be found in doc/GPL-license.txt in
* this distribution, or online at
* http://secondlifegrid.net/programs/open_source/licensing/gplv2
*
* There are special exceptions to the terms and conditions of the GPL as
* it is applied to this Source Code. View the full text of the exception
* in the file doc/FLOSS-exception.txt in this software distribution, or
* online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
*
* By copying, modifying or distributing this software, you acknowledge
* that you have read and understood your obligations described above,
* and agree to abide by those obligations.
*
* ALL SOURCE CODE IS PROVIDED "AS IS." THE AUTHOR MAKES NO
* WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*
* Copied from floaterbusy.cpp, originally by McCabe Maxsted from Imprudence.
*/
#include "llviewerprecompiledheaders.h"
#include "floaterotr.h"
#include "llinventorymodel.h"
#include "llstartup.h"
#include "lltexteditor.h"
#include "lluictrlfactory.h"
#include "llviewercontrol.h"
#include "llviewerinventory.h"
#include "llweb.h"
#include "otr_wrapper.h"
FloaterOTR::FloaterOTR(const LLSD& seed) : LLFloater("floater_busy")
{
LLUICtrlFactory::getInstance()->buildFloater(this, "floater_otr_options.xml");
}
BOOL FloaterOTR::postBuild()
{
childSetAction("btn_ok", onClickOK, this);
childSetAction("btn_cancel", onClickCancel, this);
childSetValue("EmeraldUseOTR", LLSD((S32)gSavedSettings.getU32("EmeraldUseOTR")));
childSetValue("EmeraldUseOTRInTypingStop", gSavedSettings.getBOOL("EmeraldUseOTRInTypingStop"));
getChild<LLButton>("otr_help_btn")->setClickedCallback(onClickOtrHelp, this);
return TRUE;
}
FloaterOTR::~FloaterOTR()
{
}
// static
void FloaterOTR::onClickOK(void* userdata)
{
FloaterOTR* self = (FloaterOTR*)userdata;
self->apply();
self->close();
}
// static
void FloaterOTR::onClickCancel(void* userdata)
{
FloaterOTR* self = (FloaterOTR*)userdata;
self->cancel();
}
void FloaterOTR::cancel()
{
close();
}
void FloaterOTR::apply()
{
U32 otrpref = childGetValue("EmeraldUseOTR").asReal();
gSavedSettings.setU32("EmeraldUseOTR", otrpref);
gSavedSettings.setBOOL("EmeraldUseOTRInTypingStop", childGetValue("EmeraldUseOTRInTypingStop").asBoolean());
// otrpref: 0 == Require OTR, 1 == Request OTR, 2 == Accept OTR, 3 == Decline OTR
if (3 == otrpref)
OTR_Wrapper::stopAll();
}
void FloaterOTR::onClickOtrHelp(void* userdata)
{
LLWeb::loadURL("http://www.cypherpunks.ca/otr/");
}
|