diff options
author | Jay Threeth | 2011-04-02 18:56:23 -0700 |
---|---|---|
committer | Jay Threeth | 2011-04-02 18:56:23 -0700 |
commit | 93cdc938be59db040fa2eb26c478d2328c34da7b (patch) | |
tree | f4f25b9c7343787fe0bb2b3c39efd1362763b376 /linden/indra | |
parent | Merge branch 'exp' of github.com:onefang/meta-impy into libotr (diff) | |
download | meta-impy-93cdc938be59db040fa2eb26c478d2328c34da7b.zip meta-impy-93cdc938be59db040fa2eb26c478d2328c34da7b.tar.gz meta-impy-93cdc938be59db040fa2eb26c478d2328c34da7b.tar.bz2 meta-impy-93cdc938be59db040fa2eb26c478d2328c34da7b.tar.xz |
checkpoint, non functional
Diffstat (limited to '')
21 files changed, 1883 insertions, 2 deletions
diff --git a/linden/indra/cmake/gpg.vs.cmake b/linden/indra/cmake/gpg.vs.cmake new file mode 100644 index 0000000..a5220f4 --- /dev/null +++ b/linden/indra/cmake/gpg.vs.cmake | |||
@@ -0,0 +1,6 @@ | |||
1 | # -*- cmake -*- | ||
2 | |||
3 | # gpg.vs is just a place to put windows specific nastyness needed to | ||
4 | # make the libgcrypt, libgpg-error, and libotr compile. | ||
5 | |||
6 | set(gpg.vs_INCLUDE_DIRS ) | ||
diff --git a/linden/indra/cmake/libgcrypt.cmake b/linden/indra/cmake/libgcrypt.cmake new file mode 100644 index 0000000..0134618 --- /dev/null +++ b/linden/indra/cmake/libgcrypt.cmake | |||
@@ -0,0 +1,8 @@ | |||
1 | # -*- cmake -*- | ||
2 | |||
3 | set(LIBGCRYPT_INCLUDE_DIRS | ||
4 | ) | ||
5 | |||
6 | set(LIBGCRYPT_LIBRARIES | ||
7 | libgcrypt | ||
8 | ) | ||
diff --git a/linden/indra/cmake/libgpg-error.cmake b/linden/indra/cmake/libgpg-error.cmake new file mode 100644 index 0000000..71deeaa --- /dev/null +++ b/linden/indra/cmake/libgpg-error.cmake | |||
@@ -0,0 +1,8 @@ | |||
1 | # -*- cmake -*- | ||
2 | |||
3 | set(LIBGPG-ERROR_INCLUDE_DIRS | ||
4 | ) | ||
5 | |||
6 | set(LIBGPG-ERROR_LIBRARIES | ||
7 | libgpg-error | ||
8 | ) | ||
diff --git a/linden/indra/cmake/libotr.cmake b/linden/indra/cmake/libotr.cmake new file mode 100644 index 0000000..3c07be2 --- /dev/null +++ b/linden/indra/cmake/libotr.cmake | |||
@@ -0,0 +1,8 @@ | |||
1 | # -*- cmake -*- | ||
2 | |||
3 | set(LIBOTR_INCLUDE_DIRS | ||
4 | ) | ||
5 | |||
6 | set(LIBOTR_LIBRARIES | ||
7 | libotr | ||
8 | ) | ||
diff --git a/linden/indra/cmake/libotrb.cmake b/linden/indra/cmake/libotrb.cmake new file mode 100644 index 0000000..eb8522f --- /dev/null +++ b/linden/indra/cmake/libotrb.cmake | |||
@@ -0,0 +1,4 @@ | |||
1 | # -*- cmake -*- | ||
2 | include(Prebuilt) | ||
3 | |||
4 | set(OTR_LIBRARY otr) | ||
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index b6858b7..e55684a 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml | |||
@@ -198,6 +198,30 @@ | |||
198 | <key>Value</key> | 198 | <key>Value</key> |
199 | <integer>0</integer> | 199 | <integer>0</integer> |
200 | </map> | 200 | </map> |
201 | <!--[$PLOTR$]--> | ||
202 | <key>EmeraldUseOTR</key> | ||
203 | <map> | ||
204 | <key>Comment</key> | ||
205 | <string>Setting this to 0 will require the use of OTR in every IM, 1 will try OTR when available, 2 will accept incoming OTR requests, and 3 will deny OTR usage</string> | ||
206 | <key>Persist</key> | ||
207 | <integer>1</integer> | ||
208 | <key>Type</key> | ||
209 | <string>U32</string> | ||
210 | <key>Value</key> | ||
211 | <integer>2</integer> | ||
212 | </map> | ||
213 | <key>EmeraldOTRInTypingStop</key> | ||
214 | <map> | ||
215 | <key>Comment</key> | ||
216 | <string>Setting this to true will make all encrypted OTR messages be sent in an IM_TYPING_STOP packet. This is non-standard behavior, but prevents OTR encrypted IM from being saved and delivered as offline IM. Though it currently works the grid owners may decide to disable the feature at any time.</string> | ||
217 | <key>Persist</key> | ||
218 | <integer>1</integer> | ||
219 | <key>Type</key> | ||
220 | <string>Boolean</string> | ||
221 | <key>Value</key> | ||
222 | <integer>0</integer> | ||
223 | </map> | ||
224 | <!--[$PLOTR$/]--> | ||
201 | <key>AppearanceAnimate</key> | 225 | <key>AppearanceAnimate</key> |
202 | <map> | 226 | <map> |
203 | <key>Comment</key> | 227 | <key>Comment</key> |
@@ -5644,6 +5668,40 @@ | |||
5644 | <integer>0</integer> | 5668 | <integer>0</integer> |
5645 | </array> | 5669 | </array> |
5646 | </map> | 5670 | </map> |
5671 | <!--[$PLOTR$]--> | ||
5672 | <key>OtrFloaterSmpDialogRect</key> | ||
5673 | <map> | ||
5674 | <key>Comment</key> | ||
5675 | <string>Rectangle for OTR's Authorize Buddy Dialog</string> | ||
5676 | <key>Persist</key> | ||
5677 | <integer>1</integer> | ||
5678 | <key>Type</key> | ||
5679 | <string>Rect</string> | ||
5680 | <key>Value</key> | ||
5681 | <array> | ||
5682 | <integer>0</integer> | ||
5683 | <integer>440</integer> | ||
5684 | <integer>470</integer> | ||
5685 | <integer>0</integer> | ||
5686 | </array> | ||
5687 | </map> | ||
5688 | <key>OtrFloaterSmpProgRect</key> | ||
5689 | <map> | ||
5690 | <key>Comment</key> | ||
5691 | <string>Rectangle for OTR's Authorize Buddy Progress bar Dialog</string> | ||
5692 | <key>Persist</key> | ||
5693 | <integer>1</integer> | ||
5694 | <key>Type</key> | ||
5695 | <string>Rect</string> | ||
5696 | <key>Value</key> | ||
5697 | <array> | ||
5698 | <integer>0</integer> | ||
5699 | <integer>440</integer> | ||
5700 | <integer>470</integer> | ||
5701 | <integer>0</integer> | ||
5702 | </array> | ||
5703 | </map> | ||
5704 | <!--[$PLOTR$/]--> | ||
5647 | <key>FloaterActiveSpeakersRect</key> | 5705 | <key>FloaterActiveSpeakersRect</key> |
5648 | <map> | 5706 | <map> |
5649 | <key>Comment</key> | 5707 | <key>Comment</key> |
@@ -13805,6 +13863,19 @@ | |||
13805 | <key>Value</key> | 13863 | <key>Value</key> |
13806 | <integer>1</integer> | 13864 | <integer>1</integer> |
13807 | </map> | 13865 | </map> |
13866 | <!--[$PLOTR$]--> | ||
13867 | <key>WarnEmeraldOTR</key> | ||
13868 | <map> | ||
13869 | <key>Comment</key> | ||
13870 | <string>Enables OTR info dialog</string> | ||
13871 | <key>Persist</key> | ||
13872 | <integer>1</integer> | ||
13873 | <key>Type</key> | ||
13874 | <string>Boolean</string> | ||
13875 | <key>Value</key> | ||
13876 | <integer>1</integer> | ||
13877 | </map> | ||
13878 | <!--[$PLOTR$/]--> | ||
13808 | <key>WarnFirstAppearance</key> | 13879 | <key>WarnFirstAppearance</key> |
13809 | <map> | 13880 | <map> |
13810 | <key>Comment</key> | 13881 | <key>Comment</key> |
diff --git a/linden/indra/newview/llfirstuse.h b/linden/indra/newview/llfirstuse.h index 8c2ca35..c7a3634 100644 --- a/linden/indra/newview/llfirstuse.h +++ b/linden/indra/newview/llfirstuse.h | |||
@@ -115,6 +115,10 @@ public: | |||
115 | static void useLoginScreen(); | 115 | static void useLoginScreen(); |
116 | static void callbackClientTags(const LLSD& notification, const LLSD& response); | 116 | static void callbackClientTags(const LLSD& notification, const LLSD& response); |
117 | static void ClientTags(); | 117 | static void ClientTags(); |
118 | #if USE_OTR // [$PLOTR$] | ||
119 | static void callbackEmeraldOTR(const LLSD& notification, const LLSD& response); | ||
120 | static void EmeraldOTR(); | ||
121 | #endif // USE_OTR // [/$PLOTR$] | ||
118 | static void voiceLicenseAgreement(); | 122 | static void voiceLicenseAgreement(); |
119 | static void callbackPrivacy(const LLSD& notification, const LLSD& response); | 123 | static void callbackPrivacy(const LLSD& notification, const LLSD& response); |
120 | static void Privacy(); | 124 | static void Privacy(); |
diff --git a/linden/indra/newview/llimpanel.h b/linden/indra/newview/llimpanel.h index b5a0165..5a36648 100644 --- a/linden/indra/newview/llimpanel.h +++ b/linden/indra/newview/llimpanel.h | |||
@@ -42,6 +42,12 @@ | |||
42 | #include "llvoiceclient.h" | 42 | #include "llvoiceclient.h" |
43 | #include "llstyle.h" | 43 | #include "llstyle.h" |
44 | 44 | ||
45 | #if USE_OTR // [$PLOTR$] | ||
46 | # include "otr_wrapper.h" | ||
47 | class OtrFloaterSmpDialog; | ||
48 | class OtrFloaterSmpProgress; | ||
49 | #endif // USE_OTR // [/$PLOTR$] | ||
50 | |||
45 | class LLLineEditor; | 51 | class LLLineEditor; |
46 | class LLViewerTextEditor; | 52 | class LLViewerTextEditor; |
47 | class LLInventoryItem; | 53 | class LLInventoryItem; |
@@ -175,6 +181,22 @@ private: | |||
175 | BOOL mReceivedCall; | 181 | BOOL mReceivedCall; |
176 | }; | 182 | }; |
177 | 183 | ||
184 | #if USE_OTR // [$PLOTR$] | ||
185 | extern void otr_authenticate_key(LLUUID session_id, const char *trust); | ||
186 | extern void otr_log_message_getstring_name(LLUUID session_id, const char *message_name); | ||
187 | extern void otr_log_message_getstring(LLUUID session_id, const char *message_name); | ||
188 | extern void otr_log_message(LLUUID session_id, const char *message); | ||
189 | extern void otr_show_status(LLUUID session_id); | ||
190 | extern void otr_deliver_message(const std::string& utf8_text, | ||
191 | const LLUUID& im_session_id, | ||
192 | const LLUUID& other_participant_id, | ||
193 | EInstantMessage dialog); | ||
194 | extern void deliver_message(const std::string& utf8_text, | ||
195 | const LLUUID& im_session_id, | ||
196 | const LLUUID& other_participant_id, | ||
197 | EInstantMessage dialog); | ||
198 | #endif // USE_OTR // [/$PLOTR$] | ||
199 | |||
178 | class LLFloaterIMPanel : public LLFloater | 200 | class LLFloaterIMPanel : public LLFloater |
179 | { | 201 | { |
180 | public: | 202 | public: |
@@ -299,7 +321,43 @@ private: | |||
299 | void removeTypingIndicator(const LLIMInfo* im_info); | 321 | void removeTypingIndicator(const LLIMInfo* im_info); |
300 | 322 | ||
301 | void sendTypingState(BOOL typing); | 323 | void sendTypingState(BOOL typing); |
302 | 324 | ||
325 | #if USE_OTR // [$PLOTR$] | ||
326 | public: | ||
327 | static void onClickOtr(LLUICtrl* source, void* userdata); | ||
328 | void doOtrMenu(); | ||
329 | void showOtrStatus(); | ||
330 | void otrLogMessage(std::string message); | ||
331 | void otrLogMessageGetstring(const char *message_name); | ||
332 | void otrLogMessageGetstringName(const char *message_name); | ||
333 | bool otherIsOtrAuthenticated(); | ||
334 | void otrAuthenticateKey(const char *trust); | ||
335 | void doOtrStart(); | ||
336 | void doOtrStop(bool pretend_they_did=false); | ||
337 | void pretendTheyOtrStop(); | ||
338 | ConnContext *getOtrContext(int add_if_not = 0, int *context_added = NULL); | ||
339 | void startSmpProgress(LLUUID session_id, LLUUID other_id, | ||
340 | std::string a_question, std::string a_secret_answer, | ||
341 | bool is_reply = false); | ||
342 | void startSmpProgress(LLUUID session_id, LLUUID other_id, | ||
343 | std::string a_secret, | ||
344 | bool is_reply = false); | ||
345 | void endSmpProgress(); | ||
346 | void endSmpDialog(); | ||
347 | void handleOtrTlvs(OtrlTLV *tlvs); | ||
348 | private: | ||
349 | void startSmpDialog(LLUUID session_id, LLUUID other_id, | ||
350 | std::string my_fingerprint, std::string other_fingerprint); | ||
351 | void startSmpDialogQA(LLUUID session_id, LLUUID other_id, | ||
352 | std::string question, OtrlTLV *tlv); | ||
353 | void startSmpDialogSS(LLUUID session_id, LLUUID other_id, | ||
354 | OtrlTLV *tlv); | ||
355 | void doOtrAuth(); | ||
356 | OtrlMessageState mOtrLastStatus; | ||
357 | OtrFloaterSmpDialog *mOtrSmpDialog; | ||
358 | OtrFloaterSmpProgress *mOtrSmpProgress; | ||
359 | #endif // USE_OTR // [/$PLOTR$] | ||
360 | |||
303 | private: | 361 | private: |
304 | LLLineEditor* mInputEditor; | 362 | LLLineEditor* mInputEditor; |
305 | LLViewerTextEditor* mHistoryEditor; | 363 | LLViewerTextEditor* mHistoryEditor; |
diff --git a/linden/indra/newview/llprefsadvanced.cpp b/linden/indra/newview/llprefsadvanced.cpp index 99bc4fd..17f7b09 100644 --- a/linden/indra/newview/llprefsadvanced.cpp +++ b/linden/indra/newview/llprefsadvanced.cpp | |||
@@ -47,6 +47,10 @@ | |||
47 | 47 | ||
48 | #include "boost/algorithm/string.hpp" | 48 | #include "boost/algorithm/string.hpp" |
49 | 49 | ||
50 | #if USE_OTR // [$PLOTR$] | ||
51 | #include "llweb.h" | ||
52 | #endif // USE_OTR // [/$PLOTR$] | ||
53 | |||
50 | LLPrefsAdvanced* LLPrefsAdvanced::sInstance; | 54 | LLPrefsAdvanced* LLPrefsAdvanced::sInstance; |
51 | 55 | ||
52 | LLPrefsAdvanced::LLPrefsAdvanced() | 56 | LLPrefsAdvanced::LLPrefsAdvanced() |
@@ -116,6 +120,11 @@ BOOL LLPrefsAdvanced::postBuild() | |||
116 | 120 | ||
117 | initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck"); | 121 | initHelpBtn("EmeraldHelp_SpellCheck", "EmeraldHelp_SpellCheck"); |
118 | 122 | ||
123 | #if USE_OTR // [$PLOTR$] | ||
124 | childSetValue("EmeraldUseOTR", LLSD((S32)gSavedSettings.getU32("EmeraldUseOTR"))); | ||
125 | getChild<LLButton>("otr_help_btn")->setClickedCallback(onClickOtrHelp, this); | ||
126 | #endif // USE_OTR // [/$PLOTR$] | ||
127 | |||
119 | refresh(); | 128 | refresh(); |
120 | 129 | ||
121 | return TRUE; | 130 | return TRUE; |
@@ -202,6 +211,9 @@ void LLPrefsAdvanced::apply() | |||
202 | 211 | ||
203 | LLComboBox* crash_behavior_combobox = getChild<LLComboBox>("crash_behavior_combobox"); | 212 | LLComboBox* crash_behavior_combobox = getChild<LLComboBox>("crash_behavior_combobox"); |
204 | gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, crash_behavior_combobox->getCurrentIndex()); | 213 | gCrashSettings.setS32(CRASH_BEHAVIOR_SETTING, crash_behavior_combobox->getCurrentIndex()); |
214 | #if USE_OTR // [$PLOTR$] | ||
215 | gSavedSettings.setU32("EmeraldUseOTR", (U32)childGetValue("EmeraldUseOTR").asReal()); | ||
216 | #endif // USE_OTR // [/$PLOTR$] | ||
205 | } | 217 | } |
206 | 218 | ||
207 | void LLPrefsAdvanced::cancel() | 219 | void LLPrefsAdvanced::cancel() |
@@ -349,3 +361,10 @@ void LLPrefsAdvanced::onClickCommandLine(void* data) | |||
349 | FloaterCommandLine::getInstance()->open(); | 361 | FloaterCommandLine::getInstance()->open(); |
350 | FloaterCommandLine::getInstance()->center(); | 362 | FloaterCommandLine::getInstance()->center(); |
351 | } | 363 | } |
364 | |||
365 | #if USE_OTR // [$PLOTR$] | ||
366 | void LLPrefsAdvanced::onClickOtrHelp(void* data) | ||
367 | { | ||
368 | LLWeb::loadURL("http://www.cypherpunks.ca/otr/"); | ||
369 | } | ||
370 | #endif // USE_OTR // [/$PLOTR$] | ||
diff --git a/linden/indra/newview/llstartup.cpp b/linden/indra/newview/llstartup.cpp index d9ab5e7..d13e112 100644 --- a/linden/indra/newview/llstartup.cpp +++ b/linden/indra/newview/llstartup.cpp | |||
@@ -215,6 +215,10 @@ | |||
215 | #include "hippogridmanager.h" | 215 | #include "hippogridmanager.h" |
216 | #include "hippolimits.h" | 216 | #include "hippolimits.h" |
217 | 217 | ||
218 | #if USE_OTR // [$PLOTR$] | ||
219 | #include "otr_wrapper.h" | ||
220 | #endif // USE_OTR // [/$PLOTR$] | ||
221 | |||
218 | #include "lggautocorrect.h" | 222 | #include "lggautocorrect.h" |
219 | // | 223 | // |
220 | // exported globals | 224 | // exported globals |
@@ -2825,6 +2829,9 @@ bool idle_startup() | |||
2825 | } | 2829 | } |
2826 | 2830 | ||
2827 | LLFirstUse::ClientTags(); | 2831 | LLFirstUse::ClientTags(); |
2832 | #if USE_OTR // [$PLOTR$] | ||
2833 | LLFirstUse::EmeraldOTR(); | ||
2834 | #endif // USE_OTR // [/$PLOTR$] | ||
2828 | 2835 | ||
2829 | // Add login location to teleport history 'teleported-into' | 2836 | // Add login location to teleport history 'teleported-into' |
2830 | LLVector3 agent_pos=gAgent.getPositionAgent(); | 2837 | LLVector3 agent_pos=gAgent.getPositionAgent(); |
@@ -2867,7 +2874,11 @@ bool idle_startup() | |||
2867 | { | 2874 | { |
2868 | gAgent.requestEnterGodMode(); | 2875 | gAgent.requestEnterGodMode(); |
2869 | } | 2876 | } |
2870 | 2877 | ||
2878 | #if USE_OTR // [$PLOTR$] | ||
2879 | OTR_Wrapper::init(); | ||
2880 | #endif // USE_OTR // [/$PLOTR$] | ||
2881 | |||
2871 | // Start automatic replay if the flag is set. | 2882 | // Start automatic replay if the flag is set. |
2872 | if (gSavedSettings.getBOOL("StatsAutoRun")) | 2883 | if (gSavedSettings.getBOOL("StatsAutoRun")) |
2873 | { | 2884 | { |
diff --git a/linden/indra/newview/otr_floater_smp_dialog.cpp b/linden/indra/newview/otr_floater_smp_dialog.cpp new file mode 100644 index 0000000..06acdae --- /dev/null +++ b/linden/indra/newview/otr_floater_smp_dialog.cpp | |||
@@ -0,0 +1,438 @@ | |||
1 | /* otr_floater_smp_dialog.cpp - SMP dialog box | ||
2 | $PLOTR$ See http://www.cypherpunks.ca/otr/ | ||
3 | |||
4 | Copyright (C) 2009 Chris Tuchs | ||
5 | |||
6 | This is free software; you can redistribute it and/or modify it | ||
7 | under the terms of the GNU Lesser General Public License as | ||
8 | published by the Free Software Foundation; either version 2.1 of | ||
9 | the License, or (at your option) any later version. | ||
10 | |||
11 | This is distributed in the hope that it will be useful, but WITHOUT | ||
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
13 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
14 | License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public | ||
17 | License along with the viewer; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
19 | 02111-1307, USA. */ | ||
20 | |||
21 | #include "llviewerprecompiledheaders.h" | ||
22 | |||
23 | #include "llagent.h" | ||
24 | #include "llcachename.h" | ||
25 | #include "llcombobox.h" | ||
26 | #include "llimpanel.h" | ||
27 | #include "lluictrlfactory.h" | ||
28 | #include "llweb.h" | ||
29 | |||
30 | #include "otr_floater_smp_progress.h" | ||
31 | #include "otr_floater_smp_dialog.h" | ||
32 | |||
33 | std::string OtrFloaterSmpDialog::getStringName(const char *message_name) | ||
34 | { | ||
35 | LLUIString message = getString(message_name); | ||
36 | std::string them; | ||
37 | if (!gCacheName->getFullName(mOtherParticipantUUID, them)) them = getString("otr_generic_name"); | ||
38 | message.setArg("[NAME]", them); | ||
39 | return message.getString(); | ||
40 | } | ||
41 | |||
42 | void OtrFloaterSmpDialog::init() | ||
43 | { | ||
44 | LLUICtrlFactory::getInstance()->buildFloater(this, "otr_floater_smp_dialog.xml"); | ||
45 | } | ||
46 | |||
47 | OtrFloaterSmpDialog::OtrFloaterSmpDialog( | ||
48 | LLFloaterIMPanel *im_panel, LLUUID session_id, LLUUID other_id, | ||
49 | std::string my_fingerprint, std::string other_fingerprint) | ||
50 | : LLFloater(std::string("otr_floater_smp_dialog"), std::string("OtrFloaterSmpDialogRect"), LLStringUtil::null), | ||
51 | mIMPanel(im_panel), mIsReply(false), | ||
52 | mSessionUUID(session_id), mOtherParticipantUUID(other_id), | ||
53 | mQuestion(""), | ||
54 | mMyFingerprint(my_fingerprint), mOtherFingerprint(other_fingerprint) | ||
55 | { | ||
56 | init(); | ||
57 | } | ||
58 | |||
59 | OtrFloaterSmpDialog::OtrFloaterSmpDialog( | ||
60 | LLFloaterIMPanel *im_panel, LLUUID session_id, LLUUID other_id, | ||
61 | std::string question, OtrlTLV *tlv) | ||
62 | : LLFloater(std::string("otr_floater_smp_dialog"), std::string("OtrFloaterSmpDialogRect"), LLStringUtil::null), | ||
63 | mIMPanel(im_panel), mIsReply(true), | ||
64 | mSessionUUID(session_id), mOtherParticipantUUID(other_id), | ||
65 | mQuestion(question), | ||
66 | mMyFingerprint(""), mOtherFingerprint("") | ||
67 | { | ||
68 | init(); | ||
69 | LLComboBox *combo = getChild<LLComboBox>("otr_smp_how_combo"); | ||
70 | if (!combo) | ||
71 | { | ||
72 | llwarns << "$PLOTR$ Can't find OTR SMP how combo" << llendl; | ||
73 | return; | ||
74 | } | ||
75 | combo->removeall(); | ||
76 | combo->add(getString("otr_smp_how_by_qa_challenge"), ADD_BOTTOM, TRUE); | ||
77 | combo->selectFirstItem(); | ||
78 | doComboMenu(); | ||
79 | } | ||
80 | |||
81 | OtrFloaterSmpDialog::OtrFloaterSmpDialog( | ||
82 | LLFloaterIMPanel *im_panel, LLUUID session_id, LLUUID other_id, | ||
83 | OtrlTLV *tlv) | ||
84 | : LLFloater(std::string("otr_floater_smp_dialog"), std::string("OtrFloaterSmpDialogRect"), LLStringUtil::null), | ||
85 | mIMPanel(im_panel), mIsReply(true), | ||
86 | mSessionUUID(session_id), mOtherParticipantUUID(other_id), | ||
87 | mQuestion(""), | ||
88 | mMyFingerprint(""), mOtherFingerprint("") | ||
89 | { | ||
90 | init(); | ||
91 | LLComboBox *combo = getChild<LLComboBox>("otr_smp_how_combo"); | ||
92 | if (!combo) | ||
93 | { | ||
94 | llwarns << "$PLOTR$ Can't find OTR SMP how combo" << llendl; | ||
95 | return; | ||
96 | } | ||
97 | combo->removeall(); | ||
98 | combo->add(getString("otr_smp_how_by_ss_challenge"), ADD_BOTTOM, TRUE); | ||
99 | combo->selectFirstItem(); | ||
100 | doComboMenu(); | ||
101 | } | ||
102 | |||
103 | OtrFloaterSmpDialog::~OtrFloaterSmpDialog() | ||
104 | { | ||
105 | } | ||
106 | |||
107 | BOOL OtrFloaterSmpDialog::postBuild() | ||
108 | { | ||
109 | childSetAction("otr_smp_help_btn", onClickHelp, this); | ||
110 | childSetAction("otr_smp_cancel_btn", onClickCancel, this); | ||
111 | childSetAction("otr_smp_auth_btn", onClickAuth, this); | ||
112 | LLComboBox *veri = getChild<LLComboBox>("otr_smp_veri_combo"); | ||
113 | veri->setCommitCallback(onClickVeri); | ||
114 | veri->setCallbackUserData(this); | ||
115 | LLComboBox *combo = getChild<LLComboBox>("otr_smp_how_combo"); | ||
116 | combo->setCommitCallback(onClickCombo); | ||
117 | combo->setCallbackUserData(this); | ||
118 | combo->removeall(); | ||
119 | combo->add(getString("otr_smp_how_by_qa"), ADD_BOTTOM, TRUE); | ||
120 | combo->add(getString("otr_smp_how_by_ss"), ADD_BOTTOM, TRUE); | ||
121 | combo->add(getString("otr_smp_how_by_mfv"), ADD_BOTTOM, TRUE); | ||
122 | combo->selectFirstItem(); | ||
123 | doComboMenu(); | ||
124 | LLTextBox *why = getChild<LLTextBox>("otr_smp_why"); | ||
125 | if (why) why->setWrappedText(getString("otr_smp_why_text")); | ||
126 | LLTextBox *how = getChild<LLTextBox>("otr_smp_how_text"); | ||
127 | if (mIsReply) | ||
128 | { | ||
129 | if (how) how->setWrappedText(getStringName("otr_smp_how_name_challenge_me")); | ||
130 | setTitle(getStringName("otr_smp_name_auth_me")); | ||
131 | } | ||
132 | else | ||
133 | { | ||
134 | if (how) how->setWrappedText(getStringName("otr_smp_how_I_challenge_name")); | ||
135 | setTitle(getStringName("otr_smp_I_auth_name")); | ||
136 | } | ||
137 | return TRUE; | ||
138 | } | ||
139 | |||
140 | void OtrFloaterSmpDialog::show() | ||
141 | { | ||
142 | this->open(); /*Flawfinder: ignore*/ | ||
143 | this->setFocus(TRUE); | ||
144 | this->center(); | ||
145 | } | ||
146 | |||
147 | void OtrFloaterSmpDialog::doVeriMenu() | ||
148 | { | ||
149 | LLComboBox *veri = getChild<LLComboBox>("otr_smp_veri_combo"); | ||
150 | if (!veri) | ||
151 | { | ||
152 | llwarns << "$PLOTR$ Can't find OTR SMP verified combo" << llendl; | ||
153 | return; | ||
154 | } | ||
155 | LLButton* auth_btn = getChild<LLButton>("otr_smp_auth_btn"); | ||
156 | if (!auth_btn) | ||
157 | { | ||
158 | llwarns << "$PLOTR$ Can't find OTR SMP authenticate button" << llendl; | ||
159 | return; | ||
160 | } | ||
161 | if (getString("otr_smp_veri_no") == veri->getSimple()) | ||
162 | { | ||
163 | auth_btn->setEnabled(FALSE); | ||
164 | } | ||
165 | else | ||
166 | { | ||
167 | auth_btn->setEnabled(TRUE); | ||
168 | } | ||
169 | } | ||
170 | |||
171 | void OtrFloaterSmpDialog::doComboMenu() | ||
172 | { | ||
173 | LLComboBox *combo = getChild<LLComboBox>("otr_smp_how_combo"); | ||
174 | if (!combo) | ||
175 | { | ||
176 | llwarns << "$PLOTR$ Can't find OTR SMP how combo" << llendl; | ||
177 | return; | ||
178 | } | ||
179 | LLTextBox *howto = getChild<LLTextBox>("otr_smp_howto"); | ||
180 | if (!howto) | ||
181 | { | ||
182 | llwarns << "$PLOTR$ Can't find OTR SMP howto control" << llendl; | ||
183 | return; | ||
184 | } | ||
185 | LLTextBox *label1 = getChild<LLTextBox>("otr_smp_label1"); | ||
186 | if (!label1) | ||
187 | { | ||
188 | llwarns << "$PLOTR$ Can't find OTR SMP label1 control" << llendl; | ||
189 | return; | ||
190 | } | ||
191 | LLLineEditor *edit1 = getChild<LLLineEditor>("otr_smp_edit1"); | ||
192 | if (!edit1) | ||
193 | { | ||
194 | llwarns << "$PLOTR$ Can't find OTR SMP edit1 control" << llendl; | ||
195 | return; | ||
196 | } | ||
197 | LLTextBox *label2 = getChild<LLTextBox>("otr_smp_label2"); | ||
198 | if (!label2) | ||
199 | { | ||
200 | llwarns << "$PLOTR$ Can't find OTR SMP label2 control" << llendl; | ||
201 | return; | ||
202 | } | ||
203 | LLLineEditor *edit2 = getChild<LLLineEditor>("otr_smp_edit2"); | ||
204 | if (!edit2) | ||
205 | { | ||
206 | llwarns << "$PLOTR$ Can't find OTR SMP edit2 control" << llendl; | ||
207 | return; | ||
208 | } | ||
209 | LLComboBox *veri = getChild<LLComboBox>("otr_smp_veri_combo"); | ||
210 | if (!veri) | ||
211 | { | ||
212 | llwarns << "$PLOTR$ Can't find OTR SMP verified combo" << llendl; | ||
213 | return; | ||
214 | } | ||
215 | std::string choice = combo->getSimple(); | ||
216 | if (getString("otr_smp_how_by_qa") == choice) | ||
217 | { | ||
218 | howto->setWrappedText(getString("otr_smp_howto_qa")); | ||
219 | label1->setWrappedText(getString("otr_smp_howto_qa_t1")); | ||
220 | edit1->clear(); | ||
221 | edit1->setEnabled(TRUE); | ||
222 | label2->setWrappedText(getString("otr_smp_howto_qa_t2")); | ||
223 | edit2->clear(); | ||
224 | edit2->setEnabled(TRUE); | ||
225 | veri->removeall(); | ||
226 | veri->setLabel(getString("otr_empty_string")); | ||
227 | } | ||
228 | else if (getString("otr_smp_how_by_qa_challenge") == choice) | ||
229 | { | ||
230 | howto->setWrappedText(getString("otr_smp_howto_qa")); | ||
231 | label1->setWrappedText(getString("otr_smp_howto_qa_t1")); | ||
232 | edit1->setText(mQuestion); | ||
233 | edit1->setEnabled(FALSE); | ||
234 | label2->setWrappedText(getString("otr_smp_howto_qa_t2")); | ||
235 | edit2->clear(); | ||
236 | edit2->setEnabled(TRUE); | ||
237 | veri->removeall(); | ||
238 | veri->setLabel(getString("otr_empty_string")); | ||
239 | } | ||
240 | else if (getString("otr_smp_how_by_ss") == choice) | ||
241 | { | ||
242 | howto->setWrappedText(getString("otr_smp_howto_ss")); | ||
243 | label1->setWrappedText(getString("otr_smp_howto_ss_t1")); | ||
244 | edit1->clear(); | ||
245 | edit1->setEnabled(TRUE); | ||
246 | label2->setWrappedText(getString("otr_smp_howto_ss_t2")); | ||
247 | edit2->clear(); | ||
248 | edit2->setEnabled(FALSE); | ||
249 | veri->removeall(); | ||
250 | veri->setLabel(getString("otr_empty_string")); | ||
251 | } | ||
252 | else if (getString("otr_smp_how_by_ss_challenge") == choice) | ||
253 | { | ||
254 | howto->setWrappedText(getString("otr_smp_howto_ss")); | ||
255 | label1->setWrappedText(getString("otr_smp_howto_ss_t1")); | ||
256 | edit1->clear(); | ||
257 | edit1->setEnabled(TRUE); | ||
258 | label2->setWrappedText(getString("otr_smp_howto_ss_t2")); | ||
259 | edit2->clear(); | ||
260 | edit2->setEnabled(FALSE); | ||
261 | veri->removeall(); | ||
262 | veri->setLabel(getString("otr_empty_string")); | ||
263 | } | ||
264 | else if (getString("otr_smp_how_by_mfv") == choice) | ||
265 | { | ||
266 | howto->setWrappedText(getString("otr_smp_howto_mfv")); | ||
267 | label1->setWrappedText(getString("otr_smp_howto_mfv_t1")); | ||
268 | edit1->setText(mMyFingerprint); | ||
269 | edit1->setEnabled(FALSE); | ||
270 | label2->setWrappedText(getString("otr_smp_howto_mfv_t2")); | ||
271 | edit2->setText(mOtherFingerprint); | ||
272 | edit2->setEnabled(FALSE); | ||
273 | veri->add(getString("otr_smp_veri_no"), ADD_BOTTOM, TRUE); | ||
274 | veri->add(getString("otr_smp_veri_yes"), ADD_BOTTOM, TRUE); | ||
275 | veri->selectFirstItem(); | ||
276 | } | ||
277 | else | ||
278 | { | ||
279 | llwarns << "$PLOTR$ unknown smp howto choice" << llendl; | ||
280 | } | ||
281 | doVeriMenu(); | ||
282 | } | ||
283 | |||
284 | // static | ||
285 | void OtrFloaterSmpDialog::onClickCombo(LLUICtrl* source, void* userdata) | ||
286 | { | ||
287 | OtrFloaterSmpDialog* self = (OtrFloaterSmpDialog*)userdata; | ||
288 | if (!self) | ||
289 | { | ||
290 | llwarns << "$PLOTR$ can't find OTR SMP dialog." << llendl; | ||
291 | } | ||
292 | else | ||
293 | { | ||
294 | self->doComboMenu(); | ||
295 | } | ||
296 | } | ||
297 | |||
298 | // static | ||
299 | void OtrFloaterSmpDialog::onClickVeri(LLUICtrl* source, void* userdata) | ||
300 | { | ||
301 | OtrFloaterSmpDialog* self = (OtrFloaterSmpDialog*)userdata; | ||
302 | if (!self) | ||
303 | { | ||
304 | llwarns << "$PLOTR$ can't find OTR SMP dialog." << llendl; | ||
305 | } | ||
306 | else | ||
307 | { | ||
308 | self->doVeriMenu(); | ||
309 | } | ||
310 | } | ||
311 | |||
312 | // static | ||
313 | void OtrFloaterSmpDialog::onClickHelp(void*) | ||
314 | { | ||
315 | LLWeb::loadURL("http://www.cypherpunks.ca/otr/help/3.2.0/authenticate.php"); | ||
316 | } | ||
317 | |||
318 | // virtual | ||
319 | void OtrFloaterSmpDialog::onClose(bool app_quitting) | ||
320 | { | ||
321 | destroy(); | ||
322 | if (!mIMPanel) | ||
323 | { | ||
324 | llwarns << "$PLOTR$ Can't find mIMPanel." << llendl; | ||
325 | } | ||
326 | else | ||
327 | { | ||
328 | mIMPanel->endSmpDialog(); | ||
329 | } | ||
330 | } | ||
331 | |||
332 | // static | ||
333 | void OtrFloaterSmpDialog::onClickCancel(void* userdata) | ||
334 | { | ||
335 | OtrFloaterSmpDialog *self= (OtrFloaterSmpDialog*)userdata; | ||
336 | if (!self) | ||
337 | { | ||
338 | llwarns << "$PLOTR$ can't find OTR SMP dialog." << llendl; | ||
339 | return; | ||
340 | } | ||
341 | self->close(); | ||
342 | } | ||
343 | |||
344 | void OtrFloaterSmpDialog::doClickAuth() | ||
345 | { | ||
346 | LLComboBox *combo = getChild<LLComboBox>("otr_smp_how_combo"); | ||
347 | if (!combo) | ||
348 | { | ||
349 | llwarns << "$PLOTR$ Can't find OTR SMP how combo" << llendl; | ||
350 | return; | ||
351 | } | ||
352 | LLTextBox *howto = getChild<LLTextBox>("otr_smp_howto"); | ||
353 | if (!howto) | ||
354 | { | ||
355 | llwarns << "$PLOTR$ Can't find OTR SMP howto control" << llendl; | ||
356 | return; | ||
357 | } | ||
358 | LLTextBox *label1 = getChild<LLTextBox>("otr_smp_label1"); | ||
359 | if (!label1) | ||
360 | { | ||
361 | llwarns << "$PLOTR$ Can't find OTR SMP label1 control" << llendl; | ||
362 | return; | ||
363 | } | ||
364 | LLLineEditor *edit1 = getChild<LLLineEditor>("otr_smp_edit1"); | ||
365 | if (!edit1) | ||
366 | { | ||
367 | llwarns << "$PLOTR$ Can't find OTR SMP edit1 control" << llendl; | ||
368 | return; | ||
369 | } | ||
370 | LLTextBox *label2 = getChild<LLTextBox>("otr_smp_label2"); | ||
371 | if (!label2) | ||
372 | { | ||
373 | llwarns << "$PLOTR$ Can't find OTR SMP label2 control" << llendl; | ||
374 | return; | ||
375 | } | ||
376 | LLLineEditor *edit2 = getChild<LLLineEditor>("otr_smp_edit2"); | ||
377 | if (!edit2) | ||
378 | { | ||
379 | llwarns << "$PLOTR$ Can't find OTR SMP edit2 control" << llendl; | ||
380 | return; | ||
381 | } | ||
382 | LLComboBox *veri = getChild<LLComboBox>("otr_smp_veri_combo"); | ||
383 | if (!veri) | ||
384 | { | ||
385 | llwarns << "$PLOTR$ Can't find OTR SMP verified combo" << llendl; | ||
386 | return; | ||
387 | } | ||
388 | std::string choice = combo->getSimple(); | ||
389 | if (getString("otr_smp_how_by_qa") == choice) | ||
390 | { | ||
391 | llinfos << "$PLOTR$ OTR SMP QA method chosen" << llendl; | ||
392 | std::string question = edit1->getText(); | ||
393 | std::string answer = edit2->getText(); | ||
394 | mIMPanel->startSmpProgress(mSessionUUID, mOtherParticipantUUID, question, answer); | ||
395 | } | ||
396 | else if (getString("otr_smp_how_by_ss") == choice) | ||
397 | { | ||
398 | llinfos << "$PLOTR$ OTR SMP SS method chosen" << llendl; | ||
399 | std::string secret = edit1->getText(); | ||
400 | mIMPanel->startSmpProgress(mSessionUUID, mOtherParticipantUUID, secret); | ||
401 | } | ||
402 | else if (getString("otr_smp_how_by_mfv") == choice) | ||
403 | { | ||
404 | if (getString("otr_smp_veri_yes") == veri->getSimple()) | ||
405 | { | ||
406 | llinfos << "$PLOTR$ OTR SMP MFV authenticating " << mOtherParticipantUUID << llendl; | ||
407 | otr_authenticate_key(mSessionUUID, "mfv"); | ||
408 | } | ||
409 | } | ||
410 | else if (getString("otr_smp_how_by_qa_challenge") == choice) | ||
411 | { | ||
412 | std::string answer = edit2->getText(); | ||
413 | mIMPanel->startSmpProgress(mSessionUUID, mOtherParticipantUUID, mQuestion, answer, true); | ||
414 | } | ||
415 | else if (getString("otr_smp_how_by_ss_challenge") == choice) | ||
416 | { | ||
417 | std::string secret = edit1->getText(); | ||
418 | mIMPanel->startSmpProgress(mSessionUUID, mOtherParticipantUUID, secret, true); | ||
419 | } | ||
420 | else | ||
421 | { | ||
422 | llwarns << "$PLOTR$ unknown smp howto choice" << llendl; | ||
423 | } | ||
424 | } | ||
425 | |||
426 | // static | ||
427 | void OtrFloaterSmpDialog::onClickAuth(void* userdata) | ||
428 | { | ||
429 | OtrFloaterSmpDialog *self= (OtrFloaterSmpDialog*)userdata; | ||
430 | if (!self) | ||
431 | { | ||
432 | llwarns << "$PLOTR$ can't find OTR SMP dialog." << llendl; | ||
433 | return; | ||
434 | } | ||
435 | self->doClickAuth(); | ||
436 | self->close(); | ||
437 | } | ||
438 | |||
diff --git a/linden/indra/newview/otr_floater_smp_dialog.h b/linden/indra/newview/otr_floater_smp_dialog.h new file mode 100644 index 0000000..bb01b71 --- /dev/null +++ b/linden/indra/newview/otr_floater_smp_dialog.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* otr_floater_smp_dialog.h - SMP dialog box [$PLOTR$] | ||
2 | See http://www.cypherpunks.ca/otr/ | ||
3 | |||
4 | Copyright (C) 2009 Chris Tuchs | ||
5 | |||
6 | This is free software; you can redistribute it and/or modify it | ||
7 | under the terms of the GNU Lesser General Public License as | ||
8 | published by the Free Software Foundation; either version 2.1 of | ||
9 | the License, or (at your option) any later version. | ||
10 | |||
11 | This is distributed in the hope that it will be useful, but WITHOUT | ||
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
13 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
14 | License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public | ||
17 | License along with the viewer; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
19 | 02111-1307, USA. */ | ||
20 | |||
21 | #ifndef OTR_FLOATER_SMP_DIALOG_H_INCLUDED | ||
22 | #define OTR_FLOATER_SMP_DIALOG_H_INCLUDED 1 | ||
23 | |||
24 | #include "llfloater.h" | ||
25 | class LLFloaterIMPanel; | ||
26 | |||
27 | class OtrFloaterSmpDialog | ||
28 | : public LLFloater | ||
29 | { | ||
30 | private: | ||
31 | LLUUID mOtherParticipantUUID; | ||
32 | LLUUID mSessionUUID; | ||
33 | std::string mQuestion; | ||
34 | std::string mMyFingerprint; | ||
35 | std::string mOtherFingerprint; | ||
36 | LLFloaterIMPanel *mIMPanel; | ||
37 | bool mIsReply; | ||
38 | |||
39 | static void onClickHelp(void* userdata); | ||
40 | static void onClickCancel(void* userdata); | ||
41 | void doComboMenu(); | ||
42 | static void onClickCombo(LLUICtrl* source, void* userdata); | ||
43 | void doVeriMenu(); | ||
44 | static void onClickVeri(LLUICtrl* source, void* userdata); | ||
45 | void doClickAuth(); | ||
46 | static void onClickAuth(void* userdata); | ||
47 | std::string getStringName(const char *message_name); | ||
48 | |||
49 | public: | ||
50 | OtrFloaterSmpDialog(LLFloaterIMPanel *im_panel, LLUUID session_id, LLUUID other_id, | ||
51 | std::string my_fingerprint, std::string other_fingerprint); | ||
52 | OtrFloaterSmpDialog(LLFloaterIMPanel *im_panel, LLUUID session_id, LLUUID other_id, | ||
53 | std::string question, OtrlTLV *tlv); | ||
54 | OtrFloaterSmpDialog(LLFloaterIMPanel *im_panel, LLUUID session_id, LLUUID other_id, | ||
55 | OtrlTLV *tlv); | ||
56 | virtual ~OtrFloaterSmpDialog(); | ||
57 | /*virtual*/ BOOL postBuild(); | ||
58 | /*virtual*/ void onClose(bool app_quitting); | ||
59 | |||
60 | void show(); | ||
61 | void init(); | ||
62 | }; | ||
63 | #endif // ndef OTR_FLOATER_SMP_DIALOG_H_INCLUDED [/$PLOTR$] | ||
diff --git a/linden/indra/newview/otr_floater_smp_progress.cpp b/linden/indra/newview/otr_floater_smp_progress.cpp new file mode 100644 index 0000000..76bfc6e --- /dev/null +++ b/linden/indra/newview/otr_floater_smp_progress.cpp | |||
@@ -0,0 +1,288 @@ | |||
1 | /* otr_floater_smp_progress.cpp - SMP progress dialog box [$PLOTR$] | ||
2 | See http://www.cypherpunks.ca/otr/ | ||
3 | |||
4 | Copyright (C) 2009 Chris Tuchs | ||
5 | |||
6 | This is free software; you can redistribute it and/or modify it | ||
7 | under the terms of the GNU Lesser General Public License as | ||
8 | published by the Free Software Foundation; either version 2.1 of | ||
9 | the License, or (at your option) any later version. | ||
10 | |||
11 | This is distributed in the hope that it will be useful, but WITHOUT | ||
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
13 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
14 | License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public | ||
17 | License along with the viewer; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
19 | 02111-1307, USA. */ | ||
20 | |||
21 | #include "llviewerprecompiledheaders.h" | ||
22 | |||
23 | #include "llagent.h" | ||
24 | #include "llcachename.h" | ||
25 | #include "llimpanel.h" | ||
26 | #include "llprogressbar.h" | ||
27 | #include "lluictrlfactory.h" | ||
28 | #include "llweb.h" | ||
29 | |||
30 | #include "otr_wrapper.h" | ||
31 | #include "otr_floater_smp_progress.h" | ||
32 | |||
33 | void OtrFloaterSmpProgress::init() | ||
34 | { | ||
35 | LLUICtrlFactory::getInstance()->buildFloater(this, "otr_floater_smp_progress.xml"); | ||
36 | childSetAction("otr_smp_prog_help_btn", onClickHelp, this); | ||
37 | childSetAction("otr_smp_prog_cancel_btn", onClickCancel, this); | ||
38 | childSetAction("otr_smp_prog_ok_btn", onClickOk, this); | ||
39 | setDefaultBtn("otr_smp_prog_cancel_btn"); | ||
40 | LLUIString title = mIsReply | ||
41 | ? getString("otr_smp_prog_name_auth_me") | ||
42 | : getString("otr_smp_prog_I_auth_name"); | ||
43 | std::string them; | ||
44 | if (!gCacheName->getFullName(mOtherParticipantUUID, them)) them = getString("otr_generic_name"); | ||
45 | title.setArg("[NAME]", them); | ||
46 | setTitle(title.getString()); | ||
47 | } | ||
48 | |||
49 | OtrFloaterSmpProgress::OtrFloaterSmpProgress( | ||
50 | LLFloaterIMPanel *im_panel, LLUUID session_id, LLUUID other_id, | ||
51 | std::string a_question, std::string a_secret_answer, bool is_reply) | ||
52 | : LLFloater(std::string("otr_floater_smp_progress"), std::string("OtrFloaterSmpProgRect"), LLStringUtil::null), | ||
53 | mIMPanel(im_panel), mIsReply(is_reply), | ||
54 | mSessionUUID(session_id), mOtherParticipantUUID(other_id), | ||
55 | mQuestion(a_question), mSecretAnswer(a_secret_answer), | ||
56 | mSecretAnswerOnly(false) | ||
57 | { | ||
58 | init(); | ||
59 | if (!gOTR) | ||
60 | { | ||
61 | llwarns << "$PLOTR$ Can't find gOTR." << llendl; | ||
62 | setFinalStatus("otr_smp_prog_auth_errored"); | ||
63 | return; | ||
64 | } | ||
65 | if (!mIMPanel) | ||
66 | { | ||
67 | llwarns << "$PLOTR$ Can't find mIMPanel." << llendl; | ||
68 | setFinalStatus("otr_smp_prog_auth_errored"); | ||
69 | return; | ||
70 | } | ||
71 | ConnContext *context = mIMPanel->getOtrContext(); | ||
72 | if (!context) | ||
73 | { | ||
74 | llwarns << "$PLOTR$ Can't find context." << llendl; | ||
75 | setFinalStatus("otr_smp_prog_auth_errored"); | ||
76 | return; | ||
77 | } | ||
78 | if (mIsReply) | ||
79 | { | ||
80 | otrl_message_respond_smp( | ||
81 | gOTR->get_userstate(), | ||
82 | gOTR->get_uistate(), | ||
83 | &mSessionUUID, | ||
84 | context, | ||
85 | (const unsigned char *)mSecretAnswer.c_str(), | ||
86 | mSecretAnswer.length()); | ||
87 | setPercent(50); | ||
88 | setStatusName("otr_smp_prog_name_auth_me"); | ||
89 | } | ||
90 | else | ||
91 | { | ||
92 | otrl_message_initiate_smp_q( | ||
93 | gOTR->get_userstate(), | ||
94 | gOTR->get_uistate(), | ||
95 | &mSessionUUID, | ||
96 | context, | ||
97 | mQuestion.c_str(), | ||
98 | (const unsigned char *)mSecretAnswer.c_str(), | ||
99 | mSecretAnswer.length()); | ||
100 | setStatusName("otr_smp_prog_I_auth_name"); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | OtrFloaterSmpProgress::OtrFloaterSmpProgress( | ||
105 | LLFloaterIMPanel *im_panel, LLUUID session_id, LLUUID other_id, | ||
106 | std::string a_secret_answer, bool is_reply) | ||
107 | : LLFloater(std::string("otr_floater_smp_progress"), std::string("OtrFloaterSmpProgRect"), LLStringUtil::null), | ||
108 | mIMPanel(im_panel), mIsReply(is_reply), | ||
109 | mSessionUUID(session_id), mOtherParticipantUUID(other_id), | ||
110 | mSecretAnswer(a_secret_answer), | ||
111 | mSecretAnswerOnly(true) | ||
112 | { | ||
113 | init(); | ||
114 | if (!gOTR) | ||
115 | { | ||
116 | llwarns << "$PLOTR$ Can't find gOTR." << llendl; | ||
117 | setFinalStatus("otr_smp_prog_auth_errored"); | ||
118 | return; | ||
119 | } | ||
120 | if (!mIMPanel) | ||
121 | { | ||
122 | llwarns << "$PLOTR$ Can't find mIMPanel." << llendl; | ||
123 | setFinalStatus("otr_smp_prog_auth_errored"); | ||
124 | return; | ||
125 | } | ||
126 | ConnContext *context = mIMPanel->getOtrContext(); | ||
127 | if (!context) | ||
128 | { | ||
129 | llwarns << "$PLOTR$ Can't find context." << llendl; | ||
130 | setFinalStatus("otr_smp_prog_auth_errored"); | ||
131 | return; | ||
132 | } | ||
133 | if (mIsReply) | ||
134 | { | ||
135 | otrl_message_respond_smp( | ||
136 | gOTR->get_userstate(), | ||
137 | gOTR->get_uistate(), | ||
138 | &mSessionUUID, | ||
139 | context, | ||
140 | (const unsigned char *)mSecretAnswer.c_str(), | ||
141 | mSecretAnswer.length()); | ||
142 | setPercent(50); | ||
143 | setStatusName("otr_smp_prog_name_auth_me"); | ||
144 | } | ||
145 | else | ||
146 | { | ||
147 | otrl_message_initiate_smp( | ||
148 | gOTR->get_userstate(), | ||
149 | gOTR->get_uistate(), | ||
150 | &mSessionUUID, | ||
151 | context, | ||
152 | (const unsigned char *)mSecretAnswer.c_str(), | ||
153 | mSecretAnswer.length()); | ||
154 | setStatusName("otr_smp_prog_I_auth_name"); | ||
155 | } | ||
156 | } | ||
157 | |||
158 | OtrFloaterSmpProgress::~OtrFloaterSmpProgress() | ||
159 | { | ||
160 | } | ||
161 | |||
162 | BOOL OtrFloaterSmpProgress::postBuild() | ||
163 | { | ||
164 | mProgressBar = getChild<LLProgressBar>("otr_smp_prog_progress_bar"); | ||
165 | LLButton* cancel_btn = getChild<LLButton>("otr_smp_prog_cancel_btn"); | ||
166 | cancel_btn->setEnabled(TRUE); | ||
167 | LLButton* ok_btn = getChild<LLButton>("otr_smp_prog_ok_btn"); | ||
168 | ok_btn->setEnabled(FALSE); | ||
169 | return TRUE; | ||
170 | } | ||
171 | |||
172 | void OtrFloaterSmpProgress::show() | ||
173 | { | ||
174 | this->open(); /*Flawfinder: ignore*/ | ||
175 | this->center(); | ||
176 | } | ||
177 | |||
178 | void OtrFloaterSmpProgress::setPercent(float percent) | ||
179 | { | ||
180 | mProgressBar->setPercent(percent); | ||
181 | if (100 <= percent) | ||
182 | { | ||
183 | LLButton* cancel_btn = getChild<LLButton>("otr_smp_prog_cancel_btn"); | ||
184 | cancel_btn->setEnabled(FALSE); | ||
185 | LLButton* ok_btn = getChild<LLButton>("otr_smp_prog_ok_btn"); | ||
186 | ok_btn->setEnabled(TRUE); | ||
187 | } | ||
188 | else | ||
189 | { | ||
190 | LLButton* cancel_btn = getChild<LLButton>("otr_smp_prog_cancel_btn"); | ||
191 | cancel_btn->setEnabled(TRUE); | ||
192 | LLButton* ok_btn = getChild<LLButton>("otr_smp_prog_ok_btn"); | ||
193 | ok_btn->setEnabled(FALSE); | ||
194 | } | ||
195 | } | ||
196 | |||
197 | void OtrFloaterSmpProgress::setStatus(const char *message_string_name) | ||
198 | { | ||
199 | LLTextBox *status = getChild<LLTextBox>("otr_smp_prog_status"); | ||
200 | if (!status) | ||
201 | { | ||
202 | llwarns << "$PLOTR$ Can't find OTR progress status textbox" << llendl; | ||
203 | return; | ||
204 | } | ||
205 | status->setWrappedText(getString(message_string_name)); | ||
206 | } | ||
207 | |||
208 | void OtrFloaterSmpProgress::setStatusName(const char *message_string_name) | ||
209 | { | ||
210 | LLTextBox *status = getChild<LLTextBox>("otr_smp_prog_status"); | ||
211 | if (!status) | ||
212 | { | ||
213 | llwarns << "$PLOTR$ Can't find OTR progress status textbox" << llendl; | ||
214 | return; | ||
215 | } | ||
216 | LLUIString msg = getString(message_string_name); | ||
217 | std::string them; | ||
218 | if (!gCacheName->getFullName(mOtherParticipantUUID, them)) them = getString("otr_generic_name"); | ||
219 | msg.setArg("[NAME]", them); | ||
220 | status->setWrappedText(msg.getString()); | ||
221 | } | ||
222 | |||
223 | void OtrFloaterSmpProgress::setFinalStatus(const char *message_string_name) | ||
224 | { | ||
225 | setPercent(100); | ||
226 | setStatusName(message_string_name); | ||
227 | } | ||
228 | |||
229 | // static | ||
230 | void OtrFloaterSmpProgress::onClickHelp(void*) | ||
231 | { | ||
232 | LLWeb::loadURL("http://www.cypherpunks.ca/otr/help/3.2.0/authenticate.php"); | ||
233 | } | ||
234 | |||
235 | // static | ||
236 | void OtrFloaterSmpProgress::onClickCancel(void* userdata) | ||
237 | { | ||
238 | OtrFloaterSmpProgress *self= (OtrFloaterSmpProgress*)userdata; | ||
239 | if (!self) | ||
240 | { | ||
241 | llwarns << "$PLOTR$ can't find OTR SMP PROG dialog." << llendl; | ||
242 | return; | ||
243 | } | ||
244 | if (!self->mIMPanel) | ||
245 | { | ||
246 | llwarns << "$PLOTR$ Can't find mIMPanel." << llendl; | ||
247 | return; | ||
248 | } | ||
249 | ConnContext *context = self->mIMPanel->getOtrContext(); | ||
250 | if (!context) | ||
251 | { | ||
252 | llwarns << "$PLOTR$ Can't find context." << llendl; | ||
253 | return; | ||
254 | } | ||
255 | otrl_message_abort_smp( | ||
256 | gOTR->get_userstate(), | ||
257 | gOTR->get_uistate(), | ||
258 | &(self->mSessionUUID), | ||
259 | context); | ||
260 | self->close(); | ||
261 | } | ||
262 | |||
263 | // static | ||
264 | void OtrFloaterSmpProgress::onClickOk(void* userdata) | ||
265 | { | ||
266 | OtrFloaterSmpProgress *self= (OtrFloaterSmpProgress*)userdata; | ||
267 | if (!self) | ||
268 | { | ||
269 | llwarns << "$PLOTR$ can't find OTR SMP PROG dialog." << llendl; | ||
270 | return; | ||
271 | } | ||
272 | self->close(); | ||
273 | } | ||
274 | |||
275 | // virtual | ||
276 | void OtrFloaterSmpProgress::onClose(bool app_quitting) | ||
277 | { | ||
278 | destroy(); | ||
279 | if (!mIMPanel) | ||
280 | { | ||
281 | llwarns << "$PLOTR$ Can't find mIMPanel." << llendl; | ||
282 | } | ||
283 | else | ||
284 | { | ||
285 | mIMPanel->endSmpProgress(); | ||
286 | } | ||
287 | } | ||
288 | // [/$PLOTR$] | ||
diff --git a/linden/indra/newview/otr_floater_smp_progress.h b/linden/indra/newview/otr_floater_smp_progress.h new file mode 100644 index 0000000..05ff208 --- /dev/null +++ b/linden/indra/newview/otr_floater_smp_progress.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /* otr_floater_smp_progress.h - SMP progress dialog box [$PLOTR$] | ||
2 | See http://www.cypherpunks.ca/otr/ | ||
3 | |||
4 | Copyright (C) 2009 Chris Tuchs | ||
5 | |||
6 | This is free software; you can redistribute it and/or modify it | ||
7 | under the terms of the GNU Lesser General Public License as | ||
8 | published by the Free Software Foundation; either version 2.1 of | ||
9 | the License, or (at your option) any later version. | ||
10 | |||
11 | This is distributed in the hope that it will be useful, but WITHOUT | ||
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
13 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
14 | License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public | ||
17 | License along with the viewer; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
19 | 02111-1307, USA. */ | ||
20 | |||
21 | #ifndef OTR_FLOATER_SMP_PROGRESS_H_INCLUDED | ||
22 | #define OTR_FLOATER_SMP_PROGRESS_H_INCLUDED 1 | ||
23 | |||
24 | #include "llfloater.h" | ||
25 | class LLFloaterIMPanel; | ||
26 | class LLProgressBar; | ||
27 | |||
28 | class OtrFloaterSmpProgress | ||
29 | : public LLFloater | ||
30 | { | ||
31 | private: | ||
32 | LLUUID mOtherParticipantUUID; | ||
33 | LLUUID mSessionUUID; | ||
34 | std::string mQuestion; | ||
35 | std::string mSecretAnswer; | ||
36 | bool mSecretAnswerOnly; | ||
37 | LLFloaterIMPanel *mIMPanel; | ||
38 | LLProgressBar* mProgressBar; | ||
39 | bool mIsReply; | ||
40 | |||
41 | static void onClickHelp(void* userdata); | ||
42 | static void onClickCancel(void* userdata); | ||
43 | static void onClickOk(void* userdata); | ||
44 | |||
45 | void init(); | ||
46 | public: | ||
47 | OtrFloaterSmpProgress(LLFloaterIMPanel *im_panel, LLUUID session_id, LLUUID other_id, | ||
48 | std::string a_question, std::string a_secret_answer, bool is_reply = false); | ||
49 | OtrFloaterSmpProgress(LLFloaterIMPanel *im_panel, LLUUID session_id, LLUUID other_id, | ||
50 | std::string a_secret_answer, bool is_reply = false); | ||
51 | void setPercent(float percent); | ||
52 | void setStatus(const char *message_string_name); | ||
53 | void setStatusName(const char *message_string_name); | ||
54 | void setFinalStatus(const char *message_string_name); | ||
55 | virtual ~OtrFloaterSmpProgress(); | ||
56 | /*virtual*/ BOOL postBuild(); | ||
57 | /*virtual*/ void onClose(bool app_quitting); | ||
58 | |||
59 | void show(); | ||
60 | }; | ||
61 | #endif // ndef OTR_FLOATER_SMP_PROGRESS_H_INCLUDED [/$PLOTR$] | ||
diff --git a/linden/indra/newview/otr_wrapper.cpp b/linden/indra/newview/otr_wrapper.cpp new file mode 100644 index 0000000..abd1c91 --- /dev/null +++ b/linden/indra/newview/otr_wrapper.cpp | |||
@@ -0,0 +1,487 @@ | |||
1 | /* otr_wrapper.cpp - wrap libotr for use in the second life viewer | ||
2 | $PLOTR$ See http://www.cypherpunks.ca/otr/ | ||
3 | |||
4 | Copyright (C) 2009 Chris Tuchs | ||
5 | |||
6 | This is free software; you can redistribute it and/or modify it | ||
7 | under the terms of the GNU Lesser General Public License as | ||
8 | published by the Free Software Foundation; either version 2.1 of | ||
9 | the License, or (at your option) any later version. | ||
10 | |||
11 | This is distributed in the hope that it will be useful, but WITHOUT | ||
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
13 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
14 | License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public | ||
17 | License along with the viewer; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
19 | 02111-1307, USA. */ | ||
20 | |||
21 | #include "llviewerprecompiledheaders.h" | ||
22 | #include "llviewercontrol.h" | ||
23 | #include "llimpanel.h" | ||
24 | #include "otr_wrapper.h" | ||
25 | #include "llagent.h" | ||
26 | #include "llimview.h" | ||
27 | |||
28 | |||
29 | OTR_Wrapper *gOTR = 0; | ||
30 | |||
31 | OTR_Wrapper::OTR_Wrapper() | ||
32 | { | ||
33 | } | ||
34 | |||
35 | OTR_Wrapper::~OTR_Wrapper() | ||
36 | { | ||
37 | if (gOTR) | ||
38 | { | ||
39 | otrl_userstate_free(gOTR->userstate); | ||
40 | } | ||
41 | } | ||
42 | |||
43 | #define otrwui_tracing 1 // $TODO$ use some debug compile flag? | ||
44 | #if otrwui_tracing | ||
45 | extern "C" void otrwui_trace(const char *msg) | ||
46 | { | ||
47 | llinfos << "$PLOTR$TRACE$" << msg << llendl; | ||
48 | } | ||
49 | #else | ||
50 | #define otrwui_trace(x) /* nothing */ | ||
51 | #endif | ||
52 | |||
53 | static void otrwui_tbd(const char *msg) | ||
54 | { | ||
55 | llinfos << "$PLOTR$TBD$" << msg << llendl; | ||
56 | } | ||
57 | |||
58 | static OtrlPolicy otrwui_policy(void *opdata, ConnContext *context) | ||
59 | { | ||
60 | OtrlPolicy result = 0; | ||
61 | U32 useotr = gSavedSettings.getU32("EmeraldUseOTR"); | ||
62 | if (3 < useotr) | ||
63 | { | ||
64 | llwarns << "$PLOTR$ Unknown setting for EmeraldUseOTR" << useotr << llendl; | ||
65 | useotr = 2; | ||
66 | } | ||
67 | if (0 == useotr) // Require use of OTR in IMs | ||
68 | { | ||
69 | result = (0 | ||
70 | // | OTRL_POLICY_ALLOW_V1 // don't even expose this? | ||
71 | | OTRL_POLICY_ALLOW_V2 | ||
72 | | OTRL_POLICY_REQUIRE_ENCRYPTION | ||
73 | | OTRL_POLICY_SEND_WHITESPACE_TAG | ||
74 | | OTRL_POLICY_WHITESPACE_START_AKE | ||
75 | | OTRL_POLICY_ERROR_START_AKE | ||
76 | ); | ||
77 | } | ||
78 | else if (1 == useotr) // Request OTR if available | ||
79 | { | ||
80 | result = (0 | ||
81 | // | OTRL_POLICY_ALLOW_V1 // don't even expose this? | ||
82 | | OTRL_POLICY_ALLOW_V2 | ||
83 | // | OTRL_POLICY_REQUIRE_ENCRYPTION | ||
84 | | OTRL_POLICY_SEND_WHITESPACE_TAG | ||
85 | | OTRL_POLICY_WHITESPACE_START_AKE | ||
86 | | OTRL_POLICY_ERROR_START_AKE | ||
87 | ); | ||
88 | } | ||
89 | else if (2 == useotr) // Accept OTR requests | ||
90 | { | ||
91 | result = (0 | ||
92 | // | OTRL_POLICY_ALLOW_V1 // don't even expose this? | ||
93 | | OTRL_POLICY_ALLOW_V2 | ||
94 | // | OTRL_POLICY_REQUIRE_ENCRYPTION | ||
95 | // | OTRL_POLICY_SEND_WHITESPACE_TAG | ||
96 | | OTRL_POLICY_WHITESPACE_START_AKE | ||
97 | | OTRL_POLICY_ERROR_START_AKE | ||
98 | ); | ||
99 | } | ||
100 | else if (3 == useotr) // Decline use of OTR | ||
101 | { | ||
102 | result = (0 | ||
103 | // | OTRL_POLICY_ALLOW_V1 // don't even expose this? | ||
104 | // | OTRL_POLICY_ALLOW_V2 | ||
105 | // | OTRL_POLICY_REQUIRE_ENCRYPTION | ||
106 | // | OTRL_POLICY_SEND_WHITESPACE_TAG | ||
107 | // | OTRL_POLICY_WHITESPACE_START_AKE | ||
108 | // | OTRL_POLICY_ERROR_START_AKE | ||
109 | ); | ||
110 | } | ||
111 | return result; | ||
112 | } | ||
113 | |||
114 | |||
115 | |||
116 | static void otrwui_create_privkey( | ||
117 | void *opdata, const char *accountname, | ||
118 | const char *protocol) | ||
119 | { | ||
120 | otrwui_trace("otrwui_create_privkey()"); | ||
121 | /* Create a private key for the given accountname/protocol if | ||
122 | * desired. */ | ||
123 | if (gOTR) | ||
124 | { | ||
125 | LLUUID session_id = *((LLUUID*)opdata); | ||
126 | otr_log_message_getstring(session_id, "otr_gen_key_please_wait"); | ||
127 | std::string path = | ||
128 | gDirUtilp->getExpandedFilename( | ||
129 | LL_PATH_PER_SL_ACCOUNT, OTR_PRIVATE_KEYS_FILE); | ||
130 | otrl_privkey_generate( | ||
131 | gOTR->get_userstate(), path.c_str(), accountname, protocol); | ||
132 | } | ||
133 | } | ||
134 | |||
135 | static int otrwui_is_logged_in( | ||
136 | void *opdata, const char *accountname, | ||
137 | const char *protocol, const char *recipient) | ||
138 | { | ||
139 | /* Report whether you think the given user is online. Return 1 if | ||
140 | * you think he is, 0 if you think he isn't, -1 if you're not sure. | ||
141 | * | ||
142 | * If you return 1, messages such as heartbeats or other | ||
143 | * notifications may be sent to the user, which could result in "not | ||
144 | * logged in" errors if you're wrong. */ | ||
145 | LLUUID recipient_uuid(recipient); | ||
146 | const LLRelationship* info = NULL; | ||
147 | info = LLAvatarTracker::instance().getBuddyInfo(recipient_uuid); | ||
148 | int result; | ||
149 | if (!info) result = 1; // hack, should be -1. but we'll pretend non-friends are always online | ||
150 | else if (!info->isOnline()) result = 0; | ||
151 | else result = 1; | ||
152 | #if otrwui_tracing | ||
153 | std::string msg = "otrwui_is_logged_in()"; | ||
154 | switch(result) | ||
155 | { | ||
156 | case -1: msg += " -1 unknown"; break; | ||
157 | case 0: msg += " 0 no, logged out"; break; | ||
158 | case 1: msg += " 1 yes, logged in"; break; | ||
159 | default: msg += " ? imposible result"; break; | ||
160 | } | ||
161 | otrwui_trace(msg.c_str()); | ||
162 | #endif | ||
163 | return result; | ||
164 | } | ||
165 | |||
166 | static void otrwui_inject_message( | ||
167 | void *opdata, const char *accountname, | ||
168 | const char *protocol, const char *recipient, const char *message) | ||
169 | { | ||
170 | otrwui_trace("otrwui_inject_message()"); | ||
171 | /* Send the given IM to the given recipient from the given | ||
172 | * accountname/protocol. */ | ||
173 | if (!opdata) | ||
174 | { | ||
175 | // don't know how to deliver this with no opdata. | ||
176 | llwarns << "$PLOTR$ otrwui_inject_message() called with NULL opdata; not delivering message" << llendl; | ||
177 | } | ||
178 | else | ||
179 | { | ||
180 | LLUUID sessionUUID = *((LLUUID*)opdata); | ||
181 | LLUUID otherUUID(recipient); | ||
182 | otr_deliver_message(message, sessionUUID, otherUUID, IM_NOTHING_SPECIAL); | ||
183 | } | ||
184 | } | ||
185 | |||
186 | static void otrwui_notify( | ||
187 | void *opdata, OtrlNotifyLevel level, | ||
188 | const char *accountname, const char *protocol, | ||
189 | const char *username, const char *title, | ||
190 | const char *primary, const char *secondary) | ||
191 | { | ||
192 | /* Display a notification message for a particular accountname / | ||
193 | * protocol / username conversation. */ | ||
194 | std::string trace = "otrwui_notify: \n"; | ||
195 | trace += "title("; trace += title; trace += ")\n"; | ||
196 | trace += "primary("; trace += primary; trace += ")\n"; | ||
197 | trace += "secondary("; trace += secondary; trace += ")"; | ||
198 | otrwui_tbd(trace.c_str()); // $TODO$ write me | ||
199 | } | ||
200 | |||
201 | static int otrwui_display_otr_message( | ||
202 | void *opdata, const char *accountname, | ||
203 | const char *protocol, const char *username, const char *msg) | ||
204 | { | ||
205 | /* Display an OTR control message for a particular accountname / | ||
206 | * protocol / username conversation. Return 0 if you are able to | ||
207 | * successfully display it. If you return non-0 (or if this | ||
208 | * function is NULL), the control message will be displayed inline, | ||
209 | * as a received message, or else by using the above notify() | ||
210 | * callback. */ | ||
211 | otrwui_trace("otrwui_log_message()"); | ||
212 | LLUUID sessionUUID = *((LLUUID*)opdata); | ||
213 | otr_log_message(sessionUUID, msg); | ||
214 | return 0; | ||
215 | } | ||
216 | |||
217 | static void otrwui_update_context_list( | ||
218 | void *opdata) | ||
219 | { | ||
220 | /* When the list of ConnContexts changes (including a change in | ||
221 | * state), this is called so the UI can be updated. */ | ||
222 | otrwui_tbd("otrwui_update_context_list"); // $TODO$ write me | ||
223 | } | ||
224 | |||
225 | static const char *otrwui_protocol_name( | ||
226 | void *opdata, const char *protocol) | ||
227 | { | ||
228 | /* Return a newly allocated string containing a human-friendly name | ||
229 | * for the given protocol id */ | ||
230 | otrwui_trace("otrwui_protocol_name()"); | ||
231 | return "SecondLife"; | ||
232 | } | ||
233 | |||
234 | static void otrwui_protocol_name_free( | ||
235 | void *opdata, const char *protocol_name) | ||
236 | { | ||
237 | /* Deallocate a string allocated by protocol_name */ | ||
238 | otrwui_trace("otrwui_protocol_name_free()"); | ||
239 | return; // no need to deallocate a const char * | ||
240 | } | ||
241 | |||
242 | static void otrwui_new_fingerprint( | ||
243 | void *opdata, OtrlUserState us, | ||
244 | const char *accountname, const char *protocol, | ||
245 | const char *username, unsigned char fingerprint[20]) | ||
246 | { | ||
247 | /* A new fingerprint for the given user has been received. */ | ||
248 | std::string trace= "otrwui_new_fingerprint: "; | ||
249 | trace += username; trace += "@"; trace += protocol; | ||
250 | trace += " has a new fingerprint ("; | ||
251 | char fingerprint_copy[45]; | ||
252 | otrl_privkey_hash_to_human(fingerprint_copy, fingerprint); | ||
253 | trace += fingerprint_copy; trace += ")"; | ||
254 | otrwui_tbd(trace.c_str()); // $TODO$ write me | ||
255 | } | ||
256 | |||
257 | static void otrwui_write_fingerprints( | ||
258 | void *opdata) | ||
259 | { | ||
260 | otrwui_trace("otrwui_write_fingerprints()"); | ||
261 | /* The list of known fingerprints has changed. Write them to disk. */ | ||
262 | if (gOTR) | ||
263 | { | ||
264 | std::string path = | ||
265 | gDirUtilp->getExpandedFilename( | ||
266 | LL_PATH_PER_SL_ACCOUNT, OTR_PUBLIC_KEYS_FILE); | ||
267 | otrl_privkey_write_fingerprints(gOTR->get_userstate(), path.c_str()); | ||
268 | } | ||
269 | } | ||
270 | |||
271 | static void otrwui_gone_secure( | ||
272 | void *opdata, ConnContext *context) | ||
273 | { | ||
274 | otrwui_trace("otrwui_gone_secure()"); | ||
275 | /* A ConnContext has entered a secure state. */ | ||
276 | if (! opdata) | ||
277 | { | ||
278 | otrwui_tbd("otrwui_gone_secure() called with null opdata"); | ||
279 | return; | ||
280 | } | ||
281 | LLUUID session_id = *((LLUUID*)opdata); | ||
282 | if (context && context->active_fingerprint && | ||
283 | context->active_fingerprint->trust && | ||
284 | *(context->active_fingerprint->trust)) | ||
285 | { | ||
286 | //otr_log_message_getstring_name(session_id, "otr_log_start_private"); | ||
287 | } | ||
288 | else | ||
289 | { | ||
290 | //otr_log_message_getstring_name(session_id, "otr_log_start_unverified"); | ||
291 | } | ||
292 | otr_show_status(session_id); | ||
293 | } | ||
294 | |||
295 | static void otrwui_gone_insecure( | ||
296 | void *opdata, ConnContext *context) | ||
297 | { | ||
298 | otrwui_trace("otrwui_gone_insecure()"); | ||
299 | /* A ConnContext has left a secure state. */ | ||
300 | if (! opdata) | ||
301 | { | ||
302 | otrwui_tbd("otrwui_gone_insecure() called with null opdata"); | ||
303 | return; | ||
304 | } | ||
305 | LLUUID session_id = *((LLUUID*)opdata); | ||
306 | otr_log_message_getstring(session_id, "otr_log_gone_insecure"); | ||
307 | otr_show_status(session_id); | ||
308 | } | ||
309 | |||
310 | static void otrwui_still_secure( | ||
311 | void *opdata, ConnContext *context, int is_reply) | ||
312 | { | ||
313 | otrwui_trace("otrwui_still_secure()"); | ||
314 | /* We have completed an authentication, using the D-H keys we | ||
315 | * already knew. is_reply indicates whether we initiated the AKE. */ | ||
316 | if (! opdata) | ||
317 | { | ||
318 | otrwui_tbd("otrwui_still_secure() called with null opdata"); | ||
319 | return; | ||
320 | } | ||
321 | LLUUID session_id = *((LLUUID*)opdata); | ||
322 | if (context && context->active_fingerprint && | ||
323 | context->active_fingerprint->trust && | ||
324 | *(context->active_fingerprint->trust)) | ||
325 | { | ||
326 | //otr_log_message_getstring_name(session_id, "otr_log_still_private"); | ||
327 | } | ||
328 | else | ||
329 | { | ||
330 | //otr_log_message_getstring_name(session_id, "otr_log_still_unverified"); | ||
331 | } | ||
332 | otr_show_status(session_id); | ||
333 | } | ||
334 | |||
335 | static void otrwui_log_message( | ||
336 | void *opdata, const char *message) | ||
337 | { | ||
338 | /* Log a message. The passed message will end in "\n". */ | ||
339 | otrwui_trace("otrwui_log_message()"); | ||
340 | llinfos << message << llendl; | ||
341 | } | ||
342 | |||
343 | static int otrwui_max_message_size( | ||
344 | void *opdata, ConnContext *context) | ||
345 | { | ||
346 | /* Find the maximum message size supported by this protocol. */ | ||
347 | return (MAX_MSG_BUF_SIZE - 24); | ||
348 | } | ||
349 | |||
350 | static const char *otrwui_account_name( | ||
351 | void *opdata, const char *account, | ||
352 | const char *protocol) | ||
353 | { | ||
354 | /* Return a newly allocated string containing a human-friendly | ||
355 | * representation for the given account */ | ||
356 | otrwui_trace("otrwui_account_name"); | ||
357 | std::string name; | ||
358 | LLUUID uuid = LLUUID(account); | ||
359 | if (!gCacheName->getFullName(uuid, name)) name = account; | ||
360 | char *result = (char *)malloc(name.length()+1); | ||
361 | strncpy(result, name.c_str(), name.length()+1); | ||
362 | return result; | ||
363 | } | ||
364 | |||
365 | static void otrwui_account_name_free( | ||
366 | void *opdata, const char *account_name) | ||
367 | { | ||
368 | /* Deallocate a string returned by account_name */ | ||
369 | otrwui_trace("otrwui_account_name_free"); | ||
370 | free((void *)account_name); | ||
371 | } | ||
372 | |||
373 | // static | ||
374 | void OTR_Wrapper::stopAll() | ||
375 | { | ||
376 | otrwui_trace("OTR_Wrapper::stopAll()"); | ||
377 | if (!gOTR) return; | ||
378 | if (gOTR->userstate) | ||
379 | { | ||
380 | for (ConnContext *context = gOTR->userstate->context_root; context; context = context->next) | ||
381 | { | ||
382 | if (context && (OTRL_MSGSTATE_ENCRYPTED == context->msgstate)) | ||
383 | { | ||
384 | LLUUID their_uuid = LLUUID(context->username); | ||
385 | LLUUID session_uuid = LLIMMgr::computeSessionID(IM_NOTHING_SPECIAL, their_uuid); | ||
386 | LLFloaterIMPanel* pan = gIMMgr->findFloaterBySession(session_uuid); | ||
387 | if (pan) | ||
388 | { | ||
389 | llinfos << "$PLOTR$ found IM pannel, pan->doOtrStop()" << llendl; | ||
390 | pan->doOtrStop(); | ||
391 | } | ||
392 | else | ||
393 | { | ||
394 | char my_uuid[UUID_STR_SIZE]; | ||
395 | gAgent.getID().toString(&(my_uuid[0])); | ||
396 | llinfos << "$PLOTR$ didn't find IM panel, going lower level" | ||
397 | << " c->accountname:" << context->accountname // this avatar, aka me | ||
398 | << " c->protocol:" << context->protocol // secondlife, IRC, yahoo... | ||
399 | << " c->username:" << context->username // other participant | ||
400 | << " session_uuid:" << session_uuid | ||
401 | << llendl; | ||
402 | otrl_message_disconnect( | ||
403 | gOTR->get_userstate(), | ||
404 | gOTR->get_uistate(), | ||
405 | &session_uuid, | ||
406 | context->accountname, | ||
407 | context->protocol, | ||
408 | context->username); | ||
409 | } | ||
410 | } | ||
411 | } | ||
412 | } | ||
413 | } | ||
414 | |||
415 | // static | ||
416 | void OTR_Wrapper::logout() | ||
417 | { | ||
418 | otrwui_trace("OTR_Wrapper::logout()"); | ||
419 | if (!gOTR) return; | ||
420 | OTR_Wrapper::stopAll(); | ||
421 | delete gOTR; | ||
422 | gOTR = NULL; | ||
423 | } | ||
424 | |||
425 | // static | ||
426 | void OTR_Wrapper::init() | ||
427 | { | ||
428 | otrwui_trace("OTR_Wrapper::init()"); | ||
429 | if (! gOTR) | ||
430 | { | ||
431 | gOTR = new OTR_Wrapper; | ||
432 | if (!gOTR) | ||
433 | { | ||
434 | llwarns << "$PLOTR$ Can't new otr_wrapper." << llendl; | ||
435 | } | ||
436 | else | ||
437 | { | ||
438 | llinfos << "$PLOTR$ newed otr_wrapper." << llendl; | ||
439 | gOTR->uistate.policy = &otrwui_policy; | ||
440 | gOTR->uistate.create_privkey = &otrwui_create_privkey; | ||
441 | gOTR->uistate.is_logged_in = &otrwui_is_logged_in; | ||
442 | gOTR->uistate.inject_message = &otrwui_inject_message; | ||
443 | gOTR->uistate.notify = &otrwui_notify; | ||
444 | gOTR->uistate.display_otr_message = &otrwui_display_otr_message; | ||
445 | gOTR->uistate.update_context_list = &otrwui_update_context_list; | ||
446 | gOTR->uistate.protocol_name = &otrwui_protocol_name; | ||
447 | gOTR->uistate.protocol_name_free = &otrwui_protocol_name_free; | ||
448 | gOTR->uistate.new_fingerprint = &otrwui_new_fingerprint; | ||
449 | gOTR->uistate.write_fingerprints = &otrwui_write_fingerprints; | ||
450 | gOTR->uistate.gone_secure = &otrwui_gone_secure; | ||
451 | gOTR->uistate.gone_insecure = &otrwui_gone_insecure; | ||
452 | gOTR->uistate.still_secure = &otrwui_still_secure; | ||
453 | gOTR->uistate.log_message = &otrwui_log_message; | ||
454 | gOTR->uistate.max_message_size = &otrwui_max_message_size; | ||
455 | gOTR->uistate.account_name = &otrwui_account_name; | ||
456 | gOTR->uistate.account_name_free = &otrwui_account_name_free; | ||
457 | OTRL_INIT; | ||
458 | gOTR->userstate = otrl_userstate_create(); | ||
459 | std::string privpath = | ||
460 | gDirUtilp->getExpandedFilename( | ||
461 | LL_PATH_PER_SL_ACCOUNT, OTR_PRIVATE_KEYS_FILE); | ||
462 | otrl_privkey_read(gOTR->userstate, privpath.c_str()); | ||
463 | std::string pubpath = | ||
464 | gDirUtilp->getExpandedFilename( | ||
465 | LL_PATH_PER_SL_ACCOUNT, OTR_PUBLIC_KEYS_FILE); | ||
466 | otrl_privkey_read_fingerprints(gOTR->userstate, pubpath.c_str(), NULL, NULL); | ||
467 | #if 0 // this will gen a key, if the user doesn't have one, at init() time | ||
468 | if (gOTR && gOTR->userstate) | ||
469 | { | ||
470 | OtrlPrivKey *r = gOTR->userstate->privkey_root; | ||
471 | OtrlPrivKey *k = gOTR->userstate->privkey_root; | ||
472 | while (k && (k != r)) | ||
473 | { | ||
474 | if (0 == strcmp(gOTR->get_protocolid(), k->protocol)) | ||
475 | { | ||
476 | return; | ||
477 | } | ||
478 | } | ||
479 | char my_uuid[UUID_STR_SIZE]; | ||
480 | gAgent.getID().toString(&(my_uuid[0])); | ||
481 | otrl_privkey_generate(gOTR->userstate, privpath.c_str(), | ||
482 | my_uuid, gOTR->get_protocolid()); | ||
483 | } | ||
484 | #endif | ||
485 | } | ||
486 | } | ||
487 | } | ||
diff --git a/linden/indra/newview/otr_wrapper.h b/linden/indra/newview/otr_wrapper.h new file mode 100644 index 0000000..dd6d12c --- /dev/null +++ b/linden/indra/newview/otr_wrapper.h | |||
@@ -0,0 +1,58 @@ | |||
1 | /* otr_wrapper.h - wrap libotr for use in the second life viewer | ||
2 | $PLOTR$ See http://www.cypherpunks.ca/otr/ | ||
3 | |||
4 | Copyright (C) 2009 Chris Tuchs | ||
5 | |||
6 | This is free software; you can redistribute it and/or modify it | ||
7 | under the terms of the GNU Lesser General Public License as | ||
8 | published by the Free Software Foundation; either version 2.1 of | ||
9 | the License, or (at your option) any later version. | ||
10 | |||
11 | This is distributed in the hope that it will be useful, but WITHOUT | ||
12 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
13 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
14 | License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU Lesser General Public | ||
17 | License along with the viewer; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
19 | 02111-1307, USA. */ | ||
20 | |||
21 | #ifndef OTR_WRAPPER_H_INCLUDED | ||
22 | #define OTR_WRAPPER_H_INCLUDED 1 | ||
23 | |||
24 | extern "C" { | ||
25 | #if WIN32 | ||
26 | #include <unistd.h> // various defines needed for OTR on windows | ||
27 | #endif | ||
28 | #include <gcrypt.h> // gcrypt dependancies | ||
29 | #include <userstate.h> // OTR | ||
30 | #include <proto.h> // OTR | ||
31 | #include <privkey.h> // OTR | ||
32 | #include <../libotr/libotr-3.2.0/src/message.h> // OTR | ||
33 | #include <context.h> | ||
34 | } | ||
35 | |||
36 | class OTR_Wrapper | ||
37 | { | ||
38 | private: | ||
39 | OtrlUserState userstate; // Global state of OTR: known public keys etc. | ||
40 | OtrlMessageAppOps uistate; // UI functions collected into a structure for libotr | ||
41 | OTR_Wrapper(); | ||
42 | ~OTR_Wrapper(); | ||
43 | |||
44 | public: | ||
45 | static void init(); | ||
46 | static void stopAll(); | ||
47 | static void logout(); | ||
48 | OtrlUserState get_userstate() { return this->userstate; } | ||
49 | OtrlMessageAppOps *get_uistate() { return &(this->uistate); } | ||
50 | const char * get_protocolid() { return "SecondLife"; } | ||
51 | }; | ||
52 | |||
53 | extern OTR_Wrapper *gOTR; // the singleton OTR wrapper | ||
54 | |||
55 | #define OTR_PRIVATE_KEYS_FILE "OTR-my-private-key.dat" | ||
56 | #define OTR_PUBLIC_KEYS_FILE "OTR-public-keys.dat" | ||
57 | |||
58 | #endif // ndef OTR_WRAPPER_H_INCLUDED | ||
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_instant_message.xml b/linden/indra/newview/skins/default/xui/en-us/floater_instant_message.xml index 4ccfe60..5ad564a 100644 --- a/linden/indra/newview/skins/default/xui/en-us/floater_instant_message.xml +++ b/linden/indra/newview/skins/default/xui/en-us/floater_instant_message.xml | |||
@@ -37,6 +37,42 @@ | |||
37 | <string name="unavailable_text_label"> | 37 | <string name="unavailable_text_label"> |
38 | Text chat is not available for this call. | 38 | Text chat is not available for this call. |
39 | </string> | 39 | </string> |
40 | <!--[$PLOTR$]--> | ||
41 | <string name="otr_empty_string"></string> | ||
42 | <string name="otr_gen_key_please_wait">OTR is generating keys. This will happen once for each of your avatars and should take less than 45 seconds.</string> | ||
43 | <string name="otr_generic_name">Your buddy</string> | ||
44 | <string name="otr_err_send_in_finished">[NAME] has ended the private conversation, so your message was not sent. You should restart the private conversation, or end the private conversation.</string> | ||
45 | <string name="otr_err_deacivated">OTR has been deactivated by preferences (edit > preferences > Emerald tab > IM tab)</string> | ||
46 | <string name="otr_err_failed_sending">Unable to encrypt your message for some reason; it has not been sent.</string> | ||
47 | <string name="otr_err_failed_starting">Unable to start private conversation.</string> | ||
48 | <string name="otr_err_offline_start">[NAME] appears offline; OTR will not try to start a private conversation.</string> | ||
49 | <string name="otr_err_offline_send">[NAME] appears offline; You may "End private conversation" and send your message un-encrypted.</string> | ||
50 | <string name="otr_prog_I_start">Attempting to start a private conversation with [NAME].</string> | ||
51 | <string name="otr_prog_I_stop_unverified">You have ended the unverified conversation with [NAME].</string> | ||
52 | <string name="otr_prog_I_stop_private" >You have ended the private conversation with [NAME].</string> | ||
53 | <string name="otr_prog_I_stop" >You have ended the OTR conversation with [NAME].</string> | ||
54 | <string name="otr_prog_they_start">[NAME] is attempting to start a private conversation.</string> | ||
55 | <string name="otr_prog_they_stop_unverified">[NAME] has ended the unverified conversation.</string> | ||
56 | <string name="otr_prog_they_stop_private" >[NAME] has ended the private conversation.</string> | ||
57 | <string name="otr_prog_they_stop" >[NAME] has ended the OTR conversation.</string> | ||
58 | <string name="otr_log_authenticated" >[NAME] is now authenticated.</string> | ||
59 | <string name="otr_log_start_private" >Private conversation with [NAME] started.</string> | ||
60 | <string name="otr_log_start_unverified">Unverified conversation started. [NAME] has not been authenticated, you should "authenticate buddy," see http://www.cypherpunks.ca/otr/help/3.2.0/authenticate.php</string> | ||
61 | <string name="otr_log_gone_insecure">Private conversation ended.</string> | ||
62 | <string name="otr_log_still_private" >Private conversation with [NAME] resumed.</string> | ||
63 | <string name="otr_log_still_unverified">Unverified conversation resumed. [NAME] has not been authenticated, you should "authenticate buddy," see http://www.cypherpunks.ca/otr/help/3.2.0/authenticate.php</string> | ||
64 | <string name="otr_not_private">OTR: Not Private</string> | ||
65 | <string name="otr_unverified" >OTR: Unverified</string> | ||
66 | <string name="otr_private" >OTR: Private</string> | ||
67 | <string name="otr_finished" >OTR: Finished</string> | ||
68 | <string name="otr_start" >Start private conversation</string> | ||
69 | <string name="otr_refresh">Refresh private conversation</string> | ||
70 | <string name="otr_restart">Restart private conversation</string> | ||
71 | <string name="otr_stop" >End private conversation</string> | ||
72 | <string name="otr_auth" >Authenticate buddy</string> | ||
73 | <string name="otr_help" >What is OTR?</string> | ||
74 | <string name="otr_levels" >What is this?</string> | ||
75 | <!--[/$PLOTR$]--> | ||
40 | <string name="add_friend_string"> | 76 | <string name="add_friend_string"> |
41 | Add Friend | 77 | Add Friend |
42 | </string> | 78 | </string> |
@@ -72,6 +108,10 @@ | |||
72 | image_unselected="icn_speaker_dark.tga" label="" left_delta="56" | 108 | image_unselected="icn_speaker_dark.tga" label="" left_delta="56" |
73 | name="mute_btn" tool_tip="Mute voice" width="25" /> | 109 | name="mute_btn" tool_tip="Mute voice" width="25" /> |
74 | </panel> | 110 | </panel> |
111 | <!--[$PLOTR$]--> | ||
112 | <combo_box bottom="-40" follows="top|right" left="-230" height="20" width="120" | ||
113 | label="OTR: Not Private" name="otr_combo"/> | ||
114 | <!--[/$PLOTR$]--> | ||
75 | <text_editor type="string" length="1" bg_readonly_color="ChatHistoryBgColor" bg_writeable_color="ChatHistoryBgColor" | 115 | <text_editor type="string" length="1" bg_readonly_color="ChatHistoryBgColor" bg_writeable_color="ChatHistoryBgColor" |
76 | bottom="30" embedded_items="false" enabled="false" | 116 | bottom="30" embedded_items="false" enabled="false" |
77 | follows="left|top|right|bottom" font="SansSerif" height="221" left="5" | 117 | follows="left|top|right|bottom" font="SansSerif" height="221" left="5" |
diff --git a/linden/indra/newview/skins/default/xui/en-us/notifications.xml b/linden/indra/newview/skins/default/xui/en-us/notifications.xml index 320ed18..219f85b 100644 --- a/linden/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/linden/indra/newview/skins/default/xui/en-us/notifications.xml | |||
@@ -6891,6 +6891,27 @@ This ensures that you have the latest information available regarding other clie | |||
6891 | The URL you clicked cannot be opened from this web browser. | 6891 | The URL you clicked cannot be opened from this web browser. |
6892 | </notification> | 6892 | </notification> |
6893 | 6893 | ||
6894 | <!--[$PLOTR$]--> | ||
6895 | <notification | ||
6896 | icon="notify.tga" | ||
6897 | name="QueryEmeraldOTR" | ||
6898 | type="alertmodal"> | ||
6899 | OTR encrypts your IMs so they can't be read by anyone other than the person you are talking to. | ||
6900 | |||
6901 | Do you want to automatically secure your IMs? | ||
6902 | <form name="form"> | ||
6903 | <button index="0" name="Yes" text="Yes"/> | ||
6904 | <button index="1" name="No" text="No"/> | ||
6905 | </form> | ||
6906 | </notification> | ||
6907 | <!-- These belong in some help page, but there is no similar page in Imprudence (yet?) | ||
6908 | |||
6909 | OTR - This is automatic encryption of your IM's to prevent sniffers from spying. | ||
6910 | Strongly recommended to use Require OTR setting. | ||
6911 | Typing stop packets - sends encrypted messages differently so they do not wind up in offline emails. | ||
6912 | |||
6913 | --> | ||
6914 | <!--[/$PLOTR$]--> | ||
6894 | <!--Begin Imprudence notifications--> | 6915 | <!--Begin Imprudence notifications--> |
6895 | 6916 | ||
6896 | <notification | 6917 | <notification |
@@ -7252,6 +7273,8 @@ Various options for command line features. | |||
7252 | To use a command, type it in your chat bar (Local Chat) and press enter. | 7273 | To use a command, type it in your chat bar (Local Chat) and press enter. |
7253 | </notification> | 7274 | </notification> |
7254 | 7275 | ||
7276 | |||
7277 | |||
7255 | <notification | 7278 | <notification |
7256 | icon="alertmodal.tga" | 7279 | icon="alertmodal.tga" |
7257 | label="Spell Check Help" | 7280 | label="Spell Check Help" |
diff --git a/linden/indra/newview/skins/default/xui/en-us/otr_floater_smp_dialog.xml b/linden/indra/newview/skins/default/xui/en-us/otr_floater_smp_dialog.xml new file mode 100644 index 0000000..73d2caa --- /dev/null +++ b/linden/indra/newview/skins/default/xui/en-us/otr_floater_smp_dialog.xml | |||
@@ -0,0 +1,131 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <!--[$PLOTR$]--> | ||
2 | <!--otr_floater_smp_dialog.xml - ui defs for the OTR SMP dialog box | ||
3 | $PLOTR$ See http://www.cypherpunks.ca/otr/ | ||
4 | |||
5 | Copyright (C) 2009 Chris Tuchs | ||
6 | |||
7 | This is free software; you can redistribute it and/or modify it | ||
8 | under the terms of the GNU Lesser General Public License as | ||
9 | published by the Free Software Foundation; either version 2.1 of | ||
10 | the License, or (at your option) any later version. | ||
11 | |||
12 | This is distributed in the hope that it will be useful, but WITHOUT | ||
13 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
14 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
15 | License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with the viewer; if not, write to the Free Software | ||
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
20 | 02111-1307, USA. --> | ||
21 | <floater can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="false" | ||
22 | height="445" min_height="445" width="400" min_width="400" name="otr_floater_smp_dialog" | ||
23 | rect_control="OtrFloaterSmpDialogRect" title="Authenticating Buddy"> | ||
24 | <string name="otr_empty_string"></string> | ||
25 | <string name="otr_smp_I_auth_name" >Authenticating [NAME]</string> | ||
26 | <string name="otr_smp_name_auth_me">[NAME] is authenticating you</string> | ||
27 | <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
28 | drop_shadow_visible="true" font="SansSerif" h_pad="0" v_pad="0" halign="left" | ||
29 | follows="left|top" | ||
30 | height="50" width="370" | ||
31 | left="15" bottom_delta="-80" | ||
32 | mouse_opaque="true" name="otr_smp_why"/> | ||
33 | <string name="otr_smp_why_text"> | ||
34 | Authenticating a buddy helps ensure that the person you are talking to is who he or she claims to be. It also helps ensure that noone else is listening to the private conversation. | ||
35 | </string> | ||
36 | <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
37 | drop_shadow_visible="true" font="SansSerif" h_pad="0" v_pad="0" halign="center" | ||
38 | follows="left|top" | ||
39 | height="20" width="370" | ||
40 | left="15" bottom_delta="-25" | ||
41 | mouse_opaque="true" name="otr_smp_how_text"/> | ||
42 | <string name="otr_smp_how_I_challenge_name" >How would you like to authenticate [NAME]?</string> | ||
43 | <string name="otr_smp_how_name_challenge_me">[NAME] is authenticating you by a</string> | ||
44 | <string name="otr_smp_how_by_qa_challenge" >Question and answer challenge</string> | ||
45 | <string name="otr_smp_how_by_ss_challenge" >Shared secret challenge</string> | ||
46 | <string name="otr_smp_how_by_qa" >Question and answer</string> | ||
47 | <string name="otr_smp_how_by_ss" >Shared secret</string> | ||
48 | <string name="otr_smp_how_by_mfv" >Manual fingerprint verification</string> | ||
49 | <combo_box follows="left|top" | ||
50 | height="20" width="200" | ||
51 | left="100" bottom_delta="-20" | ||
52 | label="Not set yet" halign="left" | ||
53 | name="otr_smp_how_combo"/> | ||
54 | <string name="otr_smp_howto_qa"> | ||
55 | To authenticate using a question, pick a question whose answer is known only to you and your buddy. Enter the question and correct answer, push "Authenticate", then wait for your buddy to enter the answer too. If the answers don't match, then either your buddy made a mistake typing in the answer, or you may be talking to an imposter. | ||
56 | </string> | ||
57 | <string name="otr_smp_howto_qa_t1"> | ||
58 | Enter question here: | ||
59 | </string> | ||
60 | <string name="otr_smp_howto_qa_t2"> | ||
61 | Enter secret answer here (case sensitive): | ||
62 | </string> | ||
63 | <string name="otr_smp_howto_ss"> | ||
64 | To authenticate someone with the shared secret method, you and your buddy should decide on a secret word or phrase in advance. This can be done however you like, but you shouldn't type the phrase directly into your conversation. Enter this secret, push "Authenticate", then wait for your buddy to enter the answer too. If the secrets don't match, then either your buddy made a mistake typing in the secret, or you may be talking to an imposter. | ||
65 | </string> | ||
66 | <string name="otr_smp_howto_ss_t1"> | ||
67 | Enter secret here (case sensitive): | ||
68 | </string> | ||
69 | <string name="otr_smp_howto_ss_t2"></string> | ||
70 | <string name="otr_smp_howto_mfv"> | ||
71 | To authenticate using fingerprints, contact your buddy via some other authenticated channel, such as the telephone or GPG-signed email. Each of you should tell your fingerprint to the other. If everything matches up, you should indicate in the pull-down below that you have verified the fingerprint. | ||
72 | </string> | ||
73 | <string name="otr_smp_howto_mfv_t1">Your fingerprint, tell them this:</string> | ||
74 | <string name="otr_smp_howto_mfv_t2">Their fingerprint, be sure that they tell you this:</string> | ||
75 | <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
76 | drop_shadow_visible="true" font="SansSerif" h_pad="0" v_pad="0" halign="left" | ||
77 | follows="left|top" | ||
78 | height="100" width="370" | ||
79 | left="15" bottom_delta="-110" | ||
80 | mouse_opaque="true" name="otr_smp_howto"> | ||
81 | howto explanation | ||
82 | </text> | ||
83 | <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
84 | drop_shadow_visible="true" font="SansSerif" h_pad="0" v_pad="0" halign="left" | ||
85 | follows="left|top" | ||
86 | height="20" width="370" | ||
87 | left="15" bottom_delta="-50" | ||
88 | mouse_opaque="true" name="otr_smp_label1"> | ||
89 | text label 1 | ||
90 | </text> | ||
91 | <line_editor bevel_style="in" border_style="line" border_thickness="1" | ||
92 | mouse_opaque="true" font="SansSerif" | ||
93 | select_all_on_focus_received="false" select_on_focus="false" | ||
94 | follows="top|right" | ||
95 | height="20" width="370" | ||
96 | left="15" bottom_delta="-20" | ||
97 | label="" max_length="256" | ||
98 | name="otr_smp_edit1"/> | ||
99 | <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
100 | drop_shadow_visible="true" font="SansSerif" h_pad="0" v_pad="0" halign="left" | ||
101 | follows="left|top" | ||
102 | height="20" width="370" | ||
103 | left="15" bottom_delta="-30" | ||
104 | mouse_opaque="true" name="otr_smp_label2"> | ||
105 | text label 2 | ||
106 | </text> | ||
107 | <line_editor bevel_style="in" border_style="line" border_thickness="1" | ||
108 | mouse_opaque="true" font="SansSerif" | ||
109 | select_all_on_focus_received="false" select_on_focus="false" | ||
110 | follows="top|right" | ||
111 | height="20" width="370" | ||
112 | left="15" bottom_delta="-20" | ||
113 | label="" max_length="256" | ||
114 | name="otr_smp_edit2"/> | ||
115 | <string name="otr_smp_veri_no">I have NOT verified their fingerprint.</string> | ||
116 | <string name="otr_smp_veri_yes">I HAVE verified their fingerprint.</string> | ||
117 | <combo_box follows="left|top" | ||
118 | height="20" width="210" | ||
119 | left="175" bottom_delta="-40" | ||
120 | label="" halign="left" | ||
121 | name="otr_smp_veri_combo"/> | ||
122 | <button bottom="-435" follows="left|bottom" font="SansSerif" halign="center" | ||
123 | height="20" label="Help" label_selected="Help" left="20" | ||
124 | mouse_opaque="true" name="otr_smp_help_btn" width="60" /> | ||
125 | <button bottom="-435" follows="right|bottom" font="SansSerif" halign="center" | ||
126 | height="20" label="Authenticate" label_selected="Authenticate" left="292" | ||
127 | mouse_opaque="true" name="otr_smp_auth_btn" width="88" /> | ||
128 | <button bottom="-435" follows="right|bottom" font="SansSerif" halign="center" | ||
129 | height="20" label="Cancel" label_selected="Cancel" left_delta="-65" | ||
130 | mouse_opaque="true" name="otr_smp_cancel_btn" width="60" /> | ||
131 | </floater> <!--[/$PLOTR$]--> | ||
diff --git a/linden/indra/newview/skins/default/xui/en-us/otr_floater_smp_progress.xml b/linden/indra/newview/skins/default/xui/en-us/otr_floater_smp_progress.xml new file mode 100644 index 0000000..dde8f4c --- /dev/null +++ b/linden/indra/newview/skins/default/xui/en-us/otr_floater_smp_progress.xml | |||
@@ -0,0 +1,52 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" standalone="yes" ?> <!--[$PLOTR$]--> | ||
2 | <!--otr_floater_smp_progress.xml - ui defs for the OTR SMP progress dialog box | ||
3 | $PLOTR$ See http://www.cypherpunks.ca/otr/ | ||
4 | |||
5 | Copyright (C) 2009 Chris Tuchs | ||
6 | |||
7 | This is free software; you can redistribute it and/or modify it | ||
8 | under the terms of the GNU Lesser General Public License as | ||
9 | published by the Free Software Foundation; either version 2.1 of | ||
10 | the License, or (at your option) any later version. | ||
11 | |||
12 | This is distributed in the hope that it will be useful, but WITHOUT | ||
13 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
14 | or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public | ||
15 | License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with the viewer; if not, write to the Free Software | ||
19 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
20 | 02111-1307, USA. --> | ||
21 | <floater can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="false" | ||
22 | height="200" min_height="200" width="400" min_width="400" name="otr_floater_smp_prog" | ||
23 | rect_control="OtrFloaterSmpProgRect" title="Authenticating Buddy"> | ||
24 | <text bg_visible="false" border_drop_shadow_visible="false" border_visible="false" | ||
25 | drop_shadow_visible="true" font="SansSerif" h_pad="0" v_pad="0" halign="center" | ||
26 | follows="left|top" | ||
27 | height="40" width="370" | ||
28 | left="15" bottom="-85" | ||
29 | mouse_opaque="true" name="otr_smp_prog_status">Authenticating buddy...</text> | ||
30 | <string name="otr_smp_prog_I_auth_them" >Authenticating your buddy...</string> | ||
31 | <string name="otr_smp_prog_they_auth_me" >Your buddy is authenticating you...</string> | ||
32 | <string name="otr_smp_prog_I_auth_name" >Authenticating [NAME]...</string> | ||
33 | <string name="otr_smp_prog_name_auth_me" >[NAME] is authenticating you...</string> | ||
34 | <string name="otr_smp_prog_auth_aborted" >Authentication aborted</string> | ||
35 | <string name="otr_smp_prog_auth_failed" >Authentication failed</string> | ||
36 | <string name="otr_smp_prog_auth_errored" >Authentication error</string> | ||
37 | <string name="otr_smp_prog_auth_ok" >Authenticated!</string> | ||
38 | <string name="otr_smp_prog_auth_ok_name_next">You are authenticated! Now you may want to authenticate [NAME].</string> | ||
39 | <progress_bar name="otr_smp_prog_progress_bar" color="255,255,255,245" | ||
40 | height="20" | ||
41 | bottom="-110" left="45" right="-45" | ||
42 | follows="left|right|top" /> | ||
43 | <button bottom="-185" follows="left|bottom" font="SansSerif" halign="center" | ||
44 | height="20" label="Help" label_selected="Help" left="20" | ||
45 | mouse_opaque="true" name="otr_smp_prog_help_btn" width="60" /> | ||
46 | <button bottom="-185" follows="right|bottom" font="SansSerif" halign="center" | ||
47 | height="20" label="OK" label_selected="OK" left="320" | ||
48 | mouse_opaque="true" name="otr_smp_prog_ok_btn" width="60" /> | ||
49 | <button bottom="-185" follows="right|bottom" font="SansSerif" halign="center" | ||
50 | height="20" label="Cancel" label_selected="Cancel" left_delta="-65" | ||
51 | mouse_opaque="true" name="otr_smp_prog_cancel_btn" width="60" /> | ||
52 | </floater> <!--[/$PLOTR$]--> | ||
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml index 1b771b5..94e5c6a 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_advanced.xml | |||
@@ -3,6 +3,7 @@ | |||
3 | height="408" label="Advanced" left="102" mouse_opaque="true" | 3 | height="408" label="Advanced" left="102" mouse_opaque="true" |
4 | name="advanced_panel" width="517"> | 4 | name="advanced_panel" width="517"> |
5 | <!-- Start organizing these when we get enough of 'em - MC --> | 5 | <!-- Start organizing these when we get enough of 'em - MC --> |
6 | <!-- The time is now! Chris Tuchs --> | ||
6 | <tab_container label="Page 2" bottom="0" height="450" left="0" mouse_opaque="false" | 7 | <tab_container label="Page 2" bottom="0" height="450" left="0" mouse_opaque="false" |
7 | name="tab2" tab_min_width="50" tab_position="top" width="495" bg_opaque_color="0,0,0,0.0"> | 8 | name="tab2" tab_min_width="50" tab_position="top" width="495" bg_opaque_color="0,0,0,0.0"> |
8 | 9 | ||
@@ -180,5 +181,47 @@ To use spellcheck, right-click a misspelled word | |||
180 | bottom_delta="-50" width="180" height="20" font="SansSerifSmall" follows="left|top"/> | 181 | bottom_delta="-50" width="180" height="20" font="SansSerifSmall" follows="left|top"/> |
181 | </panel> | 182 | </panel> |
182 | 183 | ||
184 | <!--[$PLOTR$]--> | ||
185 | <panel border="true" bottom="-580" follows="left|top|right|bottom" | ||
186 | height="525" label="SpellCheck" | ||
187 | left="1" mouse_opaque="true" name="SpellCheck" width="418"> | ||
188 | <button bottom_delta="0" follows="left|top" font="SansSerifSmall" | ||
189 | height="18" right="470" | ||
190 | name="otr_help_btn" width="98" label="What is OTR?"/> | ||
191 | <radio_group bottom="-120" draw_border="false" enabled="true" follows="left|top" | ||
192 | height="80" | ||
193 | left="270" mouse_opaque="true" name="EmeraldUseOTR" width="160"> | ||
194 | <radio_item type="string" length="1" bottom_delta="-10" enabled="true" height="16" | ||
195 | left_delta="0" mouse_opaque="true" name="0" width="98" | ||
196 | tool_tip="Require use of OTR in IMs" | ||
197 | >Require use of OTR in IMs</radio_item> | ||
198 | <radio_item type="string" length="1" bottom_delta="-10" enabled="true" height="16" | ||
199 | left_delta="0" mouse_opaque="true" name="1" width="98" | ||
200 | tool_tip="Request OTR if available." | ||
201 | >Request OTR if available</radio_item> | ||
202 | <radio_item type="string" length="1" bottom_delta="-10" enabled="true" height="16" | ||
203 | left_delta="0" mouse_opaque="true" name="2" width="98" | ||
204 | tool_tip="Accept OTR requests." | ||
205 | >Accept OTR requests</radio_item> | ||
206 | <radio_item type="string" length="1" bottom_delta="-10" enabled="true" height="16" | ||
207 | left_delta="0" mouse_opaque="true" name="3" width="98" | ||
208 | tool_tip="Decline use of OTR." | ||
209 | >Decline use of OTR</radio_item> | ||
210 | </radio_group> | ||
211 | <check_box follows="left|top" left="270" bottom_delta="-20" enabled="true" | ||
212 | font="SansSerifSmall" | ||
213 | height="16" initial_value="false" mouse_opaque="true" | ||
214 | name="EmeraldOTRInTypingStop-toggle" | ||
215 | radio_style="false" width="98" | ||
216 | control_name="EmeraldOTRInTypingStop" | ||
217 | tool_tip="Put all OTR encrypted messages into IM_TYPING_STOP packets to prevent encrypted IM's from going to email." | ||
218 | label="Use typing_stop for OTR"/> | ||
219 | <!--<view_border bevel_style="none" border_thickness="1" bottom_delta="40" | ||
220 | follows="top|left" height="100" | ||
221 | left="260" name="OTRBorder" width="0"/>--> | ||
222 | |||
223 | </panel> | ||
224 | <!--[/$PLOTR$]--> | ||
225 | |||
183 | </tab_container> | 226 | </tab_container> |
184 | </panel> | 227 | </panel> |