diff options
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llimview.cpp | 205 |
1 files changed, 179 insertions, 26 deletions
diff --git a/linden/indra/newview/llimview.cpp b/linden/indra/newview/llimview.cpp index 02578d2..111852d 100644 --- a/linden/indra/newview/llimview.cpp +++ b/linden/indra/newview/llimview.cpp | |||
@@ -32,29 +32,37 @@ | |||
32 | 32 | ||
33 | #include "llfontgl.h" | 33 | #include "llfontgl.h" |
34 | #include "llrect.h" | 34 | #include "llrect.h" |
35 | #include "lldbstrings.h" | ||
35 | #include "llerror.h" | 36 | #include "llerror.h" |
36 | #include "llbutton.h" | 37 | #include "llbutton.h" |
38 | #include "llsdutil.h" | ||
37 | #include "llstring.h" | 39 | #include "llstring.h" |
38 | #include "linked_lists.h" | 40 | #include "linked_lists.h" |
39 | #include "llvieweruictrlfactory.h" | 41 | #include "llvieweruictrlfactory.h" |
40 | 42 | ||
41 | #include "llagent.h" | 43 | #include "llagent.h" |
42 | #include "llcallingcard.h" | 44 | #include "llcallingcard.h" |
45 | #include "llchat.h" | ||
43 | #include "llviewerwindow.h" | 46 | #include "llviewerwindow.h" |
44 | #include "llresmgr.h" | 47 | #include "llresmgr.h" |
48 | #include "llfloaterchat.h" | ||
45 | #include "llfloaternewim.h" | 49 | #include "llfloaternewim.h" |
50 | #include "llhttpclient.h" | ||
46 | #include "llhttpnode.h" | 51 | #include "llhttpnode.h" |
47 | #include "llimpanel.h" | 52 | #include "llimpanel.h" |
48 | #include "llresizebar.h" | 53 | #include "llresizebar.h" |
49 | #include "lltabcontainer.h" | 54 | #include "lltabcontainer.h" |
50 | #include "viewer.h" | 55 | #include "viewer.h" |
51 | #include "llfloater.h" | 56 | #include "llfloater.h" |
57 | #include "llmutelist.h" | ||
52 | #include "llresizehandle.h" | 58 | #include "llresizehandle.h" |
53 | #include "llkeyboard.h" | 59 | #include "llkeyboard.h" |
54 | #include "llui.h" | 60 | #include "llui.h" |
55 | #include "llviewermenu.h" | 61 | #include "llviewermenu.h" |
56 | #include "llcallingcard.h" | 62 | #include "llcallingcard.h" |
57 | #include "lltoolbar.h" | 63 | #include "lltoolbar.h" |
64 | #include "llviewermessage.h" | ||
65 | #include "llviewerregion.h" | ||
58 | 66 | ||
59 | const EInstantMessage GROUP_DIALOG = IM_SESSION_GROUP_START; | 67 | const EInstantMessage GROUP_DIALOG = IM_SESSION_GROUP_START; |
60 | const EInstantMessage DEFAULT_DIALOG = IM_NOTHING_SPECIAL; | 68 | const EInstantMessage DEFAULT_DIALOG = IM_NOTHING_SPECIAL; |
@@ -149,11 +157,9 @@ BOOL LLFloaterIM::postBuild() | |||
149 | sErrorStringsMap["no_user_911"] = | 157 | sErrorStringsMap["no_user_911"] = |
150 | childGetText("user_no_help"); | 158 | childGetText("user_no_help"); |
151 | 159 | ||
152 | sEventStringsMap["add"] = childGetText("add_session_event");; | 160 | sEventStringsMap["add"] = childGetText("add_session_event"); |
153 | sEventStringsMap["message"] = | 161 | sEventStringsMap["message"] = |
154 | childGetText("message_session_event");; | 162 | childGetText("message_session_event"); |
155 | sEventStringsMap["teleport"] = | ||
156 | childGetText("teleport_session_event");; | ||
157 | 163 | ||
158 | sForceCloseSessionMap["removed"] = | 164 | sForceCloseSessionMap["removed"] = |
159 | childGetText("removed_from_group"); | 165 | childGetText("removed_from_group"); |
@@ -377,10 +383,10 @@ void LLIMView::addMessage( | |||
377 | //if we have recently requsted to be dropped from a session | 383 | //if we have recently requsted to be dropped from a session |
378 | //but are still receiving messages from the session, don't make | 384 | //but are still receiving messages from the session, don't make |
379 | //a new floater | 385 | //a new floater |
380 | // if ( mSessionsDropRequested.has(session_id.asString()) ) | 386 | if ( mSessionsDropRequested.has(session_id.asString()) ) |
381 | // { | 387 | { |
382 | // return ; | 388 | return ; |
383 | // } | 389 | } |
384 | 390 | ||
385 | const char* name = from; | 391 | const char* name = from; |
386 | if(session_name && (strlen(session_name)>1)) | 392 | if(session_name && (strlen(session_name)>1)) |
@@ -543,10 +549,10 @@ void LLIMView::removeSession(const LLUUID& session_id) | |||
543 | //mTabContainer->removeTabPanel(floater); | 549 | //mTabContainer->removeTabPanel(floater); |
544 | } | 550 | } |
545 | 551 | ||
546 | // if ( session_id.notNull() ) | 552 | if ( session_id.notNull() && floater->getDialogType() != IM_NOTHING_SPECIAL ) |
547 | // { | 553 | { |
548 | // mSessionsDropRequested[session_id.asString()] = LLSD(); | 554 | mSessionsDropRequested[session_id.asString()] = LLSD(); |
549 | // } | 555 | } |
550 | } | 556 | } |
551 | 557 | ||
552 | void LLIMView::refresh() | 558 | void LLIMView::refresh() |
@@ -851,9 +857,10 @@ public: | |||
851 | desc.source(__FILE__, __LINE__); | 857 | desc.source(__FILE__, __LINE__); |
852 | } | 858 | } |
853 | 859 | ||
854 | virtual void post(ResponsePtr response, | 860 | virtual void post( |
855 | const LLSD& context, | 861 | ResponsePtr response, |
856 | const LLSD& input) const | 862 | const LLSD& context, |
863 | const LLSD& input) const | ||
857 | { | 864 | { |
858 | LLSD body; | 865 | LLSD body; |
859 | LLUUID temp_session_id; | 866 | LLUUID temp_session_id; |
@@ -867,8 +874,9 @@ public: | |||
867 | if ( success ) | 874 | if ( success ) |
868 | { | 875 | { |
869 | session_id = body["session_id"].asUUID(); | 876 | session_id = body["session_id"].asUUID(); |
870 | gIMView->updateFloaterSessionID(temp_session_id, | 877 | gIMView->updateFloaterSessionID( |
871 | session_id); | 878 | temp_session_id, |
879 | session_id); | ||
872 | } | 880 | } |
873 | else | 881 | else |
874 | { | 882 | { |
@@ -883,11 +891,11 @@ public: | |||
883 | sErrorStringsMap[body["error"].asString()]; | 891 | sErrorStringsMap[body["error"].asString()]; |
884 | args["[RECIPIENT]"] = floater->getTitle(); | 892 | args["[RECIPIENT]"] = floater->getTitle(); |
885 | 893 | ||
886 | gViewerWindow->alertXml("IMSessionStartError", | 894 | gViewerWindow->alertXml( |
887 | args, | 895 | "IMSessionStartError", |
888 | onConfirmForceCloseError, | 896 | args, |
889 | floater); | 897 | onConfirmForceCloseError, |
890 | 898 | floater); | |
891 | } | 899 | } |
892 | } | 900 | } |
893 | } | 901 | } |
@@ -990,18 +998,163 @@ public: | |||
990 | } | 998 | } |
991 | }; | 999 | }; |
992 | 1000 | ||
1001 | class LLViewerChatterBoxSessionAgentListUpdates : public LLHTTPNode | ||
1002 | { | ||
1003 | public: | ||
1004 | virtual void post( | ||
1005 | ResponsePtr responder, | ||
1006 | const LLSD& context, | ||
1007 | const LLSD& input) const | ||
1008 | { | ||
1009 | } | ||
1010 | }; | ||
1011 | |||
1012 | class LLViewerChatterBoxInvitation : public LLHTTPNode | ||
1013 | { | ||
1014 | public: | ||
1015 | virtual void post( | ||
1016 | ResponsePtr responder, | ||
1017 | const LLSD& context, | ||
1018 | const LLSD& input) const | ||
1019 | { | ||
1020 | if ( input["body"].has("instantmessage") ) | ||
1021 | { | ||
1022 | LLSD message_params = | ||
1023 | input["body"]["instantmessage"]["message_params"]; | ||
1024 | |||
1025 | //this is just replicated code from process_improved_im | ||
1026 | //and should really go in it's own function -jwolk | ||
1027 | if (gNoRender) | ||
1028 | { | ||
1029 | return; | ||
1030 | } | ||
1031 | |||
1032 | char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */ | ||
1033 | LLChat chat; | ||
1034 | |||
1035 | std::string message = message_params["message"].asString(); | ||
1036 | std::string name = message_params["from_name"].asString(); | ||
1037 | LLUUID from_id = message_params["from_id"].asUUID(); | ||
1038 | LLUUID session_id = message_params["id"].asUUID(); | ||
1039 | std::vector<U8> bin_bucket = message_params["data"]["binary_bucket"].asBinary(); | ||
1040 | U8 offline = (U8)message_params["offline"].asInteger(); | ||
1041 | |||
1042 | time_t timestamp = | ||
1043 | (time_t) message_params["timestamp"].asInteger(); | ||
1044 | |||
1045 | BOOL is_busy = gAgent.getBusy(); | ||
1046 | BOOL is_muted = gMuteListp->isMuted(from_id, name); | ||
1047 | BOOL is_linden = gMuteListp->isLinden( | ||
1048 | name.c_str()); | ||
1049 | char separator_string[3]=": "; /* Flawfinder: ignore */ | ||
1050 | int message_offset=0; | ||
1051 | |||
1052 | //Handle IRC styled /me messages. | ||
1053 | if (!strncmp(message.c_str(), "/me ", 4) || | ||
1054 | !strncmp(message.c_str(), "/me'", 4)) | ||
1055 | { | ||
1056 | strcpy(separator_string,""); /* Flawfinder: ignore */ | ||
1057 | message_offset = 3; | ||
1058 | } | ||
1059 | |||
1060 | chat.mMuted = is_muted && !is_linden; | ||
1061 | chat.mFromID = from_id; | ||
1062 | chat.mFromName = name; | ||
1063 | if (!is_linden && is_busy) | ||
1064 | { | ||
1065 | return; | ||
1066 | } | ||
1067 | |||
1068 | // standard message, not from system | ||
1069 | char saved[MAX_STRING]; /* Flawfinder: ignore */ | ||
1070 | saved[0] = '\0'; | ||
1071 | if(offline == IM_OFFLINE) | ||
1072 | { | ||
1073 | char time_buf[TIME_STR_LENGTH]; /* Flawfinder: ignore */ | ||
1074 | snprintf(saved, /* Flawfinder: ignore */ | ||
1075 | MAX_STRING, | ||
1076 | "(Saved %s) ", | ||
1077 | formatted_time(timestamp, time_buf)); | ||
1078 | } | ||
1079 | snprintf( | ||
1080 | buffer, | ||
1081 | sizeof(buffer), | ||
1082 | "%s%s%s%s", | ||
1083 | name.c_str(), | ||
1084 | separator_string, | ||
1085 | saved, | ||
1086 | (message.c_str() + message_offset)); /*Flawfinder: ignore*/ | ||
1087 | |||
1088 | BOOL is_this_agent = FALSE; | ||
1089 | if(from_id == gAgentID) | ||
1090 | { | ||
1091 | from_id = LLUUID::null; | ||
1092 | is_this_agent = TRUE; | ||
1093 | } | ||
1094 | gIMView->addMessage( | ||
1095 | session_id, | ||
1096 | from_id, | ||
1097 | name.c_str(), | ||
1098 | buffer, | ||
1099 | (char*)&bin_bucket[0], | ||
1100 | IM_SESSION_INVITE, | ||
1101 | message_params["parent_estate_id"].asInteger(), | ||
1102 | message_params["region_id"].asUUID(), | ||
1103 | ll_vector3_from_sd(message_params["position"])); | ||
1104 | |||
1105 | snprintf( | ||
1106 | buffer, | ||
1107 | sizeof(buffer), | ||
1108 | "IM: %s%s%s%s", | ||
1109 | name.c_str(), | ||
1110 | separator_string, | ||
1111 | saved, | ||
1112 | (message.c_str()+message_offset)); /* Flawfinder: ignore */ | ||
1113 | chat.mText = buffer; | ||
1114 | LLFloaterChat::addChat(chat, TRUE, is_this_agent); | ||
1115 | |||
1116 | //if we succesfully accepted the invitation | ||
1117 | //send a message back down | ||
1118 | |||
1119 | //TODO - When availble, have this response just be part | ||
1120 | //of an automatic response system | ||
1121 | std::string url = gAgent.getRegion()->getCapability( | ||
1122 | "ChatSessionRequest"); | ||
1123 | |||
1124 | if ( url != "" ) | ||
1125 | { | ||
1126 | LLSD data; | ||
1127 | data["method"] = "accept invitation"; | ||
1128 | data["session-id"] = input["body"]["session_id"]; | ||
1129 | LLHTTPClient::post( | ||
1130 | url, | ||
1131 | data, | ||
1132 | NULL); | ||
1133 | } | ||
1134 | } //end if invitation has instant message | ||
1135 | } | ||
1136 | }; | ||
1137 | |||
993 | LLHTTPRegistration<LLViewerIMSessionStartReply> | 1138 | LLHTTPRegistration<LLViewerIMSessionStartReply> |
994 | gHTTPRegistrationMessageImsessionstartreply( | 1139 | gHTTPRegistrationMessageImsessionstartreply( |
995 | "/message/IMSessionStartReply"); | 1140 | "/message/ChatterBoxSessionStartReply"); |
996 | 1141 | ||
997 | LLHTTPRegistration<LLViewerIMSessionEventReply> | 1142 | LLHTTPRegistration<LLViewerIMSessionEventReply> |
998 | gHTTPRegistrationMessageImsessioneventreply( | 1143 | gHTTPRegistrationMessageImsessioneventreply( |
999 | "/message/IMSessionEventReply"); | 1144 | "/message/ChatterBoxSessionEventReply"); |
1000 | 1145 | ||
1001 | LLHTTPRegistration<LLViewerForceCloseIMSession> | 1146 | LLHTTPRegistration<LLViewerForceCloseIMSession> |
1002 | gHTTPRegistrationMessageForceCloseImSession( | 1147 | gHTTPRegistrationMessageForceCloseImSession( |
1003 | "/message/ForceCloseIMSession"); | 1148 | "/message/ForceCloseChatterBoxSession"); |
1004 | 1149 | ||
1005 | LLHTTPRegistration<LLViewerIMSessionDropReply> | 1150 | LLHTTPRegistration<LLViewerIMSessionDropReply> |
1006 | gHTTPRegistrationMessageImSessionDropReply( | 1151 | gHTTPRegistrationMessageImSessionDropReply( |
1007 | "/message/IMSessionDropReply"); | 1152 | "/message/ChatterBoxSessionLeaveReply"); |
1153 | |||
1154 | LLHTTPRegistration<LLViewerChatterBoxSessionAgentListUpdates> | ||
1155 | gHTTPRegistrationMessageChatterboxsessionagentlistupdates( | ||
1156 | "/message/ChatterBoxSessionAgentListUpdates"); | ||
1157 | |||
1158 | LLHTTPRegistration<LLViewerChatterBoxInvitation> | ||
1159 | gHTTPRegistrationMessageChatterBoxInvitation( | ||
1160 | "/message/ChatterBoxInvitation"); | ||