diff options
Diffstat (limited to 'linden/indra/newview/llviewermessage.cpp')
-rw-r--r-- | linden/indra/newview/llviewermessage.cpp | 920 |
1 files changed, 448 insertions, 472 deletions
diff --git a/linden/indra/newview/llviewermessage.cpp b/linden/indra/newview/llviewermessage.cpp index 7cc833a..f79730b 100644 --- a/linden/indra/newview/llviewermessage.cpp +++ b/linden/indra/newview/llviewermessage.cpp | |||
@@ -1,3 +1,4 @@ | |||
1 | |||
1 | /** | 2 | /** |
2 | * @file llviewermessage.cpp | 3 | * @file llviewermessage.cpp |
3 | * @brief Dumping ground for viewer-side message system callbacks. | 4 | * @brief Dumping ground for viewer-side message system callbacks. |
@@ -48,7 +49,6 @@ | |||
48 | #include "llfilepicker.h" | 49 | #include "llfilepicker.h" |
49 | #include "llfocusmgr.h" | 50 | #include "llfocusmgr.h" |
50 | #include "llfollowcamparams.h" | 51 | #include "llfollowcamparams.h" |
51 | #include "llfloaterreleasemsg.h" | ||
52 | #include "llinstantmessage.h" | 52 | #include "llinstantmessage.h" |
53 | #include "llquantize.h" | 53 | #include "llquantize.h" |
54 | #include "llregionflags.h" | 54 | #include "llregionflags.h" |
@@ -85,7 +85,6 @@ | |||
85 | #include "llfloatermute.h" | 85 | #include "llfloatermute.h" |
86 | #include "llfloaterpostcard.h" | 86 | #include "llfloaterpostcard.h" |
87 | #include "llfloaterpreference.h" | 87 | #include "llfloaterpreference.h" |
88 | #include "llfloaterreleasemsg.h" | ||
89 | #include "llfollowcam.h" | 88 | #include "llfollowcam.h" |
90 | #include "llgroupnotify.h" | 89 | #include "llgroupnotify.h" |
91 | #include "llhudeffect.h" | 90 | #include "llhudeffect.h" |
@@ -108,6 +107,7 @@ | |||
108 | #include "lltool.h" | 107 | #include "lltool.h" |
109 | #include "lltoolbar.h" | 108 | #include "lltoolbar.h" |
110 | #include "lltoolmgr.h" | 109 | #include "lltoolmgr.h" |
110 | #include "lltrans.h" | ||
111 | #include "llui.h" // for make_ui_sound | 111 | #include "llui.h" // for make_ui_sound |
112 | #include "lluploaddialog.h" | 112 | #include "lluploaddialog.h" |
113 | #include "llviewercamera.h" | 113 | #include "llviewercamera.h" |
@@ -159,6 +159,9 @@ extern BOOL gDebugClicks; | |||
159 | void open_offer(const std::vector<LLUUID>& items, const std::string& from_name); | 159 | void open_offer(const std::vector<LLUUID>& items, const std::string& from_name); |
160 | void friendship_offer_callback(S32 option, void* user_data); | 160 | void friendship_offer_callback(S32 option, void* user_data); |
161 | bool check_offer_throttle(const std::string& from_name, bool check_only); | 161 | bool check_offer_throttle(const std::string& from_name, bool check_only); |
162 | void callbackCacheEstateOwnerName(const LLUUID& id, | ||
163 | const std::string& first, const std::string& last, | ||
164 | BOOL is_group, void*); | ||
162 | 165 | ||
163 | //inventory offer throttle globals | 166 | //inventory offer throttle globals |
164 | LLFrameTimer gThrottleTimer; | 167 | LLFrameTimer gThrottleTimer; |
@@ -166,7 +169,7 @@ const U32 OFFER_THROTTLE_MAX_COUNT=5; //number of items per time period | |||
166 | const F32 OFFER_THROTTLE_TIME=10.f; //time period in seconds | 169 | const F32 OFFER_THROTTLE_TIME=10.f; //time period in seconds |
167 | 170 | ||
168 | //script permissions | 171 | //script permissions |
169 | const LLString SCRIPT_QUESTIONS[SCRIPT_PERMISSION_EOF] = | 172 | const std::string SCRIPT_QUESTIONS[SCRIPT_PERMISSION_EOF] = |
170 | { | 173 | { |
171 | "ScriptTakeMoney", | 174 | "ScriptTakeMoney", |
172 | "ActOnControlInputs", | 175 | "ActOnControlInputs", |
@@ -198,7 +201,7 @@ struct LLFriendshipOffer | |||
198 | // | 201 | // |
199 | 202 | ||
200 | void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group, | 203 | void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_group, |
201 | S32 trx_type, const LLString& desc) | 204 | S32 trx_type, const std::string& desc) |
202 | { | 205 | { |
203 | if(0 == amount) return; | 206 | if(0 == amount) return; |
204 | amount = abs(amount); | 207 | amount = abs(amount); |
@@ -219,7 +222,7 @@ void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_ | |||
219 | msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY); | 222 | msg->addU8Fast(_PREHASH_AggregatePermNextOwner, (U8)LLAggregatePermissions::AP_EMPTY); |
220 | msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY); | 223 | msg->addU8Fast(_PREHASH_AggregatePermInventory, (U8)LLAggregatePermissions::AP_EMPTY); |
221 | msg->addS32Fast(_PREHASH_TransactionType, trx_type ); | 224 | msg->addS32Fast(_PREHASH_TransactionType, trx_type ); |
222 | msg->addStringFast(_PREHASH_Description, desc.c_str()); | 225 | msg->addStringFast(_PREHASH_Description, desc); |
223 | msg->sendReliable(region->getHost()); | 226 | msg->sendReliable(region->getHost()); |
224 | } | 227 | } |
225 | else | 228 | else |
@@ -324,194 +327,191 @@ void process_layer_data(LLMessageSystem *mesgsys, void **user_data) | |||
324 | } | 327 | } |
325 | } | 328 | } |
326 | 329 | ||
327 | S32 exported_object_count = 0; | 330 | // S32 exported_object_count = 0; |
328 | S32 exported_image_count = 0; | 331 | // S32 exported_image_count = 0; |
329 | S32 current_object_count = 0; | 332 | // S32 current_object_count = 0; |
330 | S32 current_image_count = 0; | 333 | // S32 current_image_count = 0; |
331 | 334 | ||
332 | extern LLNotifyBox *gExporterNotify; | 335 | // extern LLNotifyBox *gExporterNotify; |
333 | extern LLUUID gExporterRequestID; | 336 | // extern LLUUID gExporterRequestID; |
334 | extern LLString gExportDirectory; | 337 | // extern std::string gExportDirectory; |
335 | 338 | ||
336 | extern LLUploadDialog *gExportDialog; | 339 | // extern LLUploadDialog *gExportDialog; |
337 | 340 | ||
338 | LLString gExportedFile; | 341 | // std::string gExportedFile; |
339 | 342 | ||
340 | std::map<LLUUID, LLString> gImageChecksums; | 343 | // std::map<LLUUID, std::string> gImageChecksums; |
341 | 344 | ||
342 | void export_complete() | 345 | // void export_complete() |
343 | { | 346 | // { |
344 | LLUploadDialog::modalUploadFinished(); | 347 | // LLUploadDialog::modalUploadFinished(); |
345 | gExporterRequestID.setNull(); | 348 | // gExporterRequestID.setNull(); |
346 | gExportDirectory = ""; | 349 | // gExportDirectory = ""; |
347 | 350 | ||
348 | LLFILE* fXML = LLFile::fopen(gExportedFile.c_str(), "rb"); /* Flawfinder: ignore */ | 351 | // LLFILE* fXML = LLFile::fopen(gExportedFile, "rb"); /* Flawfinder: ignore */ |
349 | fseek(fXML, 0, SEEK_END); | 352 | // fseek(fXML, 0, SEEK_END); |
350 | long length = ftell(fXML); | 353 | // long length = ftell(fXML); |
351 | fseek(fXML, 0, SEEK_SET); | 354 | // fseek(fXML, 0, SEEK_SET); |
352 | U8 *buffer = new U8[length + 1]; | 355 | // U8 *buffer = new U8[length + 1]; |
353 | size_t nread = fread(buffer, 1, length, fXML); | 356 | // size_t nread = fread(buffer, 1, length, fXML); |
354 | if (nread < (size_t) length) | 357 | // if (nread < (size_t) length) |
355 | { | 358 | // { |
356 | LL_WARNS("Messaging") << "Short read" << LL_ENDL; | 359 | // llwarns << "Short read" << llendl; |
357 | } | 360 | // } |
358 | buffer[nread] = '\0'; | 361 | // buffer[nread] = '\0'; |
359 | fclose(fXML); | 362 | // fclose(fXML); |
360 | 363 | ||
361 | char *pos = (char *)buffer; | 364 | // char *pos = (char *)buffer; |
362 | while ((pos = strstr(pos+1, "<sl:image ")) != 0) | 365 | // while ((pos = strstr(pos+1, "<sl:image ")) != 0) |
363 | { | 366 | // { |
364 | char *pos_check = strstr(pos, "checksum=\""); | 367 | // char *pos_check = strstr(pos, "checksum=\""); |
365 | 368 | ||
366 | if (pos_check) | 369 | // if (pos_check) |
367 | { | 370 | // { |
368 | char *pos_uuid = strstr(pos_check, "\">"); | 371 | // char *pos_uuid = strstr(pos_check, "\">"); |
369 | 372 | ||
370 | if (pos_uuid) | 373 | // if (pos_uuid) |
371 | { | 374 | // { |
372 | char image_uuid_str[UUID_STR_SIZE]; /* Flawfinder: ignore */ | 375 | // char image_uuid_str[UUID_STR_SIZE]; /* Flawfinder: ignore */ |
373 | memcpy(image_uuid_str, pos_uuid+2, UUID_STR_SIZE-1); /* Flawfinder: ignore */ | 376 | // memcpy(image_uuid_str, pos_uuid+2, UUID_STR_SIZE-1); /* Flawfinder: ignore */ |
374 | image_uuid_str[UUID_STR_SIZE-1] = 0; | 377 | // image_uuid_str[UUID_STR_SIZE-1] = 0; |
375 | 378 | ||
376 | LLUUID image_uuid(image_uuid_str); | 379 | // LLUUID image_uuid(image_uuid_str); |
377 | 380 | ||
378 | LL_INFOS("Messaging") << "Found UUID: " << image_uuid << LL_ENDL; | 381 | // LL_INFOS("Messaging") << "Found UUID: " << image_uuid << LL_ENDL; |
379 | 382 | ||
380 | std::map<LLUUID, LLString>::iterator itor = gImageChecksums.find(image_uuid); | 383 | // std::map<LLUUID, std::string>::iterator itor = gImageChecksums.find(image_uuid); |
381 | if (itor != gImageChecksums.end()) | 384 | // if (itor != gImageChecksums.end()) |
382 | { | 385 | // { |
383 | LL_INFOS("Messaging") << "Replacing with checksum: " << itor->second << LL_ENDL; | 386 | // LL_INFOS("Messaging") << "Replacing with checksum: " << itor->second << LL_ENDL; |
384 | if (itor->second.c_str() != NULL) | 387 | // if (!itor->second.empty()) |
385 | { | 388 | // { |
386 | memcpy(&pos_check[10], itor->second.c_str(), 32); /* Flawfinder: ignore */ | 389 | // memcpy(&pos_check[10], itor->second.c_str(), 32); /* Flawfinder: ignore */ |
387 | } | 390 | // } |
388 | } | 391 | // } |
389 | } | 392 | // } |
390 | } | 393 | // } |
391 | } | 394 | // } |
392 | 395 | ||
393 | LLFILE* fXMLOut = LLFile::fopen(gExportedFile.c_str(), "wb"); /* Flawfinder: ignore */ | 396 | // LLFILE* fXMLOut = LLFile::fopen(gExportedFile, "wb"); /* Flawfinder: ignore */ |
394 | if (fwrite(buffer, 1, length, fXMLOut) != length) | 397 | // if (fwrite(buffer, 1, length, fXMLOut) != length) |
395 | { | 398 | // { |
396 | LL_WARNS("Messaging") << "Short write" << LL_ENDL; | 399 | // LL_WARNS("Messaging") << "Short write" << LL_ENDL; |
397 | } | 400 | // } |
398 | fclose(fXMLOut); | 401 | // fclose(fXMLOut); |
399 | 402 | ||
400 | delete [] buffer; | 403 | // delete [] buffer; |
401 | } | 404 | // } |
402 | 405 | ||
403 | 406 | ||
404 | void exported_item_complete(const LLTSCode status, void *user_data) | 407 | // void exported_item_complete(const LLTSCode status, void *user_data) |
405 | { | 408 | // { |
406 | //LLString *filename = (LLString *)user_data; | 409 | // //std::string *filename = (std::string *)user_data; |
407 | 410 | ||
408 | if (status < LLTS_OK) | 411 | // if (status < LLTS_OK) |
409 | { | 412 | // { |
410 | LL_WARNS("Messaging") << "Export failed!" << LL_ENDL; | 413 | // LL_WARNS("Messaging") << "Export failed!" << LL_ENDL; |
411 | } | 414 | // } |
412 | else | 415 | // else |
413 | { | 416 | // { |
414 | ++current_object_count; | 417 | // ++current_object_count; |
415 | if (current_image_count == exported_image_count && current_object_count == exported_object_count) | 418 | // if (current_image_count == exported_image_count && current_object_count == exported_object_count) |
416 | { | 419 | // { |
417 | LL_INFOS("Messaging") << "*** Export complete ***" << LL_ENDL; | 420 | // LL_INFOS("Messaging") << "*** Export complete ***" << LL_ENDL; |
418 | 421 | ||
419 | export_complete(); | 422 | // export_complete(); |
420 | } | 423 | // } |
421 | else | 424 | // else |
422 | { | 425 | // { |
423 | gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count)); | 426 | // gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count)); |
424 | } | 427 | // } |
425 | } | 428 | // } |
426 | } | 429 | // } |
427 | 430 | ||
428 | struct exported_image_info | 431 | // struct exported_image_info |
429 | { | 432 | // { |
430 | LLUUID image_id; | 433 | // LLUUID image_id; |
431 | LLString filename; | 434 | // std::string filename; |
432 | U32 image_num; | 435 | // U32 image_num; |
433 | }; | 436 | // }; |
434 | 437 | ||
435 | void exported_j2c_complete(const LLTSCode status, void *user_data) | 438 | // void exported_j2c_complete(const LLTSCode status, void *user_data) |
436 | { | 439 | // { |
437 | exported_image_info *info = (exported_image_info *)user_data; | 440 | // exported_image_info *info = (exported_image_info *)user_data; |
438 | LLUUID image_id = info->image_id; | 441 | // LLUUID image_id = info->image_id; |
439 | U32 image_num = info->image_num; | 442 | // U32 image_num = info->image_num; |
440 | LLString filename = info->filename; | 443 | // std::string filename = info->filename; |
441 | delete info; | 444 | // delete info; |
442 | 445 | ||
443 | if (status < LLTS_OK) | 446 | // if (status < LLTS_OK) |
444 | { | 447 | // { |
445 | LL_WARNS("Messaging") << "Image download failed!" << LL_ENDL; | 448 | // LL_WARNS("Messaging") << "Image download failed!" << LL_ENDL; |
446 | } | 449 | // } |
447 | else | 450 | // else |
448 | { | 451 | // { |
449 | LLFILE* fIn = LLFile::fopen(filename.c_str(), "rb"); /* Flawfinder: ignore */ | 452 | // LLFILE* fIn = LLFile::fopen(filename, "rb"); /* Flawfinder: ignore */ |
450 | if (fIn) | 453 | // if (fIn) |
451 | { | 454 | // { |
452 | LLPointer<LLImageJ2C> ImageUtility = new LLImageJ2C; | 455 | // LLPointer<LLImageJ2C> ImageUtility = new LLImageJ2C; |
453 | LLPointer<LLImageTGA> TargaUtility = new LLImageTGA; | 456 | // LLPointer<LLImageTGA> TargaUtility = new LLImageTGA; |
454 | 457 | ||
455 | fseek(fIn, 0, SEEK_END); | 458 | // fseek(fIn, 0, SEEK_END); |
456 | S32 length = ftell(fIn); | 459 | // S32 length = ftell(fIn); |
457 | fseek(fIn, 0, SEEK_SET); | 460 | // fseek(fIn, 0, SEEK_SET); |
458 | U8 *buffer = ImageUtility->allocateData(length); | 461 | // U8 *buffer = ImageUtility->allocateData(length); |
459 | if (fread(buffer, 1, length, fIn) != length) | 462 | // if (fread(buffer, 1, length, fIn) != length) |
460 | { | 463 | // { |
461 | LL_WARNS("Messaging") << "Short read" << LL_ENDL; | 464 | // LL_WARNS("Messaging") << "Short read" << LL_ENDL; |
462 | } | 465 | // } |
463 | fclose(fIn); | 466 | // fclose(fIn); |
464 | LLFile::remove(filename.c_str()); | 467 | // LLFile::remove(filename); |
465 | 468 | ||
466 | // Convert to TGA | 469 | // // Convert to TGA |
467 | LLPointer<LLImageRaw> image = new LLImageRaw(); | 470 | // LLPointer<LLImageRaw> image = new LLImageRaw(); |
468 | 471 | ||
469 | ImageUtility->updateData(); | 472 | // ImageUtility->updateData(); |
470 | ImageUtility->decode(image, 100000.0f); | 473 | // ImageUtility->decode(image, 100000.0f); |
471 | 474 | ||
472 | TargaUtility->encode(image); | 475 | // TargaUtility->encode(image); |
473 | U8 *data = TargaUtility->getData(); | 476 | // U8 *data = TargaUtility->getData(); |
474 | S32 data_size = TargaUtility->getDataSize(); | 477 | // S32 data_size = TargaUtility->getDataSize(); |
475 | |||
476 | char *file_path = new char[filename.size()+1]; | ||
477 | strcpy(file_path, filename.c_str()); /* Flawfinder: ignore */ | ||
478 | char *end = strrchr(file_path, gDirUtilp->getDirDelimiter()[0]); | ||
479 | end[0] = 0; | ||
480 | LLString output_file = llformat("%s/image-%03d.tga", file_path, image_num);//filename; | ||
481 | delete [] file_path; | ||
482 | //S32 name_len = output_file.length(); | ||
483 | //strcpy(&output_file[name_len-3], "tga"); | ||
484 | LLFILE* fOut = LLFile::fopen(output_file.c_str(), "wb"); /* Flawfinder: ignore */ | ||
485 | char md5_hash_string[33]; /* Flawfinder: ignore */ | ||
486 | strcpy(md5_hash_string, "00000000000000000000000000000000"); /* Flawfinder: ignore */ | ||
487 | if (fOut) | ||
488 | { | ||
489 | if (fwrite(data, 1, data_size, fOut) != data_size) | ||
490 | { | ||
491 | LL_WARNS("Messaging") << "Short write" << LL_ENDL; | ||
492 | } | ||
493 | fseek(fOut, 0, SEEK_SET); | ||
494 | fclose(fOut); | ||
495 | fOut = LLFile::fopen(output_file.c_str(), "rb"); /* Flawfinder: ignore */ | ||
496 | LLMD5 my_md5_hash(fOut); | ||
497 | my_md5_hash.hex_digest(md5_hash_string); | ||
498 | } | ||
499 | 478 | ||
500 | gImageChecksums.insert(std::pair<LLUUID, LLString>(image_id, md5_hash_string)); | 479 | // std::string file_path = gDirUtilp->getDirName(filename); |
501 | } | 480 | |
502 | } | 481 | // std::string output_file = llformat("%s/image-%03d.tga", file_path.c_str(), image_num);//filename; |
503 | 482 | // //S32 name_len = output_file.length(); | |
504 | ++current_image_count; | 483 | // //strcpy(&output_file[name_len-3], "tga"); |
505 | if (current_image_count == exported_image_count && current_object_count == exported_object_count) | 484 | // LLFILE* fOut = LLFile::fopen(output_file, "wb"); /* Flawfinder: ignore */ |
506 | { | 485 | // char md5_hash_string[33]; /* Flawfinder: ignore */ |
507 | LL_INFOS("Messaging") << "*** Export textures complete ***" << LL_ENDL; | 486 | // strcpy(md5_hash_string, "00000000000000000000000000000000"); /* Flawfinder: ignore */ |
508 | export_complete(); | 487 | // if (fOut) |
509 | } | 488 | // { |
510 | else | 489 | // if (fwrite(data, 1, data_size, fOut) != data_size) |
511 | { | 490 | // { |
512 | gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count)); | 491 | // LL_WARNS("Messaging") << "Short write" << LL_ENDL; |
513 | } | 492 | // } |
514 | } | 493 | // fseek(fOut, 0, SEEK_SET); |
494 | // fclose(fOut); | ||
495 | // fOut = LLFile::fopen(output_file, "rb"); /* Flawfinder: ignore */ | ||
496 | // LLMD5 my_md5_hash(fOut); | ||
497 | // my_md5_hash.hex_digest(md5_hash_string); | ||
498 | // } | ||
499 | |||
500 | // gImageChecksums.insert(std::pair<LLUUID, std::string>(image_id, md5_hash_string)); | ||
501 | // } | ||
502 | // } | ||
503 | |||
504 | // ++current_image_count; | ||
505 | // if (current_image_count == exported_image_count && current_object_count == exported_object_count) | ||
506 | // { | ||
507 | // LL_INFOS("Messaging") << "*** Export textures complete ***" << LL_ENDL; | ||
508 | // export_complete(); | ||
509 | // } | ||
510 | // else | ||
511 | // { | ||
512 | // gExportDialog->setMessage(llformat("Exported %d/%d object files, %d/%d textures.", current_object_count, exported_object_count, current_image_count, exported_image_count)); | ||
513 | // } | ||
514 | //} | ||
515 | 515 | ||
516 | void process_derez_ack(LLMessageSystem*, void**) | 516 | void process_derez_ack(LLMessageSystem*, void**) |
517 | { | 517 | { |
@@ -581,7 +581,7 @@ void join_group_callback(S32 option, void* user_data) | |||
581 | if (option == 2 && data && !data->mGroupID.isNull()) | 581 | if (option == 2 && data && !data->mGroupID.isNull()) |
582 | { | 582 | { |
583 | LLFloaterGroupInfo::showFromUUID(data->mGroupID); | 583 | LLFloaterGroupInfo::showFromUUID(data->mGroupID); |
584 | LLString::format_map_t args; | 584 | LLStringUtil::format_map_t args; |
585 | args["[MESSAGE]"] = data->mMessage; | 585 | args["[MESSAGE]"] = data->mMessage; |
586 | LLNotifyBox::showXml("JoinGroup", args, &join_group_callback, data); | 586 | LLNotifyBox::showXml("JoinGroup", args, &join_group_callback, data); |
587 | return; | 587 | return; |
@@ -599,7 +599,7 @@ void join_group_callback(S32 option, void* user_data) | |||
599 | else | 599 | else |
600 | { | 600 | { |
601 | delete_context_data = FALSE; | 601 | delete_context_data = FALSE; |
602 | LLString::format_map_t args; | 602 | LLStringUtil::format_map_t args; |
603 | args["[NAME]"] = data->mName; | 603 | args["[NAME]"] = data->mName; |
604 | args["[INVITE]"] = data->mMessage; | 604 | args["[INVITE]"] = data->mMessage; |
605 | LLAlertDialog::showXml("JoinedTooManyGroupsMember", args, join_group_callback, (void*)data); | 605 | LLAlertDialog::showXml("JoinedTooManyGroupsMember", args, join_group_callback, (void*)data); |
@@ -613,7 +613,7 @@ void join_group_callback(S32 option, void* user_data) | |||
613 | if (data->mFee > 0) | 613 | if (data->mFee > 0) |
614 | { | 614 | { |
615 | delete_context_data = FALSE; | 615 | delete_context_data = FALSE; |
616 | LLString::format_map_t args; | 616 | LLStringUtil::format_map_t args; |
617 | args["[COST]"] = llformat("%d", data->mFee); | 617 | args["[COST]"] = llformat("%d", data->mFee); |
618 | // Set the fee to 0, so that we don't keep | 618 | // Set the fee to 0, so that we don't keep |
619 | // asking about a fee. | 619 | // asking about a fee. |
@@ -626,8 +626,8 @@ void join_group_callback(S32 option, void* user_data) | |||
626 | else | 626 | else |
627 | { | 627 | { |
628 | send_improved_im(data->mGroupID, | 628 | send_improved_im(data->mGroupID, |
629 | "name", | 629 | std::string("name"), |
630 | "message", | 630 | std::string("message"), |
631 | IM_ONLINE, | 631 | IM_ONLINE, |
632 | IM_GROUP_INVITATION_ACCEPT, | 632 | IM_GROUP_INVITATION_ACCEPT, |
633 | data->mTransactionID); | 633 | data->mTransactionID); |
@@ -636,8 +636,8 @@ void join_group_callback(S32 option, void* user_data) | |||
636 | else if (data) | 636 | else if (data) |
637 | { | 637 | { |
638 | send_improved_im(data->mGroupID, | 638 | send_improved_im(data->mGroupID, |
639 | "name", | 639 | std::string("name"), |
640 | "message", | 640 | std::string("message"), |
641 | IM_ONLINE, | 641 | IM_ONLINE, |
642 | IM_GROUP_INVITATION_DECLINE, | 642 | IM_GROUP_INVITATION_DECLINE, |
643 | data->mTransactionID); | 643 | data->mTransactionID); |
@@ -754,7 +754,7 @@ bool check_offer_throttle(const std::string& from_name, bool check_only) | |||
754 | static U32 throttle_count; | 754 | static U32 throttle_count; |
755 | static bool throttle_logged; | 755 | static bool throttle_logged; |
756 | LLChat chat; | 756 | LLChat chat; |
757 | LLString log_message; | 757 | std::string log_message; |
758 | 758 | ||
759 | if (!gSavedSettings.getBOOL("ShowNewInventory")) | 759 | if (!gSavedSettings.getBOOL("ShowNewInventory")) |
760 | return false; | 760 | return false; |
@@ -828,22 +828,24 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name) | |||
828 | { | 828 | { |
829 | continue; | 829 | continue; |
830 | } | 830 | } |
831 | LLAssetType::EType asset_type = item->getType(); | ||
832 | |||
831 | //if we are throttled, don't display them - Gigs | 833 | //if we are throttled, don't display them - Gigs |
832 | if (check_offer_throttle(from_name, false)) | 834 | if (check_offer_throttle(from_name, false)) |
833 | { | 835 | { |
834 | // I'm not sure this is a good idea. JC | 836 | // I'm not sure this is a good idea. JC |
835 | bool show_keep_discard = item->getPermissions().getCreator() != gAgent.getID(); | 837 | bool show_keep_discard = item->getPermissions().getCreator() != gAgent.getID(); |
836 | //bool show_keep_discard = true; | 838 | //bool show_keep_discard = true; |
837 | switch(item->getType()) | 839 | switch(asset_type) |
838 | { | 840 | { |
839 | case LLAssetType::AT_NOTECARD: | 841 | case LLAssetType::AT_NOTECARD: |
840 | open_notecard((LLViewerInventoryItem*)item, LLString("Note: ") + item->getName(), LLUUID::null, show_keep_discard, LLUUID::null, FALSE); | 842 | open_notecard((LLViewerInventoryItem*)item, std::string("Note: ") + item->getName(), LLUUID::null, show_keep_discard, LLUUID::null, FALSE); |
841 | break; | 843 | break; |
842 | case LLAssetType::AT_LANDMARK: | 844 | case LLAssetType::AT_LANDMARK: |
843 | open_landmark((LLViewerInventoryItem*)item, LLString("Landmark: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); | 845 | open_landmark((LLViewerInventoryItem*)item, std::string("Landmark: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); |
844 | break; | 846 | break; |
845 | case LLAssetType::AT_TEXTURE: | 847 | case LLAssetType::AT_TEXTURE: |
846 | open_texture(*it, LLString("Texture: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); | 848 | open_texture(*it, std::string("Texture: ") + item->getName(), show_keep_discard, LLUUID::null, FALSE); |
847 | break; | 849 | break; |
848 | default: | 850 | default: |
849 | break; | 851 | break; |
@@ -858,6 +860,11 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name) | |||
858 | return; | 860 | return; |
859 | } | 861 | } |
860 | 862 | ||
863 | if(gSavedSettings.getBOOL("ShowInInventory") && | ||
864 | asset_type != LLAssetType::AT_CALLINGCARD) | ||
865 | { | ||
866 | LLInventoryView::showAgentInventory(TRUE); | ||
867 | } | ||
861 | //Trash Check | 868 | //Trash Check |
862 | LLUUID trash_id; | 869 | LLUUID trash_id; |
863 | trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); | 870 | trash_id = gInventory.findCategoryUUIDForType(LLAssetType::AT_TRASH); |
@@ -890,12 +897,12 @@ void open_offer(const std::vector<LLUUID>& items, const std::string& from_name) | |||
890 | } | 897 | } |
891 | 898 | ||
892 | void inventory_offer_mute_callback(const LLUUID& blocked_id, | 899 | void inventory_offer_mute_callback(const LLUUID& blocked_id, |
893 | const char* first_name, | 900 | const std::string& first_name, |
894 | const char* last_name, | 901 | const std::string& last_name, |
895 | BOOL is_group, | 902 | BOOL is_group, |
896 | void* user_data) | 903 | void* user_data) |
897 | { | 904 | { |
898 | LLString from_name; | 905 | std::string from_name; |
899 | LLMute::EType type; | 906 | LLMute::EType type; |
900 | 907 | ||
901 | if (is_group) | 908 | if (is_group) |
@@ -906,9 +913,7 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, | |||
906 | else | 913 | else |
907 | { | 914 | { |
908 | type = LLMute::AGENT; | 915 | type = LLMute::AGENT; |
909 | from_name += first_name; | 916 | from_name = first_name + " " + last_name; |
910 | from_name += " "; | ||
911 | from_name += last_name; | ||
912 | } | 917 | } |
913 | 918 | ||
914 | LLMute mute(blocked_id, from_name, type); | 919 | LLMute mute(blocked_id, from_name, type); |
@@ -936,7 +941,7 @@ void inventory_offer_mute_callback(const LLUUID& blocked_id, | |||
936 | void inventory_offer_callback(S32 button, void* user_data) | 941 | void inventory_offer_callback(S32 button, void* user_data) |
937 | { | 942 | { |
938 | LLChat chat; | 943 | LLChat chat; |
939 | LLString log_message; | 944 | std::string log_message; |
940 | LLOfferInfo* info = (LLOfferInfo*)user_data; | 945 | LLOfferInfo* info = (LLOfferInfo*)user_data; |
941 | if(!info) return; | 946 | if(!info) return; |
942 | 947 | ||
@@ -978,8 +983,8 @@ void inventory_offer_callback(S32 button, void* user_data) | |||
978 | } | 983 | } |
979 | 984 | ||
980 | // *TODO:translate | 985 | // *TODO:translate |
981 | LLString from_string; // Used in the pop-up. | 986 | std::string from_string; // Used in the pop-up. |
982 | LLString chatHistory_string; // Used in chat history. | 987 | std::string chatHistory_string; // Used in chat history. |
983 | if (info->mFromObject == TRUE) | 988 | if (info->mFromObject == TRUE) |
984 | { | 989 | { |
985 | if (info->mFromGroup) | 990 | if (info->mFromGroup) |
@@ -987,12 +992,12 @@ void inventory_offer_callback(S32 button, void* user_data) | |||
987 | std::string group_name; | 992 | std::string group_name; |
988 | if (gCacheName->getGroupName(info->mFromID, group_name)) | 993 | if (gCacheName->getGroupName(info->mFromID, group_name)) |
989 | { | 994 | { |
990 | from_string = LLString("An object named '") + info->mFromName + "' owned by the group '" + group_name + "'"; | 995 | from_string = std::string("An object named '") + info->mFromName + "' owned by the group '" + group_name + "'"; |
991 | chatHistory_string = info->mFromName + " owned by the group '" + group_name + "'"; | 996 | chatHistory_string = info->mFromName + " owned by the group '" + group_name + "'"; |
992 | } | 997 | } |
993 | else | 998 | else |
994 | { | 999 | { |
995 | from_string = LLString("An object named '") + info->mFromName + "' owned by an unknown group"; | 1000 | from_string = std::string("An object named '") + info->mFromName + "' owned by an unknown group"; |
996 | chatHistory_string = info->mFromName + " owned by an unknown group"; | 1001 | chatHistory_string = info->mFromName + " owned by an unknown group"; |
997 | } | 1002 | } |
998 | } | 1003 | } |
@@ -1001,12 +1006,12 @@ void inventory_offer_callback(S32 button, void* user_data) | |||
1001 | std::string first_name, last_name; | 1006 | std::string first_name, last_name; |
1002 | if (gCacheName->getName(info->mFromID, first_name, last_name)) | 1007 | if (gCacheName->getName(info->mFromID, first_name, last_name)) |
1003 | { | 1008 | { |
1004 | from_string = LLString("An object named '") + info->mFromName + "' owned by " + first_name + " " + last_name; | 1009 | from_string = std::string("An object named '") + info->mFromName + "' owned by " + first_name + " " + last_name; |
1005 | chatHistory_string = info->mFromName + " owned by " + first_name + " " + last_name; | 1010 | chatHistory_string = info->mFromName + " owned by " + first_name + " " + last_name; |
1006 | } | 1011 | } |
1007 | else | 1012 | else |
1008 | { | 1013 | { |
1009 | from_string = LLString("An object named '") + info->mFromName + "' owned by an unknown user"; | 1014 | from_string = std::string("An object named '") + info->mFromName + "' owned by an unknown user"; |
1010 | chatHistory_string = info->mFromName + " owned by an unknown user"; | 1015 | chatHistory_string = info->mFromName + " owned by an unknown user"; |
1011 | } | 1016 | } |
1012 | } | 1017 | } |
@@ -1177,8 +1182,17 @@ void inventory_offer_handler(LLOfferInfo* info, BOOL from_task) | |||
1177 | return; | 1182 | return; |
1178 | } | 1183 | } |
1179 | 1184 | ||
1180 | LLString::format_map_t args; | 1185 | // Strip any SLURL from the message display. (DEV-2754) |
1181 | args["[OBJECTNAME]"] = info->mDesc; | 1186 | std::string msg = info->mDesc; |
1187 | int indx = msg.find(" ( http://slurl.com/secondlife/"); | ||
1188 | if(indx >= 0) | ||
1189 | { | ||
1190 | LLStringUtil::truncate(msg, indx); | ||
1191 | } | ||
1192 | |||
1193 | LLStringUtil::format_map_t args; | ||
1194 | args["[OBJECTNAME]"] = msg; | ||
1195 | |||
1182 | // must protect against a NULL return from lookupHumanReadable() | 1196 | // must protect against a NULL return from lookupHumanReadable() |
1183 | std::string typestr = ll_safe_string(LLAssetType::lookupHumanReadable(info->mType)); | 1197 | std::string typestr = ll_safe_string(LLAssetType::lookupHumanReadable(info->mType)); |
1184 | if (!typestr.empty()) | 1198 | if (!typestr.empty()) |
@@ -1285,7 +1299,7 @@ void lure_callback(S32 option, void* user_data) | |||
1285 | default: | 1299 | default: |
1286 | // decline | 1300 | // decline |
1287 | send_simple_im(info->mFromID, | 1301 | send_simple_im(info->mFromID, |
1288 | "", | 1302 | LLStringUtil::null, |
1289 | IM_LURE_DECLINED, | 1303 | IM_LURE_DECLINED, |
1290 | info->mLureID); | 1304 | info->mLureID); |
1291 | break; | 1305 | break; |
@@ -1317,16 +1331,16 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1317 | U8 d = 0; | 1331 | U8 d = 0; |
1318 | LLUUID session_id; | 1332 | LLUUID session_id; |
1319 | U32 t; | 1333 | U32 t; |
1320 | char name[DB_FULL_NAME_BUF_SIZE]; /* Flawfinder: ignore */ | 1334 | std::string name; |
1321 | char message[DB_IM_MSG_BUF_SIZE]; /* Flawfinder: ignore */ | 1335 | std::string message; |
1322 | U32 parent_estate_id = 0; | 1336 | U32 parent_estate_id = 0; |
1323 | LLUUID region_id; | 1337 | LLUUID region_id; |
1324 | LLVector3 position; | 1338 | LLVector3 position; |
1325 | char buffer[DB_IM_MSG_BUF_SIZE * 2]; /* Flawfinder: ignore */ | ||
1326 | U8 binary_bucket[MTUBYTES]; | 1339 | U8 binary_bucket[MTUBYTES]; |
1327 | S32 binary_bucket_size; | 1340 | S32 binary_bucket_size; |
1328 | LLChat chat; | 1341 | LLChat chat; |
1329 | 1342 | std::string buffer; | |
1343 | |||
1330 | // *TODO:translate - need to fix the full name to first/last (maybe) | 1344 | // *TODO:translate - need to fix the full name to first/last (maybe) |
1331 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, from_id); | 1345 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, from_id); |
1332 | msg->getBOOLFast(_PREHASH_MessageBlock, _PREHASH_FromGroup, from_group); | 1346 | msg->getBOOLFast(_PREHASH_MessageBlock, _PREHASH_FromGroup, from_group); |
@@ -1336,8 +1350,8 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1336 | msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, session_id); | 1350 | msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_ID, session_id); |
1337 | msg->getU32Fast( _PREHASH_MessageBlock, _PREHASH_Timestamp, t); | 1351 | msg->getU32Fast( _PREHASH_MessageBlock, _PREHASH_Timestamp, t); |
1338 | //msg->getData("MessageBlock", "Count", &count); | 1352 | //msg->getData("MessageBlock", "Count", &count); |
1339 | msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, DB_FULL_NAME_BUF_SIZE, name); | 1353 | msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_FromAgentName, name); |
1340 | msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, DB_IM_MSG_BUF_SIZE, message); | 1354 | msg->getStringFast(_PREHASH_MessageBlock, _PREHASH_Message, message); |
1341 | msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, parent_estate_id); | 1355 | msg->getU32Fast(_PREHASH_MessageBlock, _PREHASH_ParentEstateID, parent_estate_id); |
1342 | msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_RegionID, region_id); | 1356 | msg->getUUIDFast(_PREHASH_MessageBlock, _PREHASH_RegionID, region_id); |
1343 | msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, position); | 1357 | msg->getVector3Fast(_PREHASH_MessageBlock, _PREHASH_Position, position); |
@@ -1354,7 +1368,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1354 | chat.mMuted = is_muted && !is_linden; | 1368 | chat.mMuted = is_muted && !is_linden; |
1355 | chat.mFromID = from_id; | 1369 | chat.mFromID = from_id; |
1356 | chat.mFromName = name; | 1370 | chat.mFromName = name; |
1357 | chat.mSourceType = (from_id.isNull() || !strcmp(name, SYSTEM_FROM)) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT; | 1371 | chat.mSourceType = (from_id.isNull() || (name == std::string(SYSTEM_FROM))) ? CHAT_SOURCE_SYSTEM : CHAT_SOURCE_AGENT; |
1358 | 1372 | ||
1359 | LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing. | 1373 | LLViewerObject *source = gObjectList.findObject(session_id); //Session ID is probably the wrong thing. |
1360 | if (source) | 1374 | if (source) |
@@ -1362,17 +1376,18 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1362 | is_owned_by_me = source->permYouOwner(); | 1376 | is_owned_by_me = source->permYouOwner(); |
1363 | } | 1377 | } |
1364 | 1378 | ||
1365 | char separator_string[3]=": "; /* Flawfinder: ignore */ | 1379 | std::string separator_string(": "); |
1366 | int message_offset=0; | 1380 | int message_offset = 0; |
1367 | 1381 | ||
1368 | //Handle IRC styled /me messages. | 1382 | //Handle IRC styled /me messages. |
1369 | if (!strncmp(message, "/me ", 4) || !strncmp(message, "/me'", 4)) | 1383 | std::string prefix = message.substr(0, 4); |
1384 | if (prefix == "/me " || prefix == "/me'") | ||
1370 | { | 1385 | { |
1371 | strcpy(separator_string,""); /* Flawfinder: ignore */ | 1386 | separator_string = ""; |
1372 | message_offset=3; | 1387 | message_offset = 3; |
1373 | } | 1388 | } |
1374 | 1389 | ||
1375 | LLString::format_map_t args; | 1390 | LLStringUtil::format_map_t args; |
1376 | switch(dialog) | 1391 | switch(dialog) |
1377 | { | 1392 | { |
1378 | case IM_CONSOLE_AND_CHAT_HISTORY: | 1393 | case IM_CONSOLE_AND_CHAT_HISTORY: |
@@ -1395,7 +1410,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1395 | // do nothing -- don't distract newbies in | 1410 | // do nothing -- don't distract newbies in |
1396 | // Prelude with global IMs | 1411 | // Prelude with global IMs |
1397 | } | 1412 | } |
1398 | else if (offline == IM_ONLINE && !is_linden && is_busy && strcmp(name, SYSTEM_FROM)) | 1413 | else if (offline == IM_ONLINE && !is_linden && is_busy && name != SYSTEM_FROM) |
1399 | { | 1414 | { |
1400 | // return a standard "busy" message, but only do it to online IM | 1415 | // return a standard "busy" message, but only do it to online IM |
1401 | // (i.e. not other auto responses and not store-and-forward IM) | 1416 | // (i.e. not other auto responses and not store-and-forward IM) |
@@ -1405,15 +1420,15 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1405 | // initiated by the other party) then... | 1420 | // initiated by the other party) then... |
1406 | std::string my_name; | 1421 | std::string my_name; |
1407 | gAgent.buildFullname(my_name); | 1422 | gAgent.buildFullname(my_name); |
1408 | LLString response = gSavedPerAccountSettings.getText("BusyModeResponse"); | 1423 | std::string response = gSavedPerAccountSettings.getText("BusyModeResponse"); |
1409 | pack_instant_message( | 1424 | pack_instant_message( |
1410 | gMessageSystem, | 1425 | gMessageSystem, |
1411 | gAgent.getID(), | 1426 | gAgent.getID(), |
1412 | FALSE, | 1427 | FALSE, |
1413 | gAgent.getSessionID(), | 1428 | gAgent.getSessionID(), |
1414 | from_id, | 1429 | from_id, |
1415 | my_name.c_str(), | 1430 | my_name, |
1416 | response.c_str(), | 1431 | response, |
1417 | IM_ONLINE, | 1432 | IM_ONLINE, |
1418 | IM_BUSY_AUTO_RESPONSE, | 1433 | IM_BUSY_AUTO_RESPONSE, |
1419 | session_id); | 1434 | session_id); |
@@ -1422,7 +1437,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1422 | 1437 | ||
1423 | // now store incoming IM in chat history | 1438 | // now store incoming IM in chat history |
1424 | 1439 | ||
1425 | snprintf(buffer, sizeof(buffer), "%s%s", separator_string, (message+message_offset)); /* Flawfinder: ignore */ | 1440 | buffer = separator_string + message.substr(message_offset); |
1426 | 1441 | ||
1427 | LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; | 1442 | LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; |
1428 | 1443 | ||
@@ -1432,7 +1447,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1432 | from_id, | 1447 | from_id, |
1433 | name, | 1448 | name, |
1434 | buffer, | 1449 | buffer, |
1435 | NULL, | 1450 | LLStringUtil::null, |
1436 | dialog, | 1451 | dialog, |
1437 | parent_estate_id, | 1452 | parent_estate_id, |
1438 | region_id, | 1453 | region_id, |
@@ -1440,16 +1455,14 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1440 | true); | 1455 | true); |
1441 | 1456 | ||
1442 | // pretend this is chat generated by self, so it does not show up on screen | 1457 | // pretend this is chat generated by self, so it does not show up on screen |
1443 | snprintf(buffer, sizeof(buffer), "IM: %s%s%s", name, separator_string, (message+message_offset)); /* Flawfinder: ignore */ | 1458 | chat.mText = std::string("IM: ") + name + separator_string + message.substr(message_offset); |
1444 | chat.mText = buffer; | ||
1445 | LLFloaterChat::addChat( chat, TRUE, TRUE ); | 1459 | LLFloaterChat::addChat( chat, TRUE, TRUE ); |
1446 | } | 1460 | } |
1447 | else if (from_id.isNull()) | 1461 | else if (from_id.isNull()) |
1448 | { | 1462 | { |
1449 | // Messages from "Second Life" ID don't go to IM history | 1463 | // Messages from "Second Life" ID don't go to IM history |
1450 | // messages which should be routed to IM window come from a user ID with name=SYSTEM_NAME | 1464 | // messages which should be routed to IM window come from a user ID with name=SYSTEM_NAME |
1451 | snprintf(buffer, sizeof(buffer), "%s: %s", name, message); /* Flawfinder: ignore */ | 1465 | chat.mText = name + ": " + message; |
1452 | chat.mText = buffer; | ||
1453 | LLFloaterChat::addChat(chat, FALSE, FALSE); | 1466 | LLFloaterChat::addChat(chat, FALSE, FALSE); |
1454 | } | 1467 | } |
1455 | else if (to_id.isNull()) | 1468 | else if (to_id.isNull()) |
@@ -1462,23 +1475,19 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1462 | // Treat like a system message and put in chat history. | 1475 | // Treat like a system message and put in chat history. |
1463 | // Claim to be from a local agent so it doesn't go into | 1476 | // Claim to be from a local agent so it doesn't go into |
1464 | // console. | 1477 | // console. |
1465 | snprintf(buffer, sizeof(buffer), "%s%s%s", name, separator_string, (message+message_offset)); /* Flawfinder: ignore */ | 1478 | chat.mText = name + separator_string + message.substr(message_offset); |
1466 | chat.mText = buffer; | ||
1467 | BOOL local_agent = TRUE; | 1479 | BOOL local_agent = TRUE; |
1468 | LLFloaterChat::addChat(chat, FALSE, local_agent); | 1480 | LLFloaterChat::addChat(chat, FALSE, local_agent); |
1469 | } | 1481 | } |
1470 | else | 1482 | else |
1471 | { | 1483 | { |
1472 | // standard message, not from system | 1484 | // standard message, not from system |
1473 | char saved[MAX_STRING]; /* Flawfinder: ignore */ | 1485 | std::string saved; |
1474 | saved[0] = '\0'; | ||
1475 | if(offline == IM_OFFLINE) | 1486 | if(offline == IM_OFFLINE) |
1476 | { | 1487 | { |
1477 | char time_buf[TIME_STR_LENGTH]; /* Flawfinder: ignore */ | 1488 | saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str()); |
1478 | snprintf(saved, MAX_STRING, "(Saved %s) ", /* Flawfinder: ignore */ | ||
1479 | formatted_time(timestamp, time_buf)); | ||
1480 | } | 1489 | } |
1481 | snprintf(buffer, sizeof(buffer), "%s%s%s", separator_string, saved,(message+message_offset)); /* Flawfinder: ignore */ | 1490 | buffer = separator_string + saved + message.substr(message_offset); |
1482 | 1491 | ||
1483 | LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; | 1492 | LL_INFOS("Messaging") << "process_improved_im: session_id( " << session_id << " ), from_id( " << from_id << " )" << LL_ENDL; |
1484 | 1493 | ||
@@ -1489,15 +1498,14 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1489 | from_id, | 1498 | from_id, |
1490 | name, | 1499 | name, |
1491 | buffer, | 1500 | buffer, |
1492 | NULL, | 1501 | LLStringUtil::null, |
1493 | dialog, | 1502 | dialog, |
1494 | parent_estate_id, | 1503 | parent_estate_id, |
1495 | region_id, | 1504 | region_id, |
1496 | position, | 1505 | position, |
1497 | true); | 1506 | true); |
1498 | snprintf(buffer, sizeof(buffer), "IM: %s%s%s%s", name, separator_string, saved, (message+message_offset)); /* Flawfinder: ignore */ | 1507 | chat.mText = std::string("IM: ") + name + separator_string + saved + message.substr(message_offset); |
1499 | 1508 | ||
1500 | chat.mText = buffer; | ||
1501 | BOOL local_agent = FALSE; | 1509 | BOOL local_agent = FALSE; |
1502 | LLFloaterChat::addChat( chat, TRUE, local_agent ); | 1510 | LLFloaterChat::addChat( chat, TRUE, local_agent ); |
1503 | } | 1511 | } |
@@ -1565,7 +1573,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1565 | U8 has_inventory = notice_bin_bucket->header.has_inventory; | 1573 | U8 has_inventory = notice_bin_bucket->header.has_inventory; |
1566 | U8 asset_type = notice_bin_bucket->header.asset_type; | 1574 | U8 asset_type = notice_bin_bucket->header.asset_type; |
1567 | LLUUID group_id = notice_bin_bucket->header.group_id; | 1575 | LLUUID group_id = notice_bin_bucket->header.group_id; |
1568 | const char* item_name = (const char*) notice_bin_bucket->item_name; | 1576 | std::string item_name = ll_safe_string((const char*) notice_bin_bucket->item_name); |
1569 | 1577 | ||
1570 | // If there is inventory, give the user the inventory offer. | 1578 | // If there is inventory, give the user the inventory offer. |
1571 | LLOfferInfo* info = NULL; | 1579 | LLOfferInfo* info = NULL; |
@@ -1597,18 +1605,18 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1597 | tokenizer tokens(str, sep); | 1605 | tokenizer tokens(str, sep); |
1598 | tokenizer::iterator iter = tokens.begin(); | 1606 | tokenizer::iterator iter = tokens.begin(); |
1599 | 1607 | ||
1600 | LLString subj(*iter++); | 1608 | std::string subj(*iter++); |
1601 | LLString mes(*iter++); | 1609 | std::string mes(*iter++); |
1602 | 1610 | ||
1603 | if (IM_GROUP_NOTICE == dialog) | 1611 | if (IM_GROUP_NOTICE == dialog) |
1604 | { | 1612 | { |
1605 | subj += "\n"; | 1613 | subj += "\n"; |
1606 | mes = "\n\n" + mes; | 1614 | mes = "\n\n" + mes; |
1607 | LLGroupNotifyBox::show(subj.c_str(),mes.c_str(),name,group_id,t,has_inventory,item_name,info); | 1615 | LLGroupNotifyBox::show(subj,mes,name,group_id,t,has_inventory,item_name,info); |
1608 | } | 1616 | } |
1609 | else if (IM_GROUP_NOTICE_REQUESTED == dialog) | 1617 | else if (IM_GROUP_NOTICE_REQUESTED == dialog) |
1610 | { | 1618 | { |
1611 | LLFloaterGroupInfo::showNotice(subj.c_str(),mes.c_str(),group_id,has_inventory,item_name,info); | 1619 | LLFloaterGroupInfo::showNotice(subj,mes,group_id,has_inventory,item_name,info); |
1612 | } | 1620 | } |
1613 | } | 1621 | } |
1614 | break; | 1622 | break; |
@@ -1648,7 +1656,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1648 | userdata->mMessage.assign(message); | 1656 | userdata->mMessage.assign(message); |
1649 | userdata->mFee = membership_fee; | 1657 | userdata->mFee = membership_fee; |
1650 | 1658 | ||
1651 | LLString::format_map_t args; | 1659 | LLStringUtil::format_map_t args; |
1652 | args["[MESSAGE]"] = message; | 1660 | args["[MESSAGE]"] = message; |
1653 | LLNotifyBox::showXml("JoinGroup", args, | 1661 | LLNotifyBox::showXml("JoinGroup", args, |
1654 | &join_group_callback, | 1662 | &join_group_callback, |
@@ -1764,17 +1772,12 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1764 | } | 1772 | } |
1765 | 1773 | ||
1766 | // standard message, not from system | 1774 | // standard message, not from system |
1767 | char saved[MAX_STRING]; /* Flawfinder: ignore */ | 1775 | std::string saved; |
1768 | saved[0] = '\0'; | ||
1769 | if(offline == IM_OFFLINE) | 1776 | if(offline == IM_OFFLINE) |
1770 | { | 1777 | { |
1771 | char time_buf[TIME_STR_LENGTH]; /* Flawfinder: ignore */ | 1778 | saved = llformat("(Saved %s) ", formatted_time(timestamp).c_str()); |
1772 | snprintf(saved, /* Flawfinder: ignore */ | ||
1773 | MAX_STRING, | ||
1774 | "(Saved %s) ", | ||
1775 | formatted_time(timestamp, time_buf)); | ||
1776 | } | 1779 | } |
1777 | snprintf(buffer, sizeof(buffer), "%s%s%s", separator_string, saved, (message+message_offset)); /* Flawfinder: ignore */ | 1780 | buffer = separator_string + saved + message.substr(message_offset); |
1778 | BOOL is_this_agent = FALSE; | 1781 | BOOL is_this_agent = FALSE; |
1779 | if(from_id == gAgentID) | 1782 | if(from_id == gAgentID) |
1780 | { | 1783 | { |
@@ -1785,15 +1788,14 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1785 | from_id, | 1788 | from_id, |
1786 | name, | 1789 | name, |
1787 | buffer, | 1790 | buffer, |
1788 | (char*)binary_bucket, | 1791 | ll_safe_string((char*)binary_bucket), |
1789 | IM_SESSION_INVITE, | 1792 | IM_SESSION_INVITE, |
1790 | parent_estate_id, | 1793 | parent_estate_id, |
1791 | region_id, | 1794 | region_id, |
1792 | position, | 1795 | position, |
1793 | true); | 1796 | true); |
1794 | 1797 | ||
1795 | snprintf(buffer, sizeof(buffer), "IM: %s%s%s%s", name, separator_string, saved, (message+message_offset)); /* Flawfinder: ignore */ | 1798 | chat.mText = std::string("IM: ") + name + separator_string + saved + message.substr(message_offset); |
1796 | chat.mText = buffer; | ||
1797 | LLFloaterChat::addChat(chat, TRUE, is_this_agent); | 1799 | LLFloaterChat::addChat(chat, TRUE, is_this_agent); |
1798 | } | 1800 | } |
1799 | break; | 1801 | break; |
@@ -1803,10 +1805,9 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1803 | { | 1805 | { |
1804 | return; | 1806 | return; |
1805 | } | 1807 | } |
1806 | snprintf(buffer, sizeof(buffer), "%s%s%s", name, separator_string, (message+message_offset)); /* Flawfinder: ignore */ | 1808 | chat.mText = name + separator_string + message.substr(message_offset); |
1807 | // Note: lie to LLFloaterChat::addChat(), pretending that this is NOT an IM, because | 1809 | // Note: lie to LLFloaterChat::addChat(), pretending that this is NOT an IM, because |
1808 | // IMs from objcts don't open IM sessions. | 1810 | // IMs from objcts don't open IM sessions. |
1809 | chat.mText = buffer; | ||
1810 | chat.mSourceType = CHAT_SOURCE_OBJECT; | 1811 | chat.mSourceType = CHAT_SOURCE_OBJECT; |
1811 | LLFloaterChat::addChat(chat, FALSE, FALSE); | 1812 | LLFloaterChat::addChat(chat, FALSE, FALSE); |
1812 | break; | 1813 | break; |
@@ -1831,7 +1832,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1831 | else | 1832 | else |
1832 | { | 1833 | { |
1833 | // TODO: after LLTrans hits release, get "busy response" into translatable file | 1834 | // TODO: after LLTrans hits release, get "busy response" into translatable file |
1834 | snprintf(buffer, sizeof(buffer), "%s (%s): %s", name, "busy response", (message+message_offset)); /* Flawfinder: ignore */ | 1835 | buffer = llformat("%s (%s): %s", name.c_str(), "busy response", message.substr(message_offset).c_str()); |
1835 | gIMMgr->addMessage(session_id, from_id, name, buffer); | 1836 | gIMMgr->addMessage(session_id, from_id, name, buffer); |
1836 | } | 1837 | } |
1837 | break; | 1838 | break; |
@@ -1915,8 +1916,18 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) | |||
1915 | else | 1916 | else |
1916 | { | 1917 | { |
1917 | args["[NAME]"] = name; | 1918 | args["[NAME]"] = name; |
1918 | LLNotifyBox::showXml("OfferFriendship", args, | 1919 | if(message.empty()) |
1919 | &friendship_offer_callback, (void*)offer); | 1920 | { |
1921 | //support for frienship offers from clients before July 2008 | ||
1922 | LLNotifyBox::showXml("OfferFriendshipNoMessage", args, | ||
1923 | &friendship_offer_callback, (void*)offer); | ||
1924 | } | ||
1925 | else | ||
1926 | { | ||
1927 | args["[MESSAGE]"] = message; | ||
1928 | LLNotifyBox::showXml("OfferFriendship", args, | ||
1929 | &friendship_offer_callback, (void*)offer); | ||
1930 | } | ||
1920 | } | 1931 | } |
1921 | } | 1932 | } |
1922 | break; | 1933 | break; |
@@ -1961,15 +1972,15 @@ void busy_message (LLMessageSystem* msg, LLUUID from_id) | |||
1961 | { | 1972 | { |
1962 | std::string my_name; | 1973 | std::string my_name; |
1963 | gAgent.buildFullname(my_name); | 1974 | gAgent.buildFullname(my_name); |
1964 | LLString response = gSavedPerAccountSettings.getText("BusyModeResponse"); | 1975 | std::string response = gSavedPerAccountSettings.getText("BusyModeResponse"); |
1965 | pack_instant_message( | 1976 | pack_instant_message( |
1966 | gMessageSystem, | 1977 | gMessageSystem, |
1967 | gAgent.getID(), | 1978 | gAgent.getID(), |
1968 | FALSE, | 1979 | FALSE, |
1969 | gAgent.getSessionID(), | 1980 | gAgent.getSessionID(), |
1970 | from_id, | 1981 | from_id, |
1971 | my_name.c_str(), | 1982 | my_name, |
1972 | response.c_str(), | 1983 | response, |
1973 | IM_ONLINE, | 1984 | IM_ONLINE, |
1974 | IM_BUSY_AUTO_RESPONSE); | 1985 | IM_BUSY_AUTO_RESPONSE); |
1975 | gAgent.sendReliableMessage(); | 1986 | gAgent.sendReliableMessage(); |
@@ -2085,7 +2096,7 @@ void process_offer_callingcard(LLMessageSystem* msg, void**) | |||
2085 | offerdata->mHost = msg->getSender(); | 2096 | offerdata->mHost = msg->getSender(); |
2086 | 2097 | ||
2087 | LLViewerObject* source = gObjectList.findObject(source_id); | 2098 | LLViewerObject* source = gObjectList.findObject(source_id); |
2088 | LLString::format_map_t args; | 2099 | LLStringUtil::format_map_t args; |
2089 | std::string source_name; | 2100 | std::string source_name; |
2090 | if(source && source->isAvatar()) | 2101 | if(source && source->isAvatar()) |
2091 | { | 2102 | { |
@@ -2138,8 +2149,8 @@ void process_decline_callingcard(LLMessageSystem* msg, void**) | |||
2138 | void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) | 2149 | void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) |
2139 | { | 2150 | { |
2140 | LLChat chat; | 2151 | LLChat chat; |
2141 | char mesg[DB_CHAT_MSG_BUF_SIZE]; /* Flawfinder: ignore */ | 2152 | std::string mesg; |
2142 | char from_name[DB_FULL_NAME_BUF_SIZE]; /* Flawfinder: ignore */ | 2153 | std::string from_name; |
2143 | U8 source_temp; | 2154 | U8 source_temp; |
2144 | U8 type_temp; | 2155 | U8 type_temp; |
2145 | U8 audible_temp; | 2156 | U8 audible_temp; |
@@ -2149,7 +2160,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) | |||
2149 | BOOL is_owned_by_me = FALSE; | 2160 | BOOL is_owned_by_me = FALSE; |
2150 | LLViewerObject* chatter; | 2161 | LLViewerObject* chatter; |
2151 | 2162 | ||
2152 | msg->getString("ChatData", "FromName", DB_FULL_NAME_BUF_SIZE, from_name); | 2163 | msg->getString("ChatData", "FromName", from_name); |
2153 | chat.mFromName = from_name; | 2164 | chat.mFromName = from_name; |
2154 | 2165 | ||
2155 | msg->getUUID("ChatData", "SourceID", from_id); | 2166 | msg->getUUID("ChatData", "SourceID", from_id); |
@@ -2169,7 +2180,6 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) | |||
2169 | 2180 | ||
2170 | chat.mTime = LLFrameTimer::getElapsedSeconds(); | 2181 | chat.mTime = LLFrameTimer::getElapsedSeconds(); |
2171 | 2182 | ||
2172 | BOOL is_self = (from_id == gAgent.getID()); | ||
2173 | BOOL is_busy = gAgent.getBusy(); | 2183 | BOOL is_busy = gAgent.getBusy(); |
2174 | 2184 | ||
2175 | BOOL is_muted = FALSE; | 2185 | BOOL is_muted = FALSE; |
@@ -2221,15 +2231,16 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) | |||
2221 | std::string verb; | 2231 | std::string verb; |
2222 | 2232 | ||
2223 | color.setVec(1.f,1.f,1.f,1.f); | 2233 | color.setVec(1.f,1.f,1.f,1.f); |
2224 | msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, DB_CHAT_MSG_BUF_SIZE, mesg); | 2234 | msg->getStringFast(_PREHASH_ChatData, _PREHASH_Message, mesg); |
2225 | 2235 | ||
2226 | BOOL ircstyle = FALSE; | 2236 | BOOL ircstyle = FALSE; |
2227 | 2237 | ||
2228 | // Look for IRC-style emotes here so chatbubbles work | 2238 | // Look for IRC-style emotes here so chatbubbles work |
2229 | if (!strncmp(mesg, "/me ", 4) || !strncmp(mesg, "/me'", 4)) | 2239 | std::string prefix = mesg.substr(0, 4); |
2240 | if (prefix == "/me " || prefix == "/me'") | ||
2230 | { | 2241 | { |
2231 | chat.mText = from_name; | 2242 | chat.mText = from_name; |
2232 | chat.mText += (mesg + 3); | 2243 | chat.mText += mesg.substr(3); |
2233 | ircstyle = TRUE; | 2244 | ircstyle = TRUE; |
2234 | } | 2245 | } |
2235 | else | 2246 | else |
@@ -2284,14 +2295,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) | |||
2284 | switch(chat.mChatType) | 2295 | switch(chat.mChatType) |
2285 | { | 2296 | { |
2286 | case CHAT_TYPE_WHISPER: | 2297 | case CHAT_TYPE_WHISPER: |
2287 | if (is_self) | 2298 | verb = " " + LLTrans::getString("whisper") + " "; |
2288 | { | ||
2289 | verb = " whisper: "; | ||
2290 | } | ||
2291 | else | ||
2292 | { | ||
2293 | verb = " whispers: "; | ||
2294 | } | ||
2295 | break; | 2299 | break; |
2296 | case CHAT_TYPE_DEBUG_MSG: | 2300 | case CHAT_TYPE_DEBUG_MSG: |
2297 | case CHAT_TYPE_OWNER: | 2301 | case CHAT_TYPE_OWNER: |
@@ -2299,14 +2303,7 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) | |||
2299 | verb = ": "; | 2303 | verb = ": "; |
2300 | break; | 2304 | break; |
2301 | case CHAT_TYPE_SHOUT: | 2305 | case CHAT_TYPE_SHOUT: |
2302 | if (is_self) | 2306 | verb = " " + LLTrans::getString("shout") + " "; |
2303 | { | ||
2304 | verb = " shout: "; | ||
2305 | } | ||
2306 | else | ||
2307 | { | ||
2308 | verb = " shouts: "; | ||
2309 | } | ||
2310 | break; | 2307 | break; |
2311 | case CHAT_TYPE_START: | 2308 | case CHAT_TYPE_START: |
2312 | case CHAT_TYPE_STOP: | 2309 | case CHAT_TYPE_STOP: |
@@ -2318,14 +2315,8 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) | |||
2318 | break; | 2315 | break; |
2319 | } | 2316 | } |
2320 | 2317 | ||
2321 | if (is_self) | 2318 | |
2322 | { | 2319 | chat.mText = from_name; |
2323 | chat.mText = "You"; | ||
2324 | } | ||
2325 | else | ||
2326 | { | ||
2327 | chat.mText = from_name; | ||
2328 | } | ||
2329 | chat.mText += verb; | 2320 | chat.mText += verb; |
2330 | chat.mText += mesg; | 2321 | chat.mText += mesg; |
2331 | } | 2322 | } |
@@ -2378,11 +2369,11 @@ void process_teleport_start(LLMessageSystem *msg, void**) | |||
2378 | 2369 | ||
2379 | if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) | 2370 | if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) |
2380 | { | 2371 | { |
2381 | gViewerWindow->setProgressCancelButtonVisible(FALSE, ""); | 2372 | gViewerWindow->setProgressCancelButtonVisible(FALSE); |
2382 | } | 2373 | } |
2383 | else | 2374 | else |
2384 | { | 2375 | { |
2385 | gViewerWindow->setProgressCancelButtonVisible(TRUE, "Cancel"); | 2376 | gViewerWindow->setProgressCancelButtonVisible(TRUE, std::string("Cancel")); // *TODO: Translate |
2386 | } | 2377 | } |
2387 | 2378 | ||
2388 | // Freeze the UI and show progress bar | 2379 | // Freeze the UI and show progress bar |
@@ -2413,19 +2404,19 @@ void process_teleport_progress(LLMessageSystem* msg, void**) | |||
2413 | msg->getU32("Info", "TeleportFlags", teleport_flags); | 2404 | msg->getU32("Info", "TeleportFlags", teleport_flags); |
2414 | if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) | 2405 | if (teleport_flags & TELEPORT_FLAGS_DISABLE_CANCEL) |
2415 | { | 2406 | { |
2416 | gViewerWindow->setProgressCancelButtonVisible(FALSE, ""); | 2407 | gViewerWindow->setProgressCancelButtonVisible(FALSE); |
2417 | } | 2408 | } |
2418 | else | 2409 | else |
2419 | { | 2410 | { |
2420 | gViewerWindow->setProgressCancelButtonVisible(TRUE, "Cancel"); | 2411 | gViewerWindow->setProgressCancelButtonVisible(TRUE, std::string("Cancel")); //TODO: Translate |
2421 | } | 2412 | } |
2422 | char buffer[MAX_STRING]; /* Flawfinder: ignore */ | 2413 | std::string buffer; |
2423 | msg->getString("Info", "Message", MAX_STRING, buffer); | 2414 | msg->getString("Info", "Message", buffer); |
2424 | LL_DEBUGS("Messaging") << "teleport progress: " << buffer << LL_ENDL; | 2415 | LL_DEBUGS("Messaging") << "teleport progress: " << buffer << LL_ENDL; |
2425 | 2416 | ||
2426 | //Sorta hacky...default to using simulator raw messages | 2417 | //Sorta hacky...default to using simulator raw messages |
2427 | //if we don't find the coresponding mapping in our progress mappings | 2418 | //if we don't find the coresponding mapping in our progress mappings |
2428 | LLString message = buffer; | 2419 | std::string message = buffer; |
2429 | 2420 | ||
2430 | if (LLAgent::sTeleportProgressMessages.find(buffer) != | 2421 | if (LLAgent::sTeleportProgressMessages.find(buffer) != |
2431 | LLAgent::sTeleportProgressMessages.end() ) | 2422 | LLAgent::sTeleportProgressMessages.end() ) |
@@ -2467,7 +2458,7 @@ public: | |||
2467 | LLInventoryModel::EXCLUDE_TRASH, | 2458 | LLInventoryModel::EXCLUDE_TRASH, |
2468 | is_card); | 2459 | is_card); |
2469 | } | 2460 | } |
2470 | LLString::format_map_t args; | 2461 | LLStringUtil::format_map_t args; |
2471 | if ( land_items.count() > 0 ) | 2462 | if ( land_items.count() > 0 ) |
2472 | { // Show notification that they can now teleport to landmarks. Use a random landmark from the inventory | 2463 | { // Show notification that they can now teleport to landmarks. Use a random landmark from the inventory |
2473 | S32 random_land = ll_rand( land_items.count() - 1 ); | 2464 | S32 random_land = ll_rand( land_items.count() - 1 ); |
@@ -2576,9 +2567,8 @@ void process_teleport_finish(LLMessageSystem* msg, void**) | |||
2576 | msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags); | 2567 | msg->getU32Fast(_PREHASH_Info, _PREHASH_TeleportFlags, teleport_flags); |
2577 | 2568 | ||
2578 | 2569 | ||
2579 | char seedCap[STD_STRING_BUF_SIZE]; /* Flawfinder: ignore */ | 2570 | std::string seedCap; |
2580 | msg->getStringFast(_PREHASH_Info, _PREHASH_SeedCapability, | 2571 | msg->getStringFast(_PREHASH_Info, _PREHASH_SeedCapability, seedCap); |
2581 | STD_STRING_BUF_SIZE, seedCap); | ||
2582 | 2572 | ||
2583 | // update home location if we are teleporting out of prelude - specific to teleporting to welcome area | 2573 | // update home location if we are teleporting out of prelude - specific to teleporting to welcome area |
2584 | if((teleport_flags & TELEPORT_FLAGS_SET_HOME_TO_TARGET) | 2574 | if((teleport_flags & TELEPORT_FLAGS_SET_HOME_TO_TARGET) |
@@ -2631,7 +2621,7 @@ void process_teleport_finish(LLMessageSystem* msg, void**) | |||
2631 | gAgent.setTeleportState( LLAgent::TELEPORT_MOVING ); | 2621 | gAgent.setTeleportState( LLAgent::TELEPORT_MOVING ); |
2632 | gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages["contacting"]); | 2622 | gAgent.setTeleportMessage(LLAgent::sTeleportProgressMessages["contacting"]); |
2633 | 2623 | ||
2634 | regionp->setSeedCapability(std::string(seedCap)); | 2624 | regionp->setSeedCapability(seedCap); |
2635 | 2625 | ||
2636 | // Don't send camera updates to the new region until we're | 2626 | // Don't send camera updates to the new region until we're |
2637 | // actually there... | 2627 | // actually there... |
@@ -2648,9 +2638,6 @@ void process_teleport_finish(LLMessageSystem* msg, void**) | |||
2648 | // gTeleportDisplay = TRUE; | 2638 | // gTeleportDisplay = TRUE; |
2649 | // gTeleportDisplayTimer.reset(); | 2639 | // gTeleportDisplayTimer.reset(); |
2650 | // gViewerWindow->setShowProgress(TRUE); | 2640 | // gViewerWindow->setShowProgress(TRUE); |
2651 | |||
2652 | // This could be first use of teleport, so test for that | ||
2653 | LLFirstUse::useTeleport(); | ||
2654 | } | 2641 | } |
2655 | 2642 | ||
2656 | // stuff we have to do every time we get an AvatarInitComplete from a sim | 2643 | // stuff we have to do every time we get an AvatarInitComplete from a sim |
@@ -2663,16 +2650,14 @@ void process_avatar_init_complete(LLMessageSystem* msg, void**) | |||
2663 | } | 2650 | } |
2664 | */ | 2651 | */ |
2665 | 2652 | ||
2666 | static void display_release_message(S32, void* data) | 2653 | static void display_release_notes(S32, void* data) |
2667 | { | 2654 | { |
2668 | std::string* msg = (std::string*)data; | 2655 | gAgent.getRegion()->showReleaseNotes(); |
2669 | LLFloaterReleaseMsg::displayMessage(msg->c_str()); | ||
2670 | delete msg; | ||
2671 | } | 2656 | } |
2672 | 2657 | ||
2673 | void process_agent_movement_complete(LLMessageSystem* msg, void**) | 2658 | void process_agent_movement_complete(LLMessageSystem* msg, void**) |
2674 | { | 2659 | { |
2675 | gAgentMovementCompleted = TRUE; | 2660 | gAgentMovementCompleted = true; |
2676 | 2661 | ||
2677 | LLUUID agent_id; | 2662 | LLUUID agent_id; |
2678 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); | 2663 | msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id); |
@@ -2696,8 +2681,8 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) | |||
2696 | U64 region_handle; | 2681 | U64 region_handle; |
2697 | msg->getU64Fast(_PREHASH_Data, _PREHASH_RegionHandle, region_handle); | 2682 | msg->getU64Fast(_PREHASH_Data, _PREHASH_RegionHandle, region_handle); |
2698 | 2683 | ||
2699 | char version_channel_char[MAX_STRING]; | 2684 | std::string version_channel; |
2700 | msg->getString("SimData", "ChannelVersion", MAX_STRING, version_channel_char); | 2685 | msg->getString("SimData", "ChannelVersion", version_channel); |
2701 | 2686 | ||
2702 | LLVOAvatar* avatarp = gAgent.getAvatarObject(); | 2687 | LLVOAvatar* avatarp = gAgent.getAvatarObject(); |
2703 | if (!avatarp) | 2688 | if (!avatarp) |
@@ -2832,10 +2817,20 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**) | |||
2832 | // send walk-vs-run status | 2817 | // send walk-vs-run status |
2833 | gAgent.sendWalkRun(gAgent.getRunning() || gAgent.getAlwaysRun()); | 2818 | gAgent.sendWalkRun(gAgent.getRunning() || gAgent.getAlwaysRun()); |
2834 | 2819 | ||
2835 | if (LLFloaterReleaseMsg::checkVersion(version_channel_char)) | 2820 | // If the server version has changed, display an info box and offer |
2821 | // to display the release notes, unless this is the initial log in. | ||
2822 | if (gLastVersionChannel == version_channel) | ||
2836 | { | 2823 | { |
2837 | LLNotifyBox::showXml("ServerVersionChanged", display_release_message, new std::string(version_channel_char) ); | 2824 | return; |
2825 | } | ||
2826 | |||
2827 | if (!gLastVersionChannel.empty()) | ||
2828 | { | ||
2829 | LLNotifyBox::showXml( | ||
2830 | "ServerVersionChanged", display_release_notes, NULL); | ||
2838 | } | 2831 | } |
2832 | |||
2833 | gLastVersionChannel = version_channel; | ||
2839 | } | 2834 | } |
2840 | 2835 | ||
2841 | void process_crossed_region(LLMessageSystem* msg, void**) | 2836 | void process_crossed_region(LLMessageSystem* msg, void**) |
@@ -2860,13 +2855,13 @@ void process_crossed_region(LLMessageSystem* msg, void**) | |||
2860 | U64 region_handle; | 2855 | U64 region_handle; |
2861 | msg->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); | 2856 | msg->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle); |
2862 | 2857 | ||
2863 | char seedCap[STD_STRING_BUF_SIZE]; /* Flawfinder: ignore */ | 2858 | std::string seedCap; |
2864 | msg->getStringFast(_PREHASH_RegionData, _PREHASH_SeedCapability, STD_STRING_BUF_SIZE, seedCap); | 2859 | msg->getStringFast(_PREHASH_RegionData, _PREHASH_SeedCapability, seedCap); |
2865 | 2860 | ||
2866 | send_complete_agent_movement(sim_host); | 2861 | send_complete_agent_movement(sim_host); |
2867 | 2862 | ||
2868 | LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); | 2863 | LLViewerRegion* regionp = LLWorld::getInstance()->addRegion(region_handle, sim_host); |
2869 | regionp->setSeedCapability(std::string(seedCap)); | 2864 | regionp->setSeedCapability(seedCap); |
2870 | } | 2865 | } |
2871 | 2866 | ||
2872 | 2867 | ||
@@ -3470,8 +3465,8 @@ void process_sim_stats(LLMessageSystem *msg, void **user_data) | |||
3470 | case LL_SIM_STAT_NUMSCRIPTSACTIVE: | 3465 | case LL_SIM_STAT_NUMSCRIPTSACTIVE: |
3471 | LLViewerStats::getInstance()->mSimActiveScripts.addValue(stat_value); | 3466 | LLViewerStats::getInstance()->mSimActiveScripts.addValue(stat_value); |
3472 | break; | 3467 | break; |
3473 | case LL_SIM_STAT_LSLIPS: | 3468 | case LL_SIM_STAT_SCRIPT_EPS: |
3474 | LLViewerStats::getInstance()->mSimLSLIPS.addValue(stat_value); | 3469 | LLViewerStats::getInstance()->mSimScriptEPS.addValue(stat_value); |
3475 | break; | 3470 | break; |
3476 | case LL_SIM_STAT_INPPS: | 3471 | case LL_SIM_STAT_INPPS: |
3477 | LLViewerStats::getInstance()->mSimInPPS.addValue(stat_value); | 3472 | LLViewerStats::getInstance()->mSimInPPS.addValue(stat_value); |
@@ -3858,7 +3853,7 @@ void process_set_follow_cam_properties(LLMessageSystem *mesgsys, void **user_dat | |||
3858 | // Culled from newsim lltask.cpp | 3853 | // Culled from newsim lltask.cpp |
3859 | void process_name_value(LLMessageSystem *mesgsys, void **user_data) | 3854 | void process_name_value(LLMessageSystem *mesgsys, void **user_data) |
3860 | { | 3855 | { |
3861 | char temp_str[NAME_VALUE_BUF_SIZE]; /* Flawfinder: ignore */ | 3856 | std::string temp_str; |
3862 | LLUUID id; | 3857 | LLUUID id; |
3863 | S32 i, num_blocks; | 3858 | S32 i, num_blocks; |
3864 | 3859 | ||
@@ -3871,7 +3866,7 @@ void process_name_value(LLMessageSystem *mesgsys, void **user_data) | |||
3871 | num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData); | 3866 | num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData); |
3872 | for (i = 0; i < num_blocks; i++) | 3867 | for (i = 0; i < num_blocks; i++) |
3873 | { | 3868 | { |
3874 | mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, NAME_VALUE_BUF_SIZE, temp_str, i); | 3869 | mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, temp_str, i); |
3875 | LL_INFOS("Messaging") << "Added to object Name Value: " << temp_str << LL_ENDL; | 3870 | LL_INFOS("Messaging") << "Added to object Name Value: " << temp_str << LL_ENDL; |
3876 | object->addNVPair(temp_str); | 3871 | object->addNVPair(temp_str); |
3877 | } | 3872 | } |
@@ -3884,7 +3879,7 @@ void process_name_value(LLMessageSystem *mesgsys, void **user_data) | |||
3884 | 3879 | ||
3885 | void process_remove_name_value(LLMessageSystem *mesgsys, void **user_data) | 3880 | void process_remove_name_value(LLMessageSystem *mesgsys, void **user_data) |
3886 | { | 3881 | { |
3887 | char temp_str[NAME_VALUE_BUF_SIZE]; /* Flawfinder: ignore */ | 3882 | std::string temp_str; |
3888 | LLUUID id; | 3883 | LLUUID id; |
3889 | S32 i, num_blocks; | 3884 | S32 i, num_blocks; |
3890 | 3885 | ||
@@ -3897,7 +3892,7 @@ void process_remove_name_value(LLMessageSystem *mesgsys, void **user_data) | |||
3897 | num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData); | 3892 | num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_NameValueData); |
3898 | for (i = 0; i < num_blocks; i++) | 3893 | for (i = 0; i < num_blocks; i++) |
3899 | { | 3894 | { |
3900 | mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, NAME_VALUE_BUF_SIZE, temp_str, i); | 3895 | mesgsys->getStringFast(_PREHASH_NameValueData, _PREHASH_NVPair, temp_str, i); |
3901 | LL_INFOS("Messaging") << "Removed from object Name Value: " << temp_str << LL_ENDL; | 3896 | LL_INFOS("Messaging") << "Removed from object Name Value: " << temp_str << LL_ENDL; |
3902 | object->removeNVPair(temp_str); | 3897 | object->removeNVPair(temp_str); |
3903 | } | 3898 | } |
@@ -3910,10 +3905,9 @@ void process_remove_name_value(LLMessageSystem *mesgsys, void **user_data) | |||
3910 | 3905 | ||
3911 | void process_kick_user(LLMessageSystem *msg, void** /*user_data*/) | 3906 | void process_kick_user(LLMessageSystem *msg, void** /*user_data*/) |
3912 | { | 3907 | { |
3913 | char message[2048]; /* Flawfinder: ignore */ | 3908 | std::string message; |
3914 | message[0] = '\0'; | ||
3915 | 3909 | ||
3916 | msg->getStringFast(_PREHASH_UserInfo, _PREHASH_Reason, 2048, message); | 3910 | msg->getStringFast(_PREHASH_UserInfo, _PREHASH_Reason, message); |
3917 | 3911 | ||
3918 | LLAppViewer::instance()->forceDisconnect(message); | 3912 | LLAppViewer::instance()->forceDisconnect(message); |
3919 | } | 3913 | } |
@@ -3978,12 +3972,12 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) | |||
3978 | S32 balance = 0; | 3972 | S32 balance = 0; |
3979 | S32 credit = 0; | 3973 | S32 credit = 0; |
3980 | S32 committed = 0; | 3974 | S32 committed = 0; |
3981 | char desc[STD_STRING_BUF_SIZE] = ""; /* Flawfinder: ignore */ | 3975 | std::string desc; |
3982 | 3976 | ||
3983 | msg->getS32("MoneyData", "MoneyBalance", balance); | 3977 | msg->getS32("MoneyData", "MoneyBalance", balance); |
3984 | msg->getS32("MoneyData", "SquareMetersCredit", credit); | 3978 | msg->getS32("MoneyData", "SquareMetersCredit", credit); |
3985 | msg->getS32("MoneyData", "SquareMetersCommitted", committed); | 3979 | msg->getS32("MoneyData", "SquareMetersCommitted", committed); |
3986 | msg->getStringFast(_PREHASH_MoneyData, _PREHASH_Description, STD_STRING_BUF_SIZE, desc); | 3980 | msg->getStringFast(_PREHASH_MoneyData, _PREHASH_Description, desc); |
3987 | LL_INFOS("Messaging") << "L$, credit, committed: " << balance << " " << credit << " " | 3981 | LL_INFOS("Messaging") << "L$, credit, committed: " << balance << " " << credit << " " |
3988 | << committed << LL_ENDL; | 3982 | << committed << LL_ENDL; |
3989 | 3983 | ||
@@ -4013,13 +4007,13 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) | |||
4013 | LLUUID tid; | 4007 | LLUUID tid; |
4014 | msg->getUUID("MoneyData", "TransactionID", tid); | 4008 | msg->getUUID("MoneyData", "TransactionID", tid); |
4015 | static std::deque<LLUUID> recent; | 4009 | static std::deque<LLUUID> recent; |
4016 | if(desc[0] && gSavedSettings.getBOOL("NotifyMoneyChange") | 4010 | if(!desc.empty() && gSavedSettings.getBOOL("NotifyMoneyChange") |
4017 | && (std::find(recent.rbegin(), recent.rend(), tid) == recent.rend())) | 4011 | && (std::find(recent.rbegin(), recent.rend(), tid) == recent.rend())) |
4018 | { | 4012 | { |
4019 | // Make the user confirm the transaction, since they might | 4013 | // Make the user confirm the transaction, since they might |
4020 | // have missed something during an event. | 4014 | // have missed something during an event. |
4021 | // *TODO:translate | 4015 | // *TODO:translate |
4022 | LLString::format_map_t args; | 4016 | LLStringUtil::format_map_t args; |
4023 | args["[MESSAGE]"] = desc; | 4017 | args["[MESSAGE]"] = desc; |
4024 | LLNotifyBox::showXml("SystemMessage", args); | 4018 | LLNotifyBox::showXml("SystemMessage", args); |
4025 | 4019 | ||
@@ -4039,8 +4033,8 @@ void process_money_balance_reply( LLMessageSystem* msg, void** ) | |||
4039 | 4033 | ||
4040 | void process_agent_alert_message(LLMessageSystem* msgsystem, void** user_data) | 4034 | void process_agent_alert_message(LLMessageSystem* msgsystem, void** user_data) |
4041 | { | 4035 | { |
4042 | char buffer[MAX_STRING]; /* Flawfinder: ignore */ | 4036 | std::string buffer; |
4043 | msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, MAX_STRING, buffer); | 4037 | msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, buffer); |
4044 | BOOL modal = FALSE; | 4038 | BOOL modal = FALSE; |
4045 | msgsystem->getBOOL("AlertData", "Modal", modal); | 4039 | msgsystem->getBOOL("AlertData", "Modal", modal); |
4046 | process_alert_core(buffer, modal); | 4040 | process_alert_core(buffer, modal); |
@@ -4048,8 +4042,8 @@ void process_agent_alert_message(LLMessageSystem* msgsystem, void** user_data) | |||
4048 | 4042 | ||
4049 | void process_alert_message(LLMessageSystem *msgsystem, void **user_data) | 4043 | void process_alert_message(LLMessageSystem *msgsystem, void **user_data) |
4050 | { | 4044 | { |
4051 | char buffer[MAX_STRING]; /* Flawfinder: ignore */ | 4045 | std::string buffer; |
4052 | msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, MAX_STRING, buffer); | 4046 | msgsystem->getStringFast(_PREHASH_AlertData, _PREHASH_Message, buffer); |
4053 | BOOL modal = FALSE; | 4047 | BOOL modal = FALSE; |
4054 | process_alert_core(buffer, modal); | 4048 | process_alert_core(buffer, modal); |
4055 | } | 4049 | } |
@@ -4068,7 +4062,7 @@ void process_alert_core(const std::string& message, BOOL modal) | |||
4068 | else if( message == "Home position set." ) | 4062 | else if( message == "Home position set." ) |
4069 | { | 4063 | { |
4070 | // save the home location image to disk | 4064 | // save the home location image to disk |
4071 | LLString snap_filename = gDirUtilp->getLindenUserDir(); | 4065 | std::string snap_filename = gDirUtilp->getLindenUserDir(); |
4072 | snap_filename += gDirUtilp->getDirDelimiter(); | 4066 | snap_filename += gDirUtilp->getDirDelimiter(); |
4073 | snap_filename += SCREEN_HOME_FILENAME; | 4067 | snap_filename += SCREEN_HOME_FILENAME; |
4074 | gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, FALSE); | 4068 | gViewerWindow->saveSnapshot(snap_filename, gViewerWindow->getWindowDisplayWidth(), gViewerWindow->getWindowDisplayHeight(), FALSE, FALSE); |
@@ -4093,19 +4087,19 @@ void process_alert_core(const std::string& message, BOOL modal) | |||
4093 | else if (message[0] == '/') | 4087 | else if (message[0] == '/') |
4094 | { | 4088 | { |
4095 | // System message is important, show in upper-right box not tip | 4089 | // System message is important, show in upper-right box not tip |
4096 | LLString text(message.substr(1)); | 4090 | std::string text(message.substr(1)); |
4097 | LLString::format_map_t args; | 4091 | LLStringUtil::format_map_t args; |
4098 | if (text.substr(0,17) == "RESTART_X_MINUTES") | 4092 | if (text.substr(0,17) == "RESTART_X_MINUTES") |
4099 | { | 4093 | { |
4100 | S32 mins = 0; | 4094 | S32 mins = 0; |
4101 | LLString::convertToS32(text.substr(18), mins); | 4095 | LLStringUtil::convertToS32(text.substr(18), mins); |
4102 | args["[MINUTES]"] = llformat("%d",mins); | 4096 | args["[MINUTES]"] = llformat("%d",mins); |
4103 | LLNotifyBox::showXml("RegionRestartMinutes", args); | 4097 | LLNotifyBox::showXml("RegionRestartMinutes", args); |
4104 | } | 4098 | } |
4105 | else if (text.substr(0,17) == "RESTART_X_SECONDS") | 4099 | else if (text.substr(0,17) == "RESTART_X_SECONDS") |
4106 | { | 4100 | { |
4107 | S32 secs = 0; | 4101 | S32 secs = 0; |
4108 | LLString::convertToS32(text.substr(18), secs); | 4102 | LLStringUtil::convertToS32(text.substr(18), secs); |
4109 | args["[SECONDS]"] = llformat("%d",secs); | 4103 | args["[SECONDS]"] = llformat("%d",secs); |
4110 | LLNotifyBox::showXml("RegionRestartSeconds", args); | 4104 | LLNotifyBox::showXml("RegionRestartSeconds", args); |
4111 | } | 4105 | } |
@@ -4119,14 +4113,14 @@ void process_alert_core(const std::string& message, BOOL modal) | |||
4119 | else if (modal) | 4113 | else if (modal) |
4120 | { | 4114 | { |
4121 | // *TODO:translate | 4115 | // *TODO:translate |
4122 | LLString::format_map_t args; | 4116 | LLStringUtil::format_map_t args; |
4123 | args["[ERROR_MESSAGE]"] = message; | 4117 | args["[ERROR_MESSAGE]"] = message; |
4124 | gViewerWindow->alertXml("ErrorMessage", args); | 4118 | gViewerWindow->alertXml("ErrorMessage", args); |
4125 | } | 4119 | } |
4126 | else | 4120 | else |
4127 | { | 4121 | { |
4128 | // *TODO:translate | 4122 | // *TODO:translate |
4129 | LLString::format_map_t args; | 4123 | LLStringUtil::format_map_t args; |
4130 | args["[MESSAGE]"] = message; | 4124 | args["[MESSAGE]"] = message; |
4131 | LLNotifyBox::showXml("SystemMessageTip", args); | 4125 | LLNotifyBox::showXml("SystemMessageTip", args); |
4132 | } | 4126 | } |
@@ -4145,7 +4139,7 @@ void handle_show_mean_events(void *) | |||
4145 | LLFloaterBump::show(NULL); | 4139 | LLFloaterBump::show(NULL); |
4146 | } | 4140 | } |
4147 | 4141 | ||
4148 | void mean_name_callback(const LLUUID &id, const char *first, const char *last, BOOL always_false, void* data) | 4142 | void mean_name_callback(const LLUUID &id, const std::string& first, const std::string& last, BOOL always_false, void* data) |
4149 | { | 4143 | { |
4150 | if (gNoRender) | 4144 | if (gNoRender) |
4151 | { | 4145 | { |
@@ -4167,10 +4161,8 @@ void mean_name_callback(const LLUUID &id, const char *first, const char *last, B | |||
4167 | LLMeanCollisionData *mcd = *iter; | 4161 | LLMeanCollisionData *mcd = *iter; |
4168 | if (mcd->mPerp == id) | 4162 | if (mcd->mPerp == id) |
4169 | { | 4163 | { |
4170 | strncpy(mcd->mFirstName, first, DB_FIRST_NAME_BUF_SIZE -1); /* Flawfinder: ignore */ | 4164 | mcd->mFirstName = first; |
4171 | mcd->mFirstName[DB_FIRST_NAME_BUF_SIZE -1] = '\0'; | 4165 | mcd->mLastName = last; |
4172 | strncpy(mcd->mLastName, last, DB_LAST_NAME_BUF_SIZE -1); /* Flawfinder: ignore */ | ||
4173 | mcd->mLastName[DB_LAST_NAME_BUF_SIZE -1] = '\0'; | ||
4174 | } | 4166 | } |
4175 | } | 4167 | } |
4176 | } | 4168 | } |
@@ -4265,7 +4257,7 @@ void process_economy_data(LLMessageSystem *msg, void** /*user_data*/) | |||
4265 | class LLScriptQuestionCBData | 4257 | class LLScriptQuestionCBData |
4266 | { | 4258 | { |
4267 | public: | 4259 | public: |
4268 | LLScriptQuestionCBData(const LLUUID &taskid, const LLUUID &itemid, const LLHost &sender, S32 questions, const char *object_name, const char *owner_name) | 4260 | LLScriptQuestionCBData(const LLUUID &taskid, const LLUUID &itemid, const LLHost &sender, S32 questions, const std::string& object_name, const std::string& owner_name) |
4269 | : mTaskID(taskid), mItemID(itemid), mSender(sender), mQuestions(questions), mObjectName(object_name), mOwnerName(owner_name) | 4261 | : mTaskID(taskid), mItemID(itemid), mSender(sender), mQuestions(questions), mObjectName(object_name), mOwnerName(owner_name) |
4270 | { | 4262 | { |
4271 | } | 4263 | } |
@@ -4274,8 +4266,8 @@ public: | |||
4274 | LLUUID mItemID; | 4266 | LLUUID mItemID; |
4275 | LLHost mSender; | 4267 | LLHost mSender; |
4276 | S32 mQuestions; | 4268 | S32 mQuestions; |
4277 | LLString mObjectName; | 4269 | std::string mObjectName; |
4278 | LLString mOwnerName; | 4270 | std::string mOwnerName; |
4279 | }; | 4271 | }; |
4280 | 4272 | ||
4281 | void notify_cautioned_script_question(LLScriptQuestionCBData* cbdata, S32 orig_questions, BOOL granted) | 4273 | void notify_cautioned_script_question(LLScriptQuestionCBData* cbdata, S32 orig_questions, BOOL granted) |
@@ -4310,7 +4302,7 @@ void notify_cautioned_script_question(LLScriptQuestionCBData* cbdata, S32 orig_q | |||
4310 | { | 4302 | { |
4311 | // got the region, so include the region and 3d coordinates of the object | 4303 | // got the region, so include the region and 3d coordinates of the object |
4312 | notice.setArg("[REGIONNAME]", viewregion->getName()); | 4304 | notice.setArg("[REGIONNAME]", viewregion->getName()); |
4313 | LLString formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]); | 4305 | std::string formatpos = llformat("%.1f, %.1f,%.1f", objpos[VX], objpos[VY], objpos[VZ]); |
4314 | notice.setArg("[REGIONPOS]", formatpos); | 4306 | notice.setArg("[REGIONPOS]", formatpos); |
4315 | 4307 | ||
4316 | foundpos = TRUE; | 4308 | foundpos = TRUE; |
@@ -4328,7 +4320,7 @@ void notify_cautioned_script_question(LLScriptQuestionCBData* cbdata, S32 orig_q | |||
4328 | // permission that has been flagged as a caution permission | 4320 | // permission that has been flagged as a caution permission |
4329 | BOOL caution = FALSE; | 4321 | BOOL caution = FALSE; |
4330 | S32 count = 0; | 4322 | S32 count = 0; |
4331 | LLString perms; | 4323 | std::string perms; |
4332 | for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++) | 4324 | for (S32 i = 0; i < SCRIPT_PERMISSION_EOF; i++) |
4333 | { | 4325 | { |
4334 | if ((orig_questions & LSCRIPTRunTimePermissionBits[i]) && LLNotifyBox::getTemplateIsCaution(SCRIPT_QUESTIONS[i])) | 4326 | if ((orig_questions & LSCRIPTRunTimePermissionBits[i]) && LLNotifyBox::getTemplateIsCaution(SCRIPT_QUESTIONS[i])) |
@@ -4455,26 +4447,25 @@ void process_script_question(LLMessageSystem *msg, void **user_data) | |||
4455 | LLUUID taskid; | 4447 | LLUUID taskid; |
4456 | LLUUID itemid; | 4448 | LLUUID itemid; |
4457 | S32 questions; | 4449 | S32 questions; |
4458 | char object_name[255]; /* Flawfinder: ignore */ | 4450 | std::string object_name; |
4459 | char owner_name[DB_FULL_NAME_BUF_SIZE]; /* Flawfinder: ignore */ | 4451 | std::string owner_name; |
4460 | 4452 | ||
4461 | // taskid -> object key of object requesting permissions | 4453 | // taskid -> object key of object requesting permissions |
4462 | msg->getUUIDFast(_PREHASH_Data, _PREHASH_TaskID, taskid ); | 4454 | msg->getUUIDFast(_PREHASH_Data, _PREHASH_TaskID, taskid ); |
4463 | // itemid -> script asset key of script requesting permissions | 4455 | // itemid -> script asset key of script requesting permissions |
4464 | msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid ); | 4456 | msg->getUUIDFast(_PREHASH_Data, _PREHASH_ItemID, itemid ); |
4465 | msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectName, 255, object_name); | 4457 | msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectName, object_name); |
4466 | msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, DB_FULL_NAME_BUF_SIZE, owner_name); | 4458 | msg->getStringFast(_PREHASH_Data, _PREHASH_ObjectOwner, owner_name); |
4467 | msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions ); | 4459 | msg->getS32Fast(_PREHASH_Data, _PREHASH_Questions, questions ); |
4468 | 4460 | ||
4469 | // don't display permission requests if this object is muted - JS. | 4461 | // don't display permission requests if this object is muted - JS. |
4470 | if (LLMuteList::getInstance()->isMuted(taskid)) return; | 4462 | if (LLMuteList::getInstance()->isMuted(taskid)) return; |
4471 | 4463 | ||
4472 | // throttle excessive requests from any specific user's scripts | 4464 | // throttle excessive requests from any specific user's scripts |
4473 | LLString throttle_owner_name = owner_name; | 4465 | typedef LLKeyThrottle<std::string> LLStringThrottle; |
4474 | typedef LLKeyThrottle<LLString> LLStringThrottle; | ||
4475 | static LLStringThrottle question_throttle( LLREQUEST_PERMISSION_THROTTLE_LIMIT, LLREQUEST_PERMISSION_THROTTLE_INTERVAL ); | 4466 | static LLStringThrottle question_throttle( LLREQUEST_PERMISSION_THROTTLE_LIMIT, LLREQUEST_PERMISSION_THROTTLE_INTERVAL ); |
4476 | 4467 | ||
4477 | switch (question_throttle.noteAction(throttle_owner_name)) | 4468 | switch (question_throttle.noteAction(owner_name)) |
4478 | { | 4469 | { |
4479 | case LLStringThrottle::THROTTLE_NEWLY_BLOCKED: | 4470 | case LLStringThrottle::THROTTLE_NEWLY_BLOCKED: |
4480 | LL_INFOS("Messaging") << "process_script_question throttled" | 4471 | LL_INFOS("Messaging") << "process_script_question throttled" |
@@ -4490,12 +4481,12 @@ void process_script_question(LLMessageSystem *msg, void **user_data) | |||
4490 | break; | 4481 | break; |
4491 | } | 4482 | } |
4492 | 4483 | ||
4493 | LLString script_question; | 4484 | std::string script_question; |
4494 | if (questions) | 4485 | if (questions) |
4495 | { | 4486 | { |
4496 | BOOL caution = FALSE; | 4487 | BOOL caution = FALSE; |
4497 | S32 count = 0; | 4488 | S32 count = 0; |
4498 | LLString::format_map_t args; | 4489 | LLStringUtil::format_map_t args; |
4499 | args["[OBJECTNAME]"] = object_name; | 4490 | args["[OBJECTNAME]"] = object_name; |
4500 | args["[NAME]"] = owner_name; | 4491 | args["[NAME]"] = owner_name; |
4501 | 4492 | ||
@@ -4563,7 +4554,7 @@ void container_inventory_arrived(LLViewerObject* object, | |||
4563 | LLUUID cat_id; | 4554 | LLUUID cat_id; |
4564 | cat_id = gInventory.createNewCategory(gAgent.getInventoryRootID(), | 4555 | cat_id = gInventory.createNewCategory(gAgent.getInventoryRootID(), |
4565 | LLAssetType::AT_NONE, | 4556 | LLAssetType::AT_NONE, |
4566 | "Acquired Items"); | 4557 | std::string("Acquired Items")); //TODO: Translate |
4567 | 4558 | ||
4568 | InventoryObjectList::const_iterator it = inventory->begin(); | 4559 | InventoryObjectList::const_iterator it = inventory->begin(); |
4569 | InventoryObjectList::const_iterator end = inventory->end(); | 4560 | InventoryObjectList::const_iterator end = inventory->end(); |
@@ -4576,7 +4567,7 @@ void container_inventory_arrived(LLViewerObject* object, | |||
4576 | LLInventoryItem* item = (LLInventoryItem*)(obj); | 4567 | LLInventoryItem* item = (LLInventoryItem*)(obj); |
4577 | LLUUID item_id; | 4568 | LLUUID item_id; |
4578 | item_id.generate(); | 4569 | item_id.generate(); |
4579 | S32 creation_date_utc = time_corrected(); | 4570 | time_t creation_date_utc = time_corrected(); |
4580 | LLPointer<LLViewerInventoryItem> new_item | 4571 | LLPointer<LLViewerInventoryItem> new_item |
4581 | = new LLViewerInventoryItem(item_id, | 4572 | = new LLViewerInventoryItem(item_id, |
4582 | cat_id, | 4573 | cat_id, |
@@ -4616,7 +4607,7 @@ void container_inventory_arrived(LLViewerObject* object, | |||
4616 | 4607 | ||
4617 | LLUUID item_id; | 4608 | LLUUID item_id; |
4618 | item_id.generate(); | 4609 | item_id.generate(); |
4619 | S32 creation_date_utc = time_corrected(); | 4610 | time_t creation_date_utc = time_corrected(); |
4620 | LLPointer<LLViewerInventoryItem> new_item | 4611 | LLPointer<LLViewerInventoryItem> new_item |
4621 | = new LLViewerInventoryItem(item_id, category, | 4612 | = new LLViewerInventoryItem(item_id, category, |
4622 | item->getPermissions(), | 4613 | item->getPermissions(), |
@@ -4654,24 +4645,23 @@ void container_inventory_arrived(LLViewerObject* object, | |||
4654 | } | 4645 | } |
4655 | } | 4646 | } |
4656 | 4647 | ||
4657 | // method to format the time. Buffer should be at least | 4648 | // method to format the time. |
4658 | // TIME_STR_LENGTH long, and the function returns buffer (for use in | 4649 | std::string formatted_time(const time_t& the_time) |
4659 | // sprintf and the like) | ||
4660 | char* formatted_time(const time_t& the_time, char* buffer) | ||
4661 | { | 4650 | { |
4662 | LLString::copy(buffer, ctime(&the_time), TIME_STR_LENGTH); | 4651 | char buffer[30]; /* Flawfinder: ignore */ |
4652 | LLStringUtil::copy(buffer, ctime(&the_time), 30); | ||
4663 | buffer[24] = '\0'; | 4653 | buffer[24] = '\0'; |
4664 | return buffer; | 4654 | return std::string(buffer); |
4665 | } | 4655 | } |
4666 | 4656 | ||
4667 | 4657 | ||
4668 | void process_teleport_failed(LLMessageSystem *msg, void**) | 4658 | void process_teleport_failed(LLMessageSystem *msg, void**) |
4669 | { | 4659 | { |
4670 | char reason[STD_STRING_BUF_SIZE]; /* Flawfinder: ignore */ | 4660 | std::string reason; |
4671 | msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, STD_STRING_BUF_SIZE, reason); | 4661 | msg->getStringFast(_PREHASH_Info, _PREHASH_Reason, reason); |
4672 | 4662 | ||
4673 | LLStringBase<char>::format_map_t args; | 4663 | LLStringUtil::format_map_t args; |
4674 | LLString big_reason = LLAgent::sTeleportErrorMessages[reason]; | 4664 | std::string big_reason = LLAgent::sTeleportErrorMessages[reason]; |
4675 | if ( big_reason.size() > 0 ) | 4665 | if ( big_reason.size() > 0 ) |
4676 | { // Substitute verbose reason from the local map | 4666 | { // Substitute verbose reason from the local map |
4677 | args["[REASON]"] = big_reason; | 4667 | args["[REASON]"] = big_reason; |
@@ -4735,14 +4725,14 @@ void process_teleport_local(LLMessageSystem *msg,void**) | |||
4735 | } | 4725 | } |
4736 | 4726 | ||
4737 | void send_simple_im(const LLUUID& to_id, | 4727 | void send_simple_im(const LLUUID& to_id, |
4738 | const char* message, | 4728 | const std::string& message, |
4739 | EInstantMessage dialog, | 4729 | EInstantMessage dialog, |
4740 | const LLUUID& id) | 4730 | const LLUUID& id) |
4741 | { | 4731 | { |
4742 | std::string my_name; | 4732 | std::string my_name; |
4743 | gAgent.buildFullname(my_name); | 4733 | gAgent.buildFullname(my_name); |
4744 | send_improved_im(to_id, | 4734 | send_improved_im(to_id, |
4745 | my_name.c_str(), | 4735 | my_name, |
4746 | message, | 4736 | message, |
4747 | IM_ONLINE, | 4737 | IM_ONLINE, |
4748 | dialog, | 4738 | dialog, |
@@ -4753,8 +4743,8 @@ void send_simple_im(const LLUUID& to_id, | |||
4753 | } | 4743 | } |
4754 | 4744 | ||
4755 | void send_group_notice(const LLUUID& group_id, | 4745 | void send_group_notice(const LLUUID& group_id, |
4756 | const char* subject, | 4746 | const std::string& subject, |
4757 | const char* message, | 4747 | const std::string& message, |
4758 | const LLInventoryItem* item) | 4748 | const LLInventoryItem* item) |
4759 | { | 4749 | { |
4760 | // Put this notice into an instant message form. | 4750 | // Put this notice into an instant message form. |
@@ -4793,8 +4783,8 @@ void send_group_notice(const LLUUID& group_id, | |||
4793 | 4783 | ||
4794 | send_improved_im( | 4784 | send_improved_im( |
4795 | group_id, | 4785 | group_id, |
4796 | my_name.c_str(), | 4786 | my_name, |
4797 | subject_and_message.str().c_str(), | 4787 | subject_and_message.str(), |
4798 | IM_ONLINE, | 4788 | IM_ONLINE, |
4799 | IM_GROUP_NOTICE, | 4789 | IM_GROUP_NOTICE, |
4800 | LLUUID::null, | 4790 | LLUUID::null, |
@@ -4803,7 +4793,7 @@ void send_group_notice(const LLUUID& group_id, | |||
4803 | bin_bucket_size); | 4793 | bin_bucket_size); |
4804 | } | 4794 | } |
4805 | 4795 | ||
4806 | void handle_lure_callback(S32 option, const LLString& text, void* userdata) | 4796 | void handle_lure_callback(S32 option, const std::string& text, void* userdata) |
4807 | { | 4797 | { |
4808 | LLDynamicArray<LLUUID>* invitees = (LLDynamicArray<LLUUID>*)userdata; | 4798 | LLDynamicArray<LLUUID>* invitees = (LLDynamicArray<LLUUID>*)userdata; |
4809 | 4799 | ||
@@ -4816,7 +4806,7 @@ void handle_lure_callback(S32 option, const LLString& text, void* userdata) | |||
4816 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); | 4806 | msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); |
4817 | msg->nextBlockFast(_PREHASH_Info); | 4807 | msg->nextBlockFast(_PREHASH_Info); |
4818 | msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in. | 4808 | msg->addU8Fast(_PREHASH_LureType, (U8)0); // sim will fill this in. |
4819 | msg->addStringFast(_PREHASH_Message, text.c_str()); | 4809 | msg->addStringFast(_PREHASH_Message, text); |
4820 | for(LLDynamicArray<LLUUID>::iterator itr = invitees->begin(); itr != invitees->end(); ++itr) | 4810 | for(LLDynamicArray<LLUUID>::iterator itr = invitees->begin(); itr != invitees->end(); ++itr) |
4821 | { | 4811 | { |
4822 | msg->nextBlockFast(_PREHASH_TargetData); | 4812 | msg->nextBlockFast(_PREHASH_TargetData); |
@@ -4831,7 +4821,7 @@ void handle_lure_callback(S32 option, const LLString& text, void* userdata) | |||
4831 | 4821 | ||
4832 | void handle_lure_callback_godlike(S32 option, void* userdata) | 4822 | void handle_lure_callback_godlike(S32 option, void* userdata) |
4833 | { | 4823 | { |
4834 | handle_lure_callback(option, LLString::null, userdata); | 4824 | handle_lure_callback(option, LLStringUtil::null, userdata); |
4835 | } | 4825 | } |
4836 | 4826 | ||
4837 | void handle_lure(const LLUUID& invitee) | 4827 | void handle_lure(const LLUUID& invitee) |
@@ -4846,7 +4836,7 @@ void handle_lure(LLDynamicArray<LLUUID>& ids) | |||
4846 | { | 4836 | { |
4847 | LLDynamicArray<LLUUID>* userdata = new LLDynamicArray<LLUUID>(ids); | 4837 | LLDynamicArray<LLUUID>* userdata = new LLDynamicArray<LLUUID>(ids); |
4848 | 4838 | ||
4849 | LLString::format_map_t edit_args; | 4839 | LLStringUtil::format_map_t edit_args; |
4850 | edit_args["[REGION]"] = gAgent.getRegion()->getName(); | 4840 | edit_args["[REGION]"] = gAgent.getRegion()->getName(); |
4851 | if (gAgent.isGodlike()) | 4841 | if (gAgent.isGodlike()) |
4852 | { | 4842 | { |
@@ -4864,8 +4854,8 @@ void handle_lure(LLDynamicArray<LLUUID>& ids) | |||
4864 | 4854 | ||
4865 | 4855 | ||
4866 | void send_improved_im(const LLUUID& to_id, | 4856 | void send_improved_im(const LLUUID& to_id, |
4867 | const char* name, | 4857 | const std::string& name, |
4868 | const char* message, | 4858 | const std::string& message, |
4869 | U8 offline, | 4859 | U8 offline, |
4870 | EInstantMessage dialog, | 4860 | EInstantMessage dialog, |
4871 | const LLUUID& id, | 4861 | const LLUUID& id, |
@@ -4896,10 +4886,10 @@ void send_improved_im(const LLUUID& to_id, | |||
4896 | 4886 | ||
4897 | void send_places_query(const LLUUID& query_id, | 4887 | void send_places_query(const LLUUID& query_id, |
4898 | const LLUUID& trans_id, | 4888 | const LLUUID& trans_id, |
4899 | const char* query_text, | 4889 | const std::string& query_text, |
4900 | U32 query_flags, | 4890 | U32 query_flags, |
4901 | S32 category, | 4891 | S32 category, |
4902 | const char* sim_name) | 4892 | const std::string& sim_name) |
4903 | { | 4893 | { |
4904 | LLMessageSystem* msg = gMessageSystem; | 4894 | LLMessageSystem* msg = gMessageSystem; |
4905 | 4895 | ||
@@ -4931,12 +4921,10 @@ void process_user_info_reply(LLMessageSystem* msg, void**) | |||
4931 | 4921 | ||
4932 | BOOL im_via_email; | 4922 | BOOL im_via_email; |
4933 | msg->getBOOLFast(_PREHASH_UserData, _PREHASH_IMViaEMail, im_via_email); | 4923 | msg->getBOOLFast(_PREHASH_UserData, _PREHASH_IMViaEMail, im_via_email); |
4934 | char email[DB_USER_EMAIL_ADDR_BUF_SIZE]; /* Flawfinder: ignore */ | 4924 | std::string email; |
4935 | msg->getStringFast(_PREHASH_UserData, _PREHASH_EMail, DB_USER_EMAIL_ADDR_BUF_SIZE, | 4925 | msg->getStringFast(_PREHASH_UserData, _PREHASH_EMail, email); |
4936 | email); | 4926 | std::string dir_visibility; |
4937 | char dir_visibility[MAX_STRING]; /* Flawfinder: ignore */ | 4927 | msg->getString( "UserData", "DirectoryVisibility", dir_visibility); |
4938 | msg->getString( | ||
4939 | "UserData", "DirectoryVisibility", MAX_STRING, dir_visibility); | ||
4940 | 4928 | ||
4941 | LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, email); | 4929 | LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email, email); |
4942 | LLFloaterPostcard::updateUserInfo(email); | 4930 | LLFloaterPostcard::updateUserInfo(email); |
@@ -4957,7 +4945,7 @@ struct ScriptDialogInfo | |||
4957 | LLHost mSender; | 4945 | LLHost mSender; |
4958 | LLUUID mObjectID; | 4946 | LLUUID mObjectID; |
4959 | S32 mChatChannel; | 4947 | S32 mChatChannel; |
4960 | std::vector<LLString> mButtons; | 4948 | std::vector<std::string> mButtons; |
4961 | }; | 4949 | }; |
4962 | 4950 | ||
4963 | void callback_script_dialog(S32 option, void* data) | 4951 | void callback_script_dialog(S32 option, void* data) |
@@ -4990,19 +4978,17 @@ void process_script_dialog(LLMessageSystem* msg, void**) | |||
4990 | 4978 | ||
4991 | ScriptDialogInfo* info = new ScriptDialogInfo; | 4979 | ScriptDialogInfo* info = new ScriptDialogInfo; |
4992 | 4980 | ||
4993 | const S32 messageLength = SCRIPT_DIALOG_MAX_MESSAGE_SIZE + sizeof(SCRIPT_DIALOG_HEADER); | 4981 | std::string message; // Account for size of "Script Dialog:\n" |
4994 | char message[messageLength]; /* Flawfinder: ignore */ // Account for size of "Script Dialog:\n" | 4982 | std::string first_name; |
4995 | 4983 | std::string last_name; | |
4996 | char first_name[DB_FIRST_NAME_BUF_SIZE]; /* Flawfinder: ignore */ | 4984 | std::string title; |
4997 | char last_name[DB_GROUP_NAME_BUF_SIZE]; /* Flawfinder: ignore */ | ||
4998 | char title[DB_INV_ITEM_NAME_BUF_SIZE]; /* Flawfinder: ignore */ | ||
4999 | info->mSender = msg->getSender(); | 4985 | info->mSender = msg->getSender(); |
5000 | 4986 | ||
5001 | msg->getUUID("Data", "ObjectID", info->mObjectID); | 4987 | msg->getUUID("Data", "ObjectID", info->mObjectID); |
5002 | msg->getString("Data", "FirstName", DB_FIRST_NAME_BUF_SIZE, first_name); | 4988 | msg->getString("Data", "FirstName", first_name); |
5003 | msg->getString("Data", "LastName", DB_LAST_NAME_BUF_SIZE, last_name); | 4989 | msg->getString("Data", "LastName", last_name); |
5004 | msg->getString("Data", "ObjectName", DB_INV_ITEM_NAME_BUF_SIZE, title); | 4990 | msg->getString("Data", "ObjectName", title); |
5005 | msg->getString("Data", "Message", SCRIPT_DIALOG_MAX_MESSAGE_SIZE, message); | 4991 | msg->getString("Data", "Message", message); |
5006 | msg->getS32("Data", "ChatChannel", info->mChatChannel); | 4992 | msg->getS32("Data", "ChatChannel", info->mChatChannel); |
5007 | 4993 | ||
5008 | // unused for now | 4994 | // unused for now |
@@ -5017,15 +5003,15 @@ void process_script_dialog(LLMessageSystem* msg, void**) | |||
5017 | 5003 | ||
5018 | for (i = 0; i < button_count; i++) | 5004 | for (i = 0; i < button_count; i++) |
5019 | { | 5005 | { |
5020 | char tdesc[SCRIPT_DIALOG_BUTTON_STR_SIZE+1]; /* Flawfinder: ignore */ | 5006 | std::string tdesc; |
5021 | msg->getString("Buttons", "ButtonLabel", SCRIPT_DIALOG_BUTTON_STR_SIZE + 1, tdesc, i); | 5007 | msg->getString("Buttons", "ButtonLabel", tdesc, i); |
5022 | info->mButtons.push_back(LLString(tdesc)); | 5008 | info->mButtons.push_back(tdesc); |
5023 | } | 5009 | } |
5024 | 5010 | ||
5025 | LLStringBase<char>::format_map_t args; | 5011 | LLStringUtil::format_map_t args; |
5026 | args["[TITLE]"] = title; | 5012 | args["[TITLE]"] = title; |
5027 | args["[MESSAGE]"] = message; | 5013 | args["[MESSAGE]"] = message; |
5028 | if (strlen(first_name) > 0) /* Flawfinder: ignore */ | 5014 | if (!first_name.empty()) |
5029 | { | 5015 | { |
5030 | args["[FIRST]"] = first_name; | 5016 | args["[FIRST]"] = first_name; |
5031 | args["[LAST]"] = last_name; | 5017 | args["[LAST]"] = last_name; |
@@ -5051,9 +5037,9 @@ struct LoadUrlInfo | |||
5051 | LLUUID mObjectID; | 5037 | LLUUID mObjectID; |
5052 | LLUUID mOwnerID; | 5038 | LLUUID mOwnerID; |
5053 | BOOL mOwnerIsGroup; | 5039 | BOOL mOwnerIsGroup; |
5054 | char mObjectName[256]; /* Flawfinder: ignore */ | 5040 | std::string mObjectName; |
5055 | char mMessage[256]; /* Flawfinder: ignore */ | 5041 | std::string mMessage; |
5056 | char mUrl[256]; /* Flawfinder: ignore */ | 5042 | std::string mUrl; |
5057 | }; | 5043 | }; |
5058 | 5044 | ||
5059 | std::vector<LoadUrlInfo*> gLoadUrlList; | 5045 | std::vector<LoadUrlInfo*> gLoadUrlList; |
@@ -5075,7 +5061,7 @@ void callback_load_url(S32 option, void* data) | |||
5075 | 5061 | ||
5076 | // We've got the name of the person who owns the object hurling the url. | 5062 | // We've got the name of the person who owns the object hurling the url. |
5077 | // Display confirmation dialog. | 5063 | // Display confirmation dialog. |
5078 | void callback_load_url_name(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* data) | 5064 | void callback_load_url_name(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* data) |
5079 | { | 5065 | { |
5080 | std::vector<LoadUrlInfo*>::iterator it; | 5066 | std::vector<LoadUrlInfo*>::iterator it; |
5081 | for (it = gLoadUrlList.begin(); it != gLoadUrlList.end(); ) | 5067 | for (it = gLoadUrlList.begin(); it != gLoadUrlList.end(); ) |
@@ -5085,15 +5071,14 @@ void callback_load_url_name(const LLUUID& id, const char* first, const char* las | |||
5085 | { | 5071 | { |
5086 | it = gLoadUrlList.erase(it); | 5072 | it = gLoadUrlList.erase(it); |
5087 | 5073 | ||
5088 | std::string owner_name(first); | 5074 | std::string owner_name; |
5089 | if (is_group) | 5075 | if (is_group) |
5090 | { | 5076 | { |
5091 | owner_name += " (group)"; | 5077 | owner_name = first + " (group)"; |
5092 | } | 5078 | } |
5093 | else | 5079 | else |
5094 | { | 5080 | { |
5095 | owner_name += " "; | 5081 | owner_name = first + " " + last; |
5096 | owner_name += last; | ||
5097 | } | 5082 | } |
5098 | 5083 | ||
5099 | // For legacy name-only mutes. | 5084 | // For legacy name-only mutes. |
@@ -5103,7 +5088,7 @@ void callback_load_url_name(const LLUUID& id, const char* first, const char* las | |||
5103 | infop = NULL; | 5088 | infop = NULL; |
5104 | continue; | 5089 | continue; |
5105 | } | 5090 | } |
5106 | LLString::format_map_t args; | 5091 | LLStringUtil::format_map_t args; |
5107 | args["[URL]"] = infop->mUrl; | 5092 | args["[URL]"] = infop->mUrl; |
5108 | args["[MESSAGE]"] = infop->mMessage; | 5093 | args["[MESSAGE]"] = infop->mMessage; |
5109 | args["[OBJECTNAME]"] = infop->mObjectName; | 5094 | args["[OBJECTNAME]"] = infop->mObjectName; |
@@ -5121,12 +5106,12 @@ void process_load_url(LLMessageSystem* msg, void**) | |||
5121 | { | 5106 | { |
5122 | LoadUrlInfo* infop = new LoadUrlInfo; | 5107 | LoadUrlInfo* infop = new LoadUrlInfo; |
5123 | 5108 | ||
5124 | msg->getString("Data", "ObjectName", 256, infop->mObjectName); | 5109 | msg->getString("Data", "ObjectName", infop->mObjectName); |
5125 | msg->getUUID( "Data", "ObjectID", infop->mObjectID); | 5110 | msg->getUUID( "Data", "ObjectID", infop->mObjectID); |
5126 | msg->getUUID( "Data", "OwnerID", infop->mOwnerID); | 5111 | msg->getUUID( "Data", "OwnerID", infop->mOwnerID); |
5127 | msg->getBOOL( "Data", "OwnerIsGroup", infop->mOwnerIsGroup); | 5112 | msg->getBOOL( "Data", "OwnerIsGroup", infop->mOwnerIsGroup); |
5128 | msg->getString("Data", "Message", 256, infop->mMessage); | 5113 | msg->getString("Data", "Message", infop->mMessage); |
5129 | msg->getString("Data", "URL", 256, infop->mUrl); | 5114 | msg->getString("Data", "URL", infop->mUrl); |
5130 | 5115 | ||
5131 | // URL is safety checked in load_url above | 5116 | // URL is safety checked in load_url above |
5132 | 5117 | ||
@@ -5149,8 +5134,8 @@ void process_load_url(LLMessageSystem* msg, void**) | |||
5149 | 5134 | ||
5150 | void callback_download_complete(void** data, S32 result, LLExtStat ext_status) | 5135 | void callback_download_complete(void** data, S32 result, LLExtStat ext_status) |
5151 | { | 5136 | { |
5152 | LLString* filepath = (LLString*)data; | 5137 | std::string* filepath = (std::string*)data; |
5153 | LLString::format_map_t args; | 5138 | LLStringUtil::format_map_t args; |
5154 | args["[DOWNLOAD_PATH]"] = *filepath; | 5139 | args["[DOWNLOAD_PATH]"] = *filepath; |
5155 | gViewerWindow->alertXml("FinishedRawDownload", args); | 5140 | gViewerWindow->alertXml("FinishedRawDownload", args); |
5156 | delete filepath; | 5141 | delete filepath; |
@@ -5167,10 +5152,10 @@ void process_initiate_download(LLMessageSystem* msg, void**) | |||
5167 | return; | 5152 | return; |
5168 | } | 5153 | } |
5169 | 5154 | ||
5170 | char sim_filename[MAX_PATH]; /* Flawfinder: ignore */ | 5155 | std::string sim_filename; |
5171 | char viewer_filename[MAX_PATH]; /* Flawfinder: ignore */ | 5156 | std::string viewer_filename; |
5172 | msg->getString("FileData", "SimFilename", MAX_PATH, sim_filename); | 5157 | msg->getString("FileData", "SimFilename", sim_filename); |
5173 | msg->getString("FileData", "ViewerFilename", MAX_PATH, viewer_filename); | 5158 | msg->getString("FileData", "ViewerFilename", viewer_filename); |
5174 | 5159 | ||
5175 | gXferManager->requestFile(viewer_filename, | 5160 | gXferManager->requestFile(viewer_filename, |
5176 | sim_filename, | 5161 | sim_filename, |
@@ -5178,19 +5163,19 @@ void process_initiate_download(LLMessageSystem* msg, void**) | |||
5178 | msg->getSender(), | 5163 | msg->getSender(), |
5179 | FALSE, // don't delete remote | 5164 | FALSE, // don't delete remote |
5180 | callback_download_complete, | 5165 | callback_download_complete, |
5181 | (void**)new LLString(viewer_filename)); | 5166 | (void**)new std::string(viewer_filename)); |
5182 | } | 5167 | } |
5183 | 5168 | ||
5184 | 5169 | ||
5185 | void process_script_teleport_request(LLMessageSystem* msg, void**) | 5170 | void process_script_teleport_request(LLMessageSystem* msg, void**) |
5186 | { | 5171 | { |
5187 | char object_name[256]; /* Flawfinder: ignore */ | 5172 | std::string object_name; |
5188 | char sim_name[256]; /* Flawfinder: ignore */ | 5173 | std::string sim_name; |
5189 | LLVector3 pos; | 5174 | LLVector3 pos; |
5190 | LLVector3 look_at; | 5175 | LLVector3 look_at; |
5191 | 5176 | ||
5192 | msg->getString("Data", "ObjectName", 255, object_name); | 5177 | msg->getString("Data", "ObjectName", object_name); |
5193 | msg->getString( "Data", "SimName", 255, sim_name); | 5178 | msg->getString("Data", "SimName", sim_name); |
5194 | msg->getVector3("Data", "SimPosition", pos); | 5179 | msg->getVector3("Data", "SimPosition", pos); |
5195 | msg->getVector3("Data", "LookAt", look_at); | 5180 | msg->getVector3("Data", "LookAt", look_at); |
5196 | 5181 | ||
@@ -5206,11 +5191,11 @@ void process_script_teleport_request(LLMessageSystem* msg, void**) | |||
5206 | void process_covenant_reply(LLMessageSystem* msg, void**) | 5191 | void process_covenant_reply(LLMessageSystem* msg, void**) |
5207 | { | 5192 | { |
5208 | LLUUID covenant_id, estate_owner_id; | 5193 | LLUUID covenant_id, estate_owner_id; |
5209 | char estate_name[MAX_STRING]; /* Flawfinder: ignore */ | 5194 | std::string estate_name; |
5210 | U32 covenant_timestamp; | 5195 | U32 covenant_timestamp; |
5211 | msg->getUUID("Data", "CovenantID", covenant_id); | 5196 | msg->getUUID("Data", "CovenantID", covenant_id); |
5212 | msg->getU32("Data", "CovenantTimestamp", covenant_timestamp); | 5197 | msg->getU32("Data", "CovenantTimestamp", covenant_timestamp); |
5213 | msg->getString("Data", "EstateName", MAX_STRING, estate_name); | 5198 | msg->getString("Data", "EstateName", estate_name); |
5214 | msg->getUUID("Data", "EstateOwnerID", estate_owner_id); | 5199 | msg->getUUID("Data", "EstateOwnerID", estate_owner_id); |
5215 | 5200 | ||
5216 | LLPanelEstateCovenant::updateEstateName(estate_name); | 5201 | LLPanelEstateCovenant::updateEstateName(estate_name); |
@@ -5218,11 +5203,7 @@ void process_covenant_reply(LLMessageSystem* msg, void**) | |||
5218 | LLFloaterBuyLand::updateEstateName(estate_name); | 5203 | LLFloaterBuyLand::updateEstateName(estate_name); |
5219 | 5204 | ||
5220 | // standard message, not from system | 5205 | // standard message, not from system |
5221 | char last_modified[MAX_STRING]; /* Flawfinder: ignore */ | 5206 | std::string last_modified = std::string("Last Modified ") + formatted_time((time_t)covenant_timestamp); |
5222 | last_modified[0] = '\0'; | ||
5223 | char time_buf[TIME_STR_LENGTH]; /* Flawfinder: ignore */ | ||
5224 | snprintf(last_modified, MAX_STRING, "Last Modified %s", /* Flawfinder: ignore */ | ||
5225 | formatted_time((time_t)covenant_timestamp, time_buf)); | ||
5226 | 5207 | ||
5227 | LLPanelEstateCovenant::updateLastModified(last_modified); | 5208 | LLPanelEstateCovenant::updateLastModified(last_modified); |
5228 | LLPanelLandCovenant::updateLastModified(last_modified); | 5209 | LLPanelLandCovenant::updateLastModified(last_modified); |
@@ -5262,12 +5243,9 @@ void process_covenant_reply(LLMessageSystem* msg, void**) | |||
5262 | } | 5243 | } |
5263 | } | 5244 | } |
5264 | 5245 | ||
5265 | void callbackCacheEstateOwnerName( | 5246 | void callbackCacheEstateOwnerName(const LLUUID& id, |
5266 | const LLUUID& id, | 5247 | const std::string& first, const std::string& last, |
5267 | const char* first, | 5248 | BOOL is_group, void*) |
5268 | const char* last, | ||
5269 | BOOL is_group, | ||
5270 | void*) | ||
5271 | { | 5249 | { |
5272 | std::string name; | 5250 | std::string name; |
5273 | 5251 | ||
@@ -5277,9 +5255,7 @@ void callbackCacheEstateOwnerName( | |||
5277 | } | 5255 | } |
5278 | else | 5256 | else |
5279 | { | 5257 | { |
5280 | name = first; | 5258 | name = first + " " + last; |
5281 | name += " "; | ||
5282 | name += last; | ||
5283 | } | 5259 | } |
5284 | LLPanelEstateCovenant::updateEstateOwnerName(name); | 5260 | LLPanelEstateCovenant::updateEstateOwnerName(name); |
5285 | LLPanelLandCovenant::updateEstateOwnerName(name); | 5261 | LLPanelLandCovenant::updateEstateOwnerName(name); |
@@ -5314,10 +5290,10 @@ void onCovenantLoadComplete(LLVFS *vfs, | |||
5314 | if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) | 5290 | if( (file_length > 19) && !strncmp( buffer, "Linden text version", 19 ) ) |
5315 | { | 5291 | { |
5316 | LLViewerTextEditor* editor = | 5292 | LLViewerTextEditor* editor = |
5317 | new LLViewerTextEditor("temp", | 5293 | new LLViewerTextEditor(std::string("temp"), |
5318 | LLRect(0,0,0,0), | 5294 | LLRect(0,0,0,0), |
5319 | file_length+1); | 5295 | file_length+1); |
5320 | if( !editor->importBuffer( buffer ) ) | 5296 | if( !editor->importBuffer( buffer, file_length+1 ) ) |
5321 | { | 5297 | { |
5322 | LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL; | 5298 | LL_WARNS("Messaging") << "Problem importing estate covenant." << LL_ENDL; |
5323 | covenant_text = "Problem importing estate covenant."; | 5299 | covenant_text = "Problem importing estate covenant."; |
@@ -5367,12 +5343,12 @@ void process_feature_disabled_message(LLMessageSystem* msg, void**) | |||
5367 | // Handle Blacklisted feature simulator response... | 5343 | // Handle Blacklisted feature simulator response... |
5368 | LLUUID agentID; | 5344 | LLUUID agentID; |
5369 | LLUUID transactionID; | 5345 | LLUUID transactionID; |
5370 | char messageText[MAX_STRING]; /* Flawfinder: ignore */ | 5346 | std::string messageText; |
5371 | msg->getStringFast(_PREHASH_FailureInfo,_PREHASH_ErrorMessage,MAX_STRING,&messageText[0],0); | 5347 | msg->getStringFast(_PREHASH_FailureInfo,_PREHASH_ErrorMessage, messageText,0); |
5372 | msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_AgentID,agentID); | 5348 | msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_AgentID,agentID); |
5373 | msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_TransactionID,transactionID); | 5349 | msg->getUUIDFast(_PREHASH_FailureInfo,_PREHASH_TransactionID,transactionID); |
5374 | 5350 | ||
5375 | LL_WARNS("Messaging") << "Blacklisted Feature Response:" << &messageText[0] << LL_ENDL; | 5351 | LL_WARNS("Messaging") << "Blacklisted Feature Response:" << messageText << LL_ENDL; |
5376 | } | 5352 | } |
5377 | 5353 | ||
5378 | // ------------------------------------------------------------ | 5354 | // ------------------------------------------------------------ |